diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 05:26:00 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 05:26:00 +0000 |
commit | 8a7ef121c533b8f26199ce187982b327015b29e7 (patch) | |
tree | 1f9aaf05d33fa09f1b56bade75450040df17c9c6 /skia/ext/platform_canvas_mac.cc | |
parent | d0d61e7aac0754552bd669d871882bd0390a60e5 (diff) | |
download | chromium_src-8a7ef121c533b8f26199ce187982b327015b29e7.zip chromium_src-8a7ef121c533b8f26199ce187982b327015b29e7.tar.gz chromium_src-8a7ef121c533b8f26199ce187982b327015b29e7.tar.bz2 |
Wire up missing functionality in BitmapPlatformContext to allow the creation of a skia::PlatformCanvas
from a CGContextRef.
TEST=test_shell_tests, try (mac,win,linux)
Original review=http://codereview.chromium.org/6064007/
Patch by sjl@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70596 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/platform_canvas_mac.cc')
-rw-r--r-- | skia/ext/platform_canvas_mac.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/skia/ext/platform_canvas_mac.cc b/skia/ext/platform_canvas_mac.cc index 7e4c610..9373468 100644 --- a/skia/ext/platform_canvas_mac.cc +++ b/skia/ext/platform_canvas_mac.cc @@ -19,7 +19,7 @@ PlatformCanvas::PlatformCanvas(int width, bool is_opaque, CGContextRef context) : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) { - initialize(width, height, is_opaque); + initialize(context, width, height, is_opaque); } PlatformCanvas::PlatformCanvas(int width, @@ -37,14 +37,16 @@ bool PlatformCanvas::initialize(int width, int height, bool is_opaque, uint8_t* data) { - SkDevice* device = BitmapPlatformDevice::CreateWithData(data, width, height, - is_opaque); - if (!device) - return false; - - setDevice(device); - device->unref(); // Was created with refcount 1, and setDevice also refs. - return true; + return initializeWithDevice(BitmapPlatformDevice::CreateWithData( + data, width, height, is_opaque)); +} + +bool PlatformCanvas::initialize(CGContextRef context, + int width, + int height, + bool is_opaque) { + return initializeWithDevice(BitmapPlatformDevice::Create( + context, width, height, is_opaque)); } CGContextRef PlatformCanvas::beginPlatformPaint() { |