summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorbsalomon@google.com <bsalomon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-23 22:19:58 +0000
committerbsalomon@google.com <bsalomon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-23 22:19:58 +0000
commit1e4831cd79c4369cdb2bc2dd7a5e57ca0293bab7 (patch)
treeace27ac2d79938ae0192ecf92d33a2279bf4b0ce /skia
parent4e398157051035efdeaeb6d1d2adaea04c57bc72 (diff)
downloadchromium_src-1e4831cd79c4369cdb2bc2dd7a5e57ca0293bab7.zip
chromium_src-1e4831cd79c4369cdb2bc2dd7a5e57ca0293bab7.tar.gz
chromium_src-1e4831cd79c4369cdb2bc2dd7a5e57ca0293bab7.tar.bz2
Remove double allocation of pixels when constructing an SkDevice backed by CoreGraphics pixels
BUG=277680 Review URL: https://chromiumcodereview.appspot.com/22872011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219356 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/bitmap_platform_device_mac.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index b7b05e5..c09f8be 100644
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -125,15 +125,17 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context,
return NULL;
SkBitmap bitmap;
+ // TODO: verify that the CG Context's pixels will have tight rowbytes or pass in the correct
+ // rowbytes for the case when context != NULL.
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
- if (bitmap.allocPixels() != true)
- return NULL;
- void* data = NULL;
+ void* data;
if (context) {
data = CGBitmapContextGetData(context);
bitmap.setPixels(data);
} else {
+ if (!bitmap.allocPixels())
+ return NULL;
data = bitmap.getPixels();
}