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

Unified Diff: skia/ext/platform_canvas_linux.cc

Issue 21485: Bitmap transport (Closed)
Patch Set: Fix some mac crashes Created 11 years, 10 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
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);

Powered by Google App Engine
This is Rietveld 408576698