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

Unified Diff: skia/ext/platform_canvas_mac.cc

Issue 6064007: Allow the creation of a skia::PlatformCanvas from a CGContextRef. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed changes to webmediaplayer_impl.cc Created 9 years, 12 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 | « skia/ext/platform_canvas_linux.cc ('k') | skia/ext/platform_canvas_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas_mac.cc
diff --git a/skia/ext/platform_canvas_mac.cc b/skia/ext/platform_canvas_mac.cc
index 7e4c6108ccf4204b1a57f91b69aff3736e24da9e..937346805b2c0bacaf57c0c580063a43141ade61 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() {
« no previous file with comments | « skia/ext/platform_canvas_linux.cc ('k') | skia/ext/platform_canvas_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698