diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 21:40:28 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 21:40:28 +0000 |
commit | dc4f63c80cb90efe594131030aad6776e5945fcc (patch) | |
tree | 28c988d870db5b25535b333eb7676f6584329bea /base/gfx/bitmap_platform_device_mac.cc | |
parent | a2914d54e7d8f460cfd98b1ba02d0aa86bacbd45 (diff) | |
download | chromium_src-dc4f63c80cb90efe594131030aad6776e5945fcc.zip chromium_src-dc4f63c80cb90efe594131030aad6776e5945fcc.tar.gz chromium_src-dc4f63c80cb90efe594131030aad6776e5945fcc.tar.bz2 |
Add platform_canvas_unittest.cc
Also fixes issue 2977.
Review URL: http://codereview.chromium.org/5644
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx/bitmap_platform_device_mac.cc')
-rwxr-xr-x | base/gfx/bitmap_platform_device_mac.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/base/gfx/bitmap_platform_device_mac.cc b/base/gfx/bitmap_platform_device_mac.cc index 40b58cf..570b07e 100755 --- a/base/gfx/bitmap_platform_device_mac.cc +++ b/base/gfx/bitmap_platform_device_mac.cc @@ -130,7 +130,6 @@ void BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData::LoadConfig() { // 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 @@ BitmapPlatformDeviceMac* BitmapPlatformDeviceMac::Create(CGContextRef context, 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 bears mentioning since removal of this line makes the + // 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 @@ BitmapPlatformDeviceMac* BitmapPlatformDeviceMac::Create(CGContextRef context, 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); |