1 From 8dc9e73b80ec33fe1a1c855829ef1438301a5de1 Mon Sep 17 00:00:00 2001 |
1 From a8ab3ec3542469c1d4e0741121eb1be17cc0acb0 Mon Sep 17 00:00:00 2001 |
2 From: Mike Hommey <mh+mozilla@glandium.org> |
2 From: Mike Hommey <mh@glandium.org> |
3 Date: Thu, 26 Feb 2015 14:14:02 +0900 |
3 Date: Mon, 9 Mar 2015 08:42:19 +0900 |
4 Subject: [PATCH 1/2] Bug 1136958 - Remove duplicate |
4 Subject: [PATCH] Bug 1136958 - Reintroduce pixman code path removed in bug |
5 SkDiscardableMemory_none.cpp from gfx/skia/moz.build |
5 1097776 for --disable-skia builds |
6 |
6 |
7 And to do so, cleanup gfx/skia/generate_mozbuild.py a little. |
|
8 --- |
7 --- |
9 gfx/skia/generate_mozbuild.py | 53 ++++++++++++++++--------------------------- |
8 gfx/layers/basic/BasicCompositor.cpp | 94 +++++++++++++++++++++++++++++++--- |
10 gfx/skia/moz.build | 1 - |
9 gfx/layers/basic/BasicLayerManager.cpp | 88 +++++++++++++++++++++++++++++-- |
11 2 files changed, 20 insertions(+), 34 deletions(-) |
10 2 files changed, 171 insertions(+), 11 deletions(-) |
12 |
11 |
13 diff --git a/configure.in b/configure.in |
12 diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp |
14 --- a/configure.in |
13 index 0bef076..000b591 100644 |
15 +++ b/configure.in |
14 --- a/gfx/layers/basic/BasicCompositor.cpp |
16 @@ -7941,39 +7941,16 @@ if test -z "${GLIB_GMODULE_LIBS}" \ |
15 +++ b/gfx/layers/basic/BasicCompositor.cpp |
17 fi |
16 @@ -17,8 +17,13 @@ |
18 |
17 #include <algorithm> |
19 AC_SUBST_LIST(GLIB_GMODULE_LIBS) |
18 #include "ImageContainer.h" |
20 |
19 #include "gfxPrefs.h" |
21 dnl ======================================================== |
20 +#ifdef MOZ_ENABLE_SKIA |
22 dnl Graphics checks. |
21 #include "skia/SkCanvas.h" // for SkCanvas |
23 dnl ======================================================== |
22 #include "skia/SkBitmapDevice.h" // for SkBitmapDevice |
24 |
23 +#else |
25 -if test "${OS_TARGET}" = "WINNT" -o \ |
24 +#define PIXMAN_DONT_DEFINE_STDINT |
26 - "${OS_ARCH}" = "Darwin" -o \ |
25 +#include "pixman.h" // for pixman_f_transform, etc |
27 - "${MOZ_WIDGET_TOOLKIT}" = "android" -o \ |
26 +#endif |
28 - "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \ |
27 |
29 - "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \ |
28 namespace mozilla { |
30 - "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then |
29 using namespace mozilla::gfx; |
31 - case "${target_cpu}" in |
30 @@ -168,6 +173,7 @@ DrawSurfaceWithTextureCoords(DrawTarget *aDest, |
32 - i*86*|x86_64|arm) |
31 mode, aMask, aMaskTransform, &matrix); |
33 - MOZ_ENABLE_SKIA=1 |
32 } |
34 - ;; |
33 |
35 - *) |
34 +#ifdef MOZ_ENABLE_SKIA |
36 - MOZ_ENABLE_SKIA= |
35 static SkMatrix |
37 - ;; |
36 Matrix3DToSkia(const gfx3DMatrix& aMatrix) |
38 - esac |
37 { |
39 -else |
38 @@ -186,10 +192,10 @@ Matrix3DToSkia(const gfx3DMatrix& aMatrix) |
40 -MOZ_ENABLE_SKIA= |
39 } |
41 -fi |
40 |
42 - |
41 static void |
43 -MOZ_ARG_ENABLE_BOOL(skia, |
42 -SkiaTransform(DataSourceSurface* aDest, |
44 -[ --enable-skia Enable use of Skia], |
43 - DataSourceSurface* aSource, |
45 -MOZ_ENABLE_SKIA=1, |
44 - const gfx3DMatrix& aTransform, |
46 -MOZ_ENABLE_SKIA=) |
45 - const Point& aDestOffset) |
47 - |
46 +Transform(DataSourceSurface* aDest, |
48 MOZ_ARG_DISABLE_BOOL(skia-gpu, |
47 + DataSourceSurface* aSource, |
49 [ --disable-skia-gpu Disable use of Skia-GPU], |
48 + const gfx3DMatrix& aTransform, |
50 MOZ_DISABLE_SKIA_GPU=1, |
49 + const Point& aDestOffset) |
51 MOZ_DISABLE_SKIA_GPU=) |
50 { |
52 |
51 if (aTransform.IsSingular()) { |
53 if test "$USE_FC_FREETYPE"; then |
52 return; |
54 if test "$COMPILE_ENVIRONMENT"; then |
53 @@ -225,6 +231,78 @@ SkiaTransform(DataSourceSurface* aDest, |
55 dnl ======================================================== |
54 SkRect destRect = SkRect::MakeXYWH(0, 0, srcSize.width, srcSize.height); |
56 @@ -8191,30 +8168,26 @@ AC_SUBST(MOZ_TREE_CAIRO) |
55 destCanvas.drawBitmapRectToRect(src, nullptr, destRect, &paint); |
57 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS) |
56 } |
58 AC_SUBST_LIST(MOZ_CAIRO_LIBS) |
57 +#else |
59 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS) |
58 +static pixman_transform |
60 AC_SUBST(MOZ_TREE_PIXMAN) |
59 +Matrix3DToPixman(const gfx3DMatrix& aMatrix) |
61 |
60 +{ |
62 dnl ======================================================== |
61 + pixman_f_transform transform; |
63 dnl Skia |
62 + |
64 dnl ======================================================== |
63 + transform.m[0][0] = aMatrix._11; |
65 -if test "$MOZ_ENABLE_SKIA"; then |
64 + transform.m[0][1] = aMatrix._21; |
66 - AC_DEFINE(MOZ_ENABLE_SKIA) |
65 + transform.m[0][2] = aMatrix._41; |
67 - AC_DEFINE(USE_SKIA) |
66 + transform.m[1][0] = aMatrix._12; |
68 - if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then |
67 + transform.m[1][1] = aMatrix._22; |
69 - AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK) |
68 + transform.m[1][2] = aMatrix._42; |
70 - fi |
69 + transform.m[2][0] = aMatrix._14; |
71 - |
70 + transform.m[2][1] = aMatrix._24; |
72 - if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then |
71 + transform.m[2][2] = aMatrix._44; |
73 - MOZ_ENABLE_SKIA_GPU=1 |
72 + |
74 - AC_DEFINE(USE_SKIA_GPU) |
73 + pixman_transform result; |
75 - AC_SUBST(MOZ_ENABLE_SKIA_GPU) |
74 + pixman_transform_from_pixman_f_transform(&result, &transform); |
76 - fi |
75 + |
77 -fi |
76 + return result; |
78 -AC_SUBST(MOZ_ENABLE_SKIA) |
77 +} |
79 +AC_DEFINE(USE_SKIA) |
78 + |
80 +if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then |
79 +static void |
81 + AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK) |
80 +Transform(DataSourceSurface* aDest, |
82 +fi |
81 + DataSourceSurface* aSource, |
83 + |
82 + const gfx3DMatrix& aTransform, |
84 +if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then |
83 + const Point& aDestOffset) |
85 + MOZ_ENABLE_SKIA_GPU=1 |
84 +{ |
86 + AC_DEFINE(USE_SKIA_GPU) |
85 + IntSize destSize = aDest->GetSize(); |
87 + AC_SUBST(MOZ_ENABLE_SKIA_GPU) |
86 + pixman_image_t* dest = pixman_image_create_bits(PIXMAN_a8r8g8b8, |
88 +fi |
87 + destSize.width, |
89 |
88 + destSize.height, |
90 dnl ======================================================== |
89 + (uint32_t*)aDest->GetData(), |
91 dnl Check for nss-shared-helper |
90 + aDest->Stride()); |
92 dnl ======================================================== |
91 + |
93 |
92 + IntSize srcSize = aSource->GetSize(); |
94 PKG_CHECK_MODULES(NSSHELPER, nss-shared-helper, |
93 + pixman_image_t* src = pixman_image_create_bits(PIXMAN_a8r8g8b8, |
95 [MOZ_ENABLE_NSSHELPER=1], |
94 + srcSize.width, |
96 [MOZ_ENABLE_NSSHELPER=]) |
95 + srcSize.height, |
97 diff --git a/gfx/2d/moz.build b/gfx/2d/moz.build |
96 + (uint32_t*)aSource->GetData(), |
98 --- a/gfx/2d/moz.build |
97 + aSource->Stride()); |
99 +++ b/gfx/2d/moz.build |
98 + |
100 @@ -59,49 +59,44 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wi |
99 + NS_ABORT_IF_FALSE(src && dest, "Failed to create pixman images?"); |
101 'ScaledFontDWrite.cpp', |
100 + |
102 'ScaledFontWin.cpp', |
101 + pixman_transform pixTransform = Matrix3DToPixman(aTransform); |
103 'SourceSurfaceD2D.cpp', |
102 + pixman_transform pixTransformInverted; |
104 'SourceSurfaceD2D1.cpp', |
103 + |
105 'SourceSurfaceD2DTarget.cpp', |
104 + // If the transform is singular then nothing would be drawn anyway, return here |
106 ] |
105 + if (!pixman_transform_invert(&pixTransformInverted, &pixTransform)) { |
107 DEFINES['WIN32'] = True |
106 + pixman_image_unref(dest); |
108 |
107 + pixman_image_unref(src); |
109 -if CONFIG['MOZ_ENABLE_SKIA']: |
108 + return; |
110 - UNIFIED_SOURCES += [ |
109 + } |
111 - 'convolver.cpp', |
110 + pixman_image_set_transform(src, &pixTransformInverted); |
112 - 'DrawTargetSkia.cpp', |
111 + |
113 - 'PathSkia.cpp', |
112 + pixman_image_composite32(PIXMAN_OP_SRC, |
114 - 'SourceSurfaceSkia.cpp', |
113 + src, |
115 - ] |
114 + nullptr, |
116 - SOURCES += [ |
115 + dest, |
117 - 'image_operations.cpp', # Uses _USE_MATH_DEFINES |
116 + aDestOffset.x, |
118 - ] |
117 + aDestOffset.y, |
119 - EXPORTS.mozilla.gfx += [ |
118 + 0, |
120 - 'HelpersSkia.h', |
119 + 0, |
121 - ] |
120 + 0, |
122 +UNIFIED_SOURCES += [ |
121 + 0, |
123 + 'convolver.cpp', |
122 + destSize.width, |
124 + 'DrawTargetSkia.cpp', |
123 + destSize.height); |
125 + 'PathSkia.cpp', |
124 + |
126 + 'SourceSurfaceSkia.cpp', |
125 + pixman_image_unref(dest); |
127 +] |
126 + pixman_image_unref(src); |
128 +SOURCES += [ |
127 +} |
129 + 'image_operations.cpp', # Uses _USE_MATH_DEFINES |
128 +#endif |
130 +] |
129 |
131 +EXPORTS.mozilla.gfx += [ |
130 static inline IntRect |
132 + 'HelpersSkia.h', |
131 RoundOut(Rect r) |
133 +] |
132 @@ -364,12 +442,16 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, |
134 |
133 RefPtr<SourceSurface> snapshot = dest->Snapshot(); |
135 # Are we targeting x86 or x64? If so, build SSE2 files. |
134 RefPtr<DataSourceSurface> source = snapshot->GetDataSurface(); |
136 if CONFIG['INTEL_ARCHITECTURE']: |
135 RefPtr<DataSourceSurface> temp = |
137 SOURCES += [ |
136 - Factory::CreateDataSourceSurface(RoundOut(transformBounds).Size(), SurfaceFormat::B8G8R8A8, true); |
138 'BlurSSE2.cpp', |
137 + Factory::CreateDataSourceSurface(RoundOut(transformBounds).Size(), SurfaceFormat::B8G8R8A8 |
139 + 'convolverSSE2.cpp', |
138 +#ifdef MOZ_ENABLE_SKIA |
140 'FilterProcessingSSE2.cpp', |
139 + , true |
141 'ImageScalingSSE2.cpp', |
140 +#endif |
142 ] |
141 + ); |
143 - if CONFIG['MOZ_ENABLE_SKIA']: |
142 if (NS_WARN_IF(!temp)) { |
144 - SOURCES += [ |
143 return; |
145 - 'convolverSSE2.cpp', |
|
146 - ] |
|
147 DEFINES['USE_SSE2'] = True |
|
148 # The file uses SSE2 intrinsics, so it needs special compile flags on some |
|
149 # compilers. |
|
150 SOURCES['BlurSSE2.cpp'].flags += CONFIG['SSE2_FLAGS'] |
|
151 SOURCES['FilterProcessingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS'] |
|
152 SOURCES['ImageScalingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS'] |
|
153 - if CONFIG['MOZ_ENABLE_SKIA']: |
|
154 - SOURCES['convolverSSE2.cpp'].flags += CONFIG['SSE2_FLAGS'] |
|
155 + SOURCES['convolverSSE2.cpp'].flags += CONFIG['SSE2_FLAGS'] |
|
156 |
|
157 UNIFIED_SOURCES += [ |
|
158 'Blur.cpp', |
|
159 'DataSourceSurface.cpp', |
|
160 'DataSurfaceHelpers.cpp', |
|
161 'DrawEventRecorder.cpp', |
|
162 'DrawTarget.cpp', |
|
163 'DrawTargetCairo.cpp', |
|
164 diff --git a/gfx/moz.build b/gfx/moz.build |
|
165 --- a/gfx/moz.build |
|
166 +++ b/gfx/moz.build |
|
167 @@ -17,16 +17,15 @@ DIRS += [ |
|
168 'layers', |
|
169 'graphite2/src', |
|
170 'harfbuzz/src', |
|
171 'ots/src', |
|
172 'thebes', |
|
173 'ipc', |
|
174 ] |
|
175 |
|
176 -if CONFIG['MOZ_ENABLE_SKIA']: |
|
177 - DIRS += ['skia'] |
|
178 +DIRS += ['skia'] |
|
179 |
|
180 if CONFIG['ENABLE_TESTS']: |
|
181 DIRS += ['tests/gtest'] |
|
182 |
|
183 TEST_DIRS += ['tests'] |
|
184 |
|
185 diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py |
|
186 --- a/gfx/skia/generate_mozbuild.py |
|
187 +++ b/gfx/skia/generate_mozbuild.py |
|
188 @@ -1,13 +1,14 @@ |
|
189 #!/usr/bin/env python |
|
190 |
|
191 import os |
|
192 |
|
193 import locale |
|
194 +from collections import defaultdict |
|
195 locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') |
|
196 |
|
197 header = """ |
|
198 # |
|
199 # ##### ####### # # # # # # |
|
200 # ## # # # # # # # # # # # # |
|
201 # ## # # # # # # # # # # # |
|
202 # ## #### # # # # # # # # # # |
|
203 @@ -187,17 +188,17 @@ def generate_platform_sources(): |
|
204 |
|
205 for plat in platforms: |
|
206 if os.system("cd trunk && GYP_GENERATORS=dump_mozbuild ./gyp_skia -D OS=%s gyp/skia_lib.gyp" % plat) != 0: |
|
207 print 'Failed to generate sources for ' + plat |
|
208 continue |
|
209 |
|
210 |
|
211 f = open('trunk/sources.json'); |
|
212 - sources[plat] = set(json.load(f)); |
|
213 + sources[plat] = set(v.replace('../', 'trunk/') for v in json.load(f)); |
|
214 f.close() |
|
215 |
|
216 return dict(sources.items() + generate_opt_sources().items()) |
|
217 |
|
218 |
|
219 def generate_separated_sources(platform_sources): |
|
220 blacklist = [ |
|
221 'ChromeUtils', |
|
222 @@ -232,17 +233,17 @@ def generate_separated_sources(platform_ |
|
223 |
|
224 def isblacklisted(value): |
|
225 for item in blacklist: |
|
226 if value.find(item) >= 0: |
|
227 return True |
|
228 |
|
229 return False |
|
230 |
|
231 - separated = { |
|
232 + separated = defaultdict(set, { |
|
233 'common': { |
|
234 #'trunk/src/effects/gradients/SkGradientTileProc.cpp', |
|
235 'trunk/src/gpu/gl/GrGLCreateNativeInterface_none.cpp', |
|
236 'trunk/src/ports/SkDiscardableMemory_none.cpp', |
|
237 'trunk/src/ports/SkImageDecoder_empty.cpp', |
|
238 'trunk/src/ports/SkMemory_mozalloc.cpp', |
|
239 # 'trunk/src/images/SkImages.cpp', |
|
240 # 'trunk/src/images/SkImageRef.cpp', |
|
241 @@ -277,69 +278,55 @@ def generate_separated_sources(platform_ |
|
242 'trunk/src/core/SkUtilsArm.cpp', |
|
243 }, |
|
244 'neon': { |
|
245 'trunk/src/opts/SkBitmapProcState_arm_neon.cpp', |
|
246 }, |
|
247 'none': { |
|
248 'trunk/src/opts/SkUtils_opts_none.cpp', |
|
249 } |
144 } |
250 - } |
145 |
251 + }) |
146 - SkiaTransform(temp, source, new3DTransform, transformBounds.TopLeft()); |
252 |
147 + Transform(temp, source, new3DTransform, transformBounds.TopLeft()); |
253 for plat in platform_sources.keys(): |
148 |
254 - if not separated.has_key(plat): |
149 transformBounds.MoveTo(0, 0); |
255 - separated[plat] = set() |
150 buffer->DrawSurface(temp, transformBounds, transformBounds); |
256 - |
151 diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp |
257 for value in platform_sources[plat]: |
152 index f4ec9e4..c849c27 100644 |
258 if isblacklisted(value): |
153 --- a/gfx/layers/basic/BasicLayerManager.cpp |
259 continue |
154 +++ b/gfx/layers/basic/BasicLayerManager.cpp |
260 |
155 @@ -46,8 +46,13 @@ |
261 - if value.find('_SSE') > 0 or value.find('_SSSE') > 0 or value.find('_SSE4') > 0 : #lol |
156 #include "nsRect.h" // for nsIntRect |
262 - separated['intel'].add(value) |
157 #include "nsRegion.h" // for nsIntRegion, etc |
263 + if value in separated['common']: |
158 #include "nsTArray.h" // for nsAutoTArray |
264 continue |
159 +#ifdef MOZ_ENABLE_SKIA |
265 |
160 #include "skia/SkCanvas.h" // for SkCanvas |
266 - if value.find('_neon') > 0: |
161 #include "skia/SkBitmapDevice.h" // for SkBitmapDevice |
267 - separated['neon'].add(value) |
162 +#else |
268 - continue |
163 +#define PIXMAN_DONT_DEFINE_STDINT |
269 + key = plat |
164 +#include "pixman.h" // for pixman_f_transform, etc |
270 |
165 +#endif |
271 - if value.find('_arm') > 0: |
166 class nsIWidget; |
272 - separated['arm'].add(value) |
167 |
273 - continue |
168 namespace mozilla { |
274 + if '_SSE' in value or '_SSSE' in value: |
169 @@ -601,6 +606,7 @@ BasicLayerManager::SetRoot(Layer* aLayer) |
275 + key = 'intel' |
170 mRoot = aLayer; |
276 + elif '_neon' in value: |
171 } |
277 + key = 'neon' |
172 |
278 + elif '_arm' in value: |
173 +#ifdef MOZ_ENABLE_SKIA |
279 + key = 'arm' |
174 static SkMatrix |
280 + elif '_none' in value: |
175 BasicLayerManager_Matrix3DToSkia(const gfx3DMatrix& aMatrix) |
281 + key = 'none' |
176 { |
282 + elif all(value in platform_sources.get(p, {}) |
177 @@ -619,10 +625,10 @@ BasicLayerManager_Matrix3DToSkia(const gfx3DMatrix& aMatrix) |
283 + for p in platforms if p != plat): |
178 } |
284 + key = 'common' |
179 |
285 |
180 static void |
286 - if value.find('_none') > 0: |
181 -SkiaTransform(const gfxImageSurface* aDest, |
287 - separated['none'].add(value) |
182 - RefPtr<DataSourceSurface> aSrc, |
288 - continue |
183 - const gfx3DMatrix& aTransform, |
289 - |
184 - gfxPoint aDestOffset) |
290 - found = True |
185 +Transform(const gfxImageSurface* aDest, |
291 - for other in platforms: |
186 + RefPtr<DataSourceSurface> aSrc, |
292 - if other == plat or not platform_sources.has_key(other): |
187 + const gfx3DMatrix& aTransform, |
293 - continue |
188 + gfxPoint aDestOffset) |
294 - |
189 { |
295 - if not value in platform_sources[other]: |
190 if (aTransform.IsSingular()) { |
296 - found = False |
191 return; |
297 - break; |
192 @@ -658,6 +664,78 @@ SkiaTransform(const gfxImageSurface* aDest, |
298 - |
193 SkRect destRect = SkRect::MakeXYWH(0, 0, srcSize.width, srcSize.height); |
299 - if found: |
194 destCanvas.drawBitmapRectToRect(src, nullptr, destRect, &paint); |
300 - separated['common'].add(value) |
195 } |
301 - else: |
196 +#else |
302 - separated[plat].add(value) |
197 +static pixman_transform |
303 + separated[key].add(value) |
198 +BasicLayerManager_Matrix3DToPixman(const gfx3DMatrix& aMatrix) |
304 |
199 +{ |
305 return separated |
200 + pixman_f_transform transform; |
306 |
201 + |
307 def uniq(seq): |
202 + transform.m[0][0] = aMatrix._11; |
308 seen = set() |
203 + transform.m[0][1] = aMatrix._21; |
309 seen_add = seen.add |
204 + transform.m[0][2] = aMatrix._41; |
310 return [ x for x in seq if x not in seen and not seen_add(x)] |
205 + transform.m[1][0] = aMatrix._12; |
311 |
206 + transform.m[1][1] = aMatrix._22; |
312 def write_cflags(f, values, subsearch, cflag, indent): |
207 + transform.m[1][2] = aMatrix._42; |
313 def write_indent(indent): |
208 + transform.m[2][0] = aMatrix._14; |
314 for _ in range(indent): |
209 + transform.m[2][1] = aMatrix._24; |
315 f.write(' ') |
210 + transform.m[2][2] = aMatrix._44; |
316 |
211 + |
317 - val_list = uniq(sorted(map(lambda val: val.replace('../', 'trunk/'), values), key=lambda x: x.lower())) |
212 + pixman_transform result; |
318 + val_list = uniq(sorted(values, key=lambda x: x.lower())) |
213 + pixman_transform_from_pixman_f_transform(&result, &transform); |
319 |
214 + |
320 if len(val_list) == 0: |
215 + return result; |
321 return |
216 +} |
322 |
217 + |
323 for val in val_list: |
218 +static void |
324 if val.find(subsearch) > 0: |
219 +Transform(const gfxImageSurface* aDest, |
325 write_indent(indent) |
220 + RefPtr<DataSourceSurface> aSrc, |
326 f.write("SOURCES[\'" + val + "\'].flags += [\'" + cflag + "\']\n") |
221 + const gfx3DMatrix& aTransform, |
327 @@ -391,17 +378,17 @@ def write_sources(f, values, indent): |
222 + gfxPoint aDestOffset) |
328 write_list(f, "UNIFIED_SOURCES", sources['unified'], indent) |
223 +{ |
329 write_list(f, "SOURCES", sources['nonunified'], indent) |
224 + IntSize destSize = ToIntSize(aDest->GetSize()); |
330 |
225 + pixman_image_t* dest = pixman_image_create_bits(aDest->Format() == gfxImageFormat::ARGB32 ? PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8, |
331 def write_list(f, name, values, indent): |
226 + destSize.width, |
332 def write_indent(indent): |
227 + destSize.height, |
333 for _ in range(indent): |
228 + (uint32_t*)aDest->Data(), |
334 f.write(' ') |
229 + aDest->Stride()); |
335 |
230 + |
336 - val_list = uniq(sorted(map(lambda val: val.replace('../', 'trunk/'), values), key=lambda x: x.lower())) |
231 + IntSize srcSize = aSrc->GetSize(); |
337 + val_list = uniq(sorted(values, key=lambda x: x.lower())) |
232 + pixman_image_t* src = pixman_image_create_bits(aSrc->GetFormat() == SurfaceFormat::B8G8R8A8 ? PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8, |
338 |
233 + srcSize.width, |
339 if len(val_list) == 0: |
234 + srcSize.height, |
340 return |
235 + (uint32_t*)aSrc->GetData(), |
341 |
236 + aSrc->Stride()); |
342 write_indent(indent) |
237 + |
343 f.write(name + ' += [\n') |
238 + NS_ABORT_IF_FALSE(src && dest, "Failed to create pixman images?"); |
344 for val in val_list: |
239 + |
345 write_indent(indent + 4) |
240 + pixman_transform pixTransform = BasicLayerManager_Matrix3DToPixman(aTransform); |
346 diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build |
241 + pixman_transform pixTransformInverted; |
347 --- a/gfx/skia/moz.build |
242 + |
348 +++ b/gfx/skia/moz.build |
243 + // If the transform is singular then nothing would be drawn anyway, return here |
349 @@ -847,17 +847,16 @@ else: |
244 + if (!pixman_transform_invert(&pixTransformInverted, &pixTransform)) { |
350 'trunk/src/opts/SkBitmapProcState_opts_none.cpp', |
245 + pixman_image_unref(dest); |
351 'trunk/src/opts/SkBlitMask_opts_none.cpp', |
246 + pixman_image_unref(src); |
352 'trunk/src/opts/SkBlitRow_opts_none.cpp', |
247 + return; |
353 'trunk/src/opts/SkBlurImage_opts_none.cpp', |
248 + } |
354 'trunk/src/opts/SkMorphology_opts_none.cpp', |
249 + pixman_image_set_transform(src, &pixTransformInverted); |
355 'trunk/src/opts/SkTextureCompression_opts_none.cpp', |
250 + |
356 'trunk/src/opts/SkUtils_opts_none.cpp', |
251 + pixman_image_composite32(PIXMAN_OP_SRC, |
357 'trunk/src/opts/SkXfermode_opts_none.cpp', |
252 + src, |
358 - 'trunk/src/ports/SkDiscardableMemory_none.cpp', |
253 + nullptr, |
359 ] |
254 + dest, |
360 |
255 + aDestOffset.x, |
361 |
256 + aDestOffset.y, |
362 # can we find a better way of dealing with asm sources? |
257 + 0, |
363 |
258 + 0, |
364 # left out of UNIFIED_SOURCES for now; that's not C++ anyway, nothing else to unify it with |
259 + 0, |
365 if not CONFIG['INTEL_ARCHITECTURE'] and CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']: |
260 + 0, |
366 SOURCES += [ |
261 + destSize.width, |
367 diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp |
262 + destSize.height); |
368 --- a/image/src/RasterImage.cpp |
263 + |
369 +++ b/image/src/RasterImage.cpp |
264 + pixman_image_unref(dest); |
370 @@ -313,21 +313,16 @@ RasterImage::Init(const char* aMimeType, |
265 + pixman_image_unref(src); |
371 |
266 +} |
372 // Store initialization data |
267 +#endif |
373 mSourceDataMimeType.Assign(aMimeType); |
268 |
374 mDiscardable = !!(aFlags & INIT_FLAG_DISCARDABLE); |
269 /** |
375 mDecodeOnDraw = !!(aFlags & INIT_FLAG_DECODE_ON_DRAW); |
270 * Transform a surface using a gfx3DMatrix and blit to the destination if |
376 mTransient = !!(aFlags & INIT_FLAG_TRANSIENT); |
271 @@ -699,7 +777,7 @@ Transform3D(RefPtr<SourceSurface> aSource, |
377 mDownscaleDuringDecode = !!(aFlags & INIT_FLAG_DOWNSCALE_DURING_DECODE); |
272 gfx3DMatrix translation = gfx3DMatrix::Translation(aBounds.x, aBounds.y, 0); |
378 |
273 |
379 -#ifndef MOZ_ENABLE_SKIA |
274 // Transform the content and offset it such that the content begins at the origin. |
380 - // Downscale-during-decode requires Skia. |
275 - SkiaTransform(destImage, aSource->GetDataSurface(), translation * aTransform, offset); |
381 - mDownscaleDuringDecode = false; |
276 + Transform(destImage, aSource->GetDataSurface(), translation * aTransform, offset); |
382 -#endif |
277 |
383 - |
278 // If we haven't actually drawn to aDest then return our temporary image so |
384 // Lock this image's surfaces in the SurfaceCache if we're not discardable. |
279 // that the caller can do this. |
385 if (!mDiscardable) { |
280 -- |
386 SurfaceCache::LockImage(ImageKey(this)); |
281 2.3.0.4.g34b1174 |
387 } |
282 |
388 |
|
389 // Create the initial size decoder. |
|
390 nsresult rv = Decode(Nothing(), DECODE_FLAGS_DEFAULT); |
|
391 if (NS_FAILED(rv)) { |
|
392 @@ -1556,20 +1551,16 @@ RasterImage::RecoverFromLossOfFrames(con |
|
393 Decode(Some(aSize), aFlags); |
|
394 } |
|
395 |
|
396 bool |
|
397 RasterImage::CanScale(GraphicsFilter aFilter, |
|
398 const nsIntSize& aSize, |
|
399 uint32_t aFlags) |
|
400 { |
|
401 -#ifndef MOZ_ENABLE_SKIA |
|
402 - // The high-quality scaler requires Skia. |
|
403 - return false; |
|
404 -#else |
|
405 // Check basic requirements: HQ downscaling is enabled, we have all the source |
|
406 // data and know our size, the flags allow us to do it, and a 'good' filter is |
|
407 // being used. The flags may ask us not to scale because the caller isn't |
|
408 // drawing to the window. If we're drawing to something else (e.g. a canvas) |
|
409 // we usually have no way of updating what we've drawn, so HQ scaling is |
|
410 // useless. |
|
411 if (!gfxPrefs::ImageHQDownscalingEnabled() || !mHasSize || !mHasSourceData || |
|
412 !(aFlags & imgIContainer::FLAG_HIGH_QUALITY_SCALING) || |
|
413 @@ -1609,17 +1600,16 @@ RasterImage::CanScale(GraphicsFilter aFi |
|
414 // XXX(seth): It's not clear what this check buys us over |
|
415 // gfxPrefs::ImageHQUpscalingMaxSize(). |
|
416 // The default value of this pref is 1000, which means that we never upscale. |
|
417 // If that's all it's getting us, I'd rather we just forbid that explicitly. |
|
418 gfx::Size scale(double(aSize.width) / mSize.width, |
|
419 double(aSize.height) / mSize.height); |
|
420 gfxFloat minFactor = gfxPrefs::ImageHQDownscalingMinFactor() / 1000.0; |
|
421 return (scale.width < minFactor || scale.height < minFactor); |
|
422 -#endif |
|
423 } |
|
424 |
|
425 bool |
|
426 RasterImage::CanDownscaleDuringDecode(const nsIntSize& aSize, uint32_t aFlags) |
|
427 { |
|
428 // Check basic requirements: downscale-during-decode is enabled for this |
|
429 // image, we have all the source data and know our size, the flags allow us to |
|
430 // do it, and a 'good' filter is being used. |
|