summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authoramanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 01:01:52 +0000
committeramanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 01:01:52 +0000
commit8860e4f513e757810afecfb62a2bd282cd731ed9 (patch)
treea1905994c55ee794c1e4d3e450ba009f8d5f65f1 /skia
parent2d896aedfc2630ee7a7c973e84d69f5099104767 (diff)
downloadchromium_src-8860e4f513e757810afecfb62a2bd282cd731ed9.zip
chromium_src-8860e4f513e757810afecfb62a2bd282cd731ed9.tar.gz
chromium_src-8860e4f513e757810afecfb62a2bd282cd731ed9.tar.bz2
Update WebKit to 45111 and Skia to 239
Review URL: http://codereview.chromium.org/147121 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/config/SkUserConfig.h10
-rw-r--r--skia/ext/bitmap_platform_device_mac.cc9
-rw-r--r--skia/ext/skia_utils_mac.mm9
-rwxr-xr-xskia/skia.gyp1
4 files changed, 26 insertions, 3 deletions
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h
index f9ba042..09c99f0 100644
--- a/skia/config/SkUserConfig.h
+++ b/skia/config/SkUserConfig.h
@@ -166,11 +166,15 @@ typedef unsigned uint32_t;
#define SK_CPU_LENDIAN
#undef SK_CPU_BENDIAN
-// we want (memory order) RGBA
+// we want (memory order) BGRA, because that's what core image uses with
+// kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, which is what
+// Apple recommends for best performance (ARGB becomes BGRA in memory on
+// little-endian) -- and we want skia and coregraphic to have matching memory
+// layouts, so that we don't have to spend time converting between them.
#define SK_A32_SHIFT 24
-#define SK_R32_SHIFT 0
+#define SK_R32_SHIFT 16
#define SK_G32_SHIFT 8
-#define SK_B32_SHIFT 16
+#define SK_B32_SHIFT 0
#elif defined(SK_BUILD_FOR_UNIX)
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index fd8a3a8..60293d8 100644
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -47,6 +47,10 @@ bool Constrain(int available_size, int* position, int *size) {
static CGContextRef CGContextForData(void* data, int width, int height) {
CGColorSpaceRef color_space =
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+#define HAS_ARGB_SHIFTS(a, r, g, b) \
+ (SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \
+ && SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b))
+#if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0)
// Allocate a bitmap context with 4 components per pixel (BGRA). Apple
// recommends these flags for improved CG performance.
CGContextRef context =
@@ -54,6 +58,11 @@ static CGContextRef CGContextForData(void* data, int width, int height) {
color_space,
kCGImageAlphaPremultipliedFirst |
kCGBitmapByteOrder32Host);
+#else
+#error We require that Skia's and CoreGraphics's recommended \
+ image memory layout match.
+#endif
+#undef HAS_ARGB_SHIFTS
CGColorSpaceRelease(color_space);
if (!context)
diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm
index 6880ea8..463fd52 100644
--- a/skia/ext/skia_utils_mac.mm
+++ b/skia/ext/skia_utils_mac.mm
@@ -127,11 +127,20 @@ SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque) {
// Allocate a bitmap context with 4 components per pixel (BGRA). Apple
// recommends these flags for improved CG performance.
+#define HAS_ARGB_SHIFTS(a, r, g, b) \
+ (SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \
+ && SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b))
+#if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0)
scoped_cftyperef<CGContextRef> context(
CGBitmapContextCreate(data, size.width, size.height, 8, size.width*4,
color_space,
kCGImageAlphaPremultipliedFirst |
kCGBitmapByteOrder32Host));
+#else
+#error We require that Skia's and CoreGraphics's recommended \
+ image memory layout match.
+#endif
+#undef HAS_ARGB_SHIFTS
// Something went really wrong. Best guess is that the bitmap data is invalid.
DCHECK(context != NULL);
diff --git a/skia/skia.gyp b/skia/skia.gyp
index 0d911eb..6402147 100755
--- a/skia/skia.gyp
+++ b/skia/skia.gyp
@@ -321,6 +321,7 @@
'../third_party/skia/src/effects/SkLayerRasterizer.cpp',
'../third_party/skia/src/effects/SkNWayCanvas.cpp',
'../third_party/skia/src/effects/SkPaintFlagsDrawFilter.cpp',
+ '../third_party/skia/src/effects/SkPorterDuff.cpp',
'../third_party/skia/src/effects/SkPixelXorXfermode.cpp',
'../third_party/skia/src/effects/SkRadialGradient_Table.h',
'../third_party/skia/src/effects/SkTransparentShader.cpp',