summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xskia/ext/bitmap_platform_device_mac.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index a0f0bf1..a3f5e74 100755
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -146,12 +146,11 @@ BitmapPlatformDeviceMac* BitmapPlatformDeviceMac::Create(CGContextRef context,
int width,
int height,
bool is_opaque) {
- void* data = malloc(height * width * 4);
- if (!data) return NULL;
-
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
- bitmap.setPixels(data);
+ if (bitmap.allocPixels() != true)
+ return NULL;
+ void* data = bitmap.getPixels();
// Note: The Windows implementation clears the Bitmap later on.
// This bears mentioning since removal of this line makes the
@@ -224,7 +223,7 @@ CGContextRef BitmapPlatformDeviceMac::GetBitmapContext() {
return data_->GetBitmapContext();
}
-void BitmapPlatformDeviceMac::setMatrixClip(const SkMatrix& transform,
+void BitmapPlatformDeviceMac::setMatrixClip(const SkMatrix& transform,
const SkRegion& region) {
data_->SetMatrixClip(transform, region);
}