Index: skia/ext/platform_canvas_linux.cc |
diff --git a/skia/ext/platform_canvas_linux.cc b/skia/ext/platform_canvas_linux.cc |
index d436fd765c2784788d7fb64e0f811b72d4144774..422693ca958496d134051231576733590137b030 100644 |
--- a/skia/ext/platform_canvas_linux.cc |
+++ b/skia/ext/platform_canvas_linux.cc |
@@ -21,6 +21,13 @@ PlatformCanvasLinux::PlatformCanvasLinux(int width, int height, bool is_opaque) |
SK_CRASH(); |
} |
+PlatformCanvasLinux::PlatformCanvasLinux(int width, int height, bool is_opaque, |
+ uint8_t* data) |
+ : SkCanvas() { |
+ if (!initialize(width, height, is_opaque, data)) |
+ SK_CRASH(); |
+} |
+ |
PlatformCanvasLinux::~PlatformCanvasLinux() { |
} |
@@ -34,6 +41,18 @@ bool PlatformCanvasLinux::initialize(int width, int height, bool is_opaque) { |
return true; |
} |
+bool PlatformCanvasLinux::initialize(int width, int height, bool is_opaque, |
+ uint8_t* data) { |
+ SkDevice* device = |
+ BitmapPlatformDeviceLinux::Create(width, height, is_opaque, data); |
+ if (!device) |
+ return false; |
+ |
+ setDevice(device); |
+ device->unref(); // was created with refcount 1, and setDevice also refs |
+ return true; |
+} |
+ |
PlatformDeviceLinux& PlatformCanvasLinux::getTopPlatformDevice() const { |
// All of our devices should be our special PlatformDevice. |
SkCanvas::LayerIter iter(const_cast<PlatformCanvasLinux*>(this), false); |