Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: skia/ext/skia_utils_mac.mm

Issue 141037: Get our color channels straight. The reason why the color swap was required... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: ... Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/skia_utils_mac.mm
===================================================================
--- skia/ext/skia_utils_mac.mm (revision 18890)
+++ skia/ext/skia_utils_mac.mm (working copy)
@@ -127,11 +127,20 @@
// 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);
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698