diff options
Diffstat (limited to 'skia/ext/platform_canvas_linux.cc')
-rw-r--r-- | skia/ext/platform_canvas_linux.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/skia/ext/platform_canvas_linux.cc b/skia/ext/platform_canvas_linux.cc index d436fd7..422693c 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); |