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

Side by Side Diff: skia/ext/bitmap_platform_device_mac.cc

Issue 17211: Make Mac bitmaps use BGRA to match the MD5 hash Apple uses in its WebKit expe... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "skia/ext/bitmap_platform_device_mac.h" 5 #include "skia/ext/bitmap_platform_device_mac.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 #include "SkRegion.h" 10 #include "SkRegion.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (is_opaque) { 162 if (is_opaque) {
163 #ifndef NDEBUG 163 #ifndef NDEBUG
164 // To aid in finding bugs, we set the background color to something 164 // To aid in finding bugs, we set the background color to something
165 // obviously wrong so it will be noticable when it is not cleared 165 // obviously wrong so it will be noticable when it is not cleared
166 bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green 166 bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green
167 #endif 167 #endif
168 } 168 }
169 169
170 CGColorSpaceRef color_space = 170 CGColorSpaceRef color_space =
171 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); 171 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
172 // allocate a bitmap context with 4 components per pixel (RGBA): 172 // allocate a bitmap context with 4 components per pixel (BGRA). Apple
173 // recommends these flags for improved CG performance.
173 CGContextRef bitmap_context = 174 CGContextRef bitmap_context =
174 CGBitmapContextCreate(data, width, height, 8, width*4, 175 CGBitmapContextCreate(data, width, height, 8, width*4,
175 color_space, kCGImageAlphaPremultipliedLast); 176 color_space,
177 kCGImageAlphaPremultipliedFirst |
178 kCGBitmapByteOrder32Host);
176 179
177 // Change the coordinate system to match WebCore's 180 // Change the coordinate system to match WebCore's
178 CGContextTranslateCTM(bitmap_context, 0, height); 181 CGContextTranslateCTM(bitmap_context, 0, height);
179 CGContextScaleCTM(bitmap_context, 1.0, -1.0); 182 CGContextScaleCTM(bitmap_context, 1.0, -1.0);
180 CGColorSpaceRelease(color_space); 183 CGColorSpaceRelease(color_space);
181 184
182 // The device object will take ownership of the graphics context. 185 // The device object will take ownership of the graphics context.
183 return new BitmapPlatformDeviceMac( 186 return new BitmapPlatformDeviceMac(
184 new BitmapPlatformDeviceMacData(bitmap_context), bitmap); 187 new BitmapPlatformDeviceMacData(bitmap_context), bitmap);
185 } 188 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 size_t offset = (i + bitmap_start_y) * row_words + bitmap_start_x; 284 size_t offset = (i + bitmap_start_y) * row_words + bitmap_start_x;
282 for (int j = 0; j < width; j++) { 285 for (int j = 0; j < width; j++) {
283 adjustor(data + offset + j); 286 adjustor(data + offset + j);
284 } 287 }
285 } 288 }
286 } 289 }
287 } 290 }
288 291
289 } // namespace skia 292 } // namespace skia
290 293
OLDNEW
« no previous file with comments | « no previous file | webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698