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

Unified Diff: base/gfx/bitmap_platform_device_mac.cc

Issue 5644: Add platform_canvas_unittest.cc (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 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 | « base/base.xcodeproj/project.pbxproj ('k') | base/gfx/platform_canvas_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/bitmap_platform_device_mac.cc
===================================================================
--- base/gfx/bitmap_platform_device_mac.cc (revision 2768)
+++ base/gfx/bitmap_platform_device_mac.cc (working copy)
@@ -130,7 +130,6 @@
// Transform.
SkMatrix t(transform_);
LoadTransformToCGContext(bitmap_context_, t);
-
t.setTranslateX(-t.getTranslateX());
t.setTranslateY(-t.getTranslateY());
LoadClippingRegionToCGContext(bitmap_context_, clip_region_, t);
@@ -145,15 +144,18 @@
int width,
int height,
bool is_opaque) {
- // TODO(playmobil): remove debug code.
- //printf("BitmapPlatformDeviceMac::Create(%d,%d)\n", width, height);
- // each pixel is 4 bytes (RGBA):
void* data = malloc(height * width * 4);
if (!data) return NULL;
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap.setPixels(data);
+
+ // Note: The Windows implementation clears the Bitmap later on.
+ // This bares mentioning since removal of this line makes the
Amanda Walker 2008/10/01 21:32:01 "bares" should be "bears" :-)
+ // unit tests only fail periodically (or when MallocPreScribble is set).
+ bitmap.eraseARGB(0, 0, 0, 0);
+
bitmap.setIsOpaque(is_opaque);
if (is_opaque) {
@@ -170,7 +172,8 @@
CGContextRef bitmap_context =
CGBitmapContextCreate(data, width, height, 8, width*4,
color_space, kCGImageAlphaPremultipliedLast);
- // change the coordinate system to match WebCore's
+
+ // Change the coordinate system to match WebCore's
CGContextTranslateCTM(bitmap_context, 0, height);
CGContextScaleCTM(bitmap_context, 1.0, -1.0);
CGColorSpaceRelease(color_space);
« no previous file with comments | « base/base.xcodeproj/project.pbxproj ('k') | base/gfx/platform_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698