rev. 637 changed the settings for premultiplied on the info parameter. This
change incorrectly assumed that all cases wanted premultipled-last, which was
incorrect.
Reverting to the previous values.
git-svn-id: http://skia.googlecode.com/svn/trunk@673 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp
index dea443c..a1d7cc4 100644
--- a/src/utils/mac/SkCreateCGImageRef.cpp
+++ b/src/utils/mac/SkCreateCGImageRef.cpp
@@ -24,19 +24,19 @@
*bitsPerComponent = 8;
#if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 0, 8, 16) \
|| defined(SK_CPU_BENDIAN) && HAS_ARGB_SHIFTS(0, 24, 16, 8)
- *info = kCGBitmapByteOrder32Big;
+ *info = kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast;
#elif defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0) \
|| defined(SK_CPU_BENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0)
// Matches the CGBitmapInfo that Apple recommends for best
// performance, used by google chrome.
- *info = kCGBitmapByteOrder32Little;
+ *info = kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst;
#else
// ...add more formats as required...
#warning Cannot convert SkBitmap to CGImageRef with these shiftmasks. \
This will probably not work.
// Legacy behavior. Perhaps turn this into an error at some
// point.
- *info = kCGBitmapByteOrder32Big;
+ *info = kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast;
#endif
break;
#if 0
@@ -54,10 +54,6 @@
return NULL;
}
- if (!bm.isOpaque()) {
- *info |= kCGImageAlphaPremultipliedLast;
- }
-
SkBitmap* copy;
if (upscaleTo32) {
copy = new SkBitmap;
@@ -116,15 +112,15 @@
if (img) {
CGRect r = CGRectMake(0, 0, bm.width(), bm.height());
-
+
CGContextSaveGState(cg);
CGContextTranslateCTM(cg, x, r.size.height + y);
CGContextScaleCTM(cg, 1, -1);
-
+
CGContextDrawImage(cg, r, img);
-
+
CGContextRestoreGState(cg);
-
+
CGImageRelease(img);
}
}