summaryrefslogtreecommitdiffstats
path: root/skia/ext/skia_utils_mac.mm
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/ext/skia_utils_mac.mm
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/ext/skia_utils_mac.mm')
-rw-r--r--skia/ext/skia_utils_mac.mm9
1 files changed, 9 insertions, 0 deletions
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);