Chromium Code Reviews
DescriptionGet our color channels straight. The reason why the weird color swap in
cocoa_utils_unittest.mm was required was that the SkBitmap that
SkBitmapToNSImage() in cocoa_utils received already had messed-up channels when
it was passed in from Chromium but not when it was passed in from the test. The
reason for it being corrupt when being passed in from Chromium was that
CGImageToSkBitmap(), which sends it from the renderer to the browser, assumes
that Skia's and CoreGraphic's image memory layout match.
This is a reasonable assumption to make (we don't want to swizzle bytes around
all the time when converting between the two image types), but it is wrong at
the moment. CoreGraphics uses BGRA in memory on little-endian machines with
Apple's recommended kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst
configuration. Skia is currently configured to use RGBA for some reason -- so
the red and blue channels are swapped.
Since we can't change CoreGraphics, I changed Skia, and things still seem to
work (a small fix to Skia's SkCreateCGImageRef() is required, because this
function assumes that Skia's default argb layout is used). I do realize that
this is a larger change, so please review carefully. But it _is_ the right
thing to do in my eyes.
I also added a few preprocessor checks to the places where we make assumptions
about Skia's image memory layout.
This requires a patch to Skia, too: http://codereview.appspot.com/84041
BUG=http://crbug.com/14020
TEST=Check that favicons in the bookmark bar still look correct and that
cocoa_utils_unittest now passes without that weird "swap" flag.
Patch Set 1 #Patch Set 2 : add bug and test fields #Patch Set 3 : Improve CL description #
Total comments: 2
Patch Set 4 : s/icon/bitmap/ #Patch Set 5 : ... #
Messages
Total messages: 6 (0 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||