summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/gfx/platform_canvas_linux.cc9
-rw-r--r--base/gfx/platform_canvas_linux.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/base/gfx/platform_canvas_linux.cc b/base/gfx/platform_canvas_linux.cc
index 63ed3c2..5ebeb27 100644
--- a/base/gfx/platform_canvas_linux.cc
+++ b/base/gfx/platform_canvas_linux.cc
@@ -15,16 +15,21 @@ PlatformCanvasLinux::PlatformCanvasLinux() : SkCanvas() {
PlatformCanvasLinux::PlatformCanvasLinux(int width, int height, bool is_opaque)
: SkCanvas() {
- initialize(width, height, is_opaque);
+ if (!initialize(width, height, is_opaque))
+ CHECK(false);
}
PlatformCanvasLinux::~PlatformCanvasLinux() {
}
-void PlatformCanvasLinux::initialize(int width, int height, bool is_opaque) {
+bool PlatformCanvasLinux::initialize(int width, int height, bool is_opaque) {
SkDevice* device = createPlatformDevice(width, height, is_opaque);
+ if (!device)
+ return false;
+
setDevice(device);
device->unref(); // was created with refcount 1, and setDevice also refs
+ return true;
}
PlatformDeviceLinux& PlatformCanvasLinux::getTopPlatformDevice() const {
diff --git a/base/gfx/platform_canvas_linux.h b/base/gfx/platform_canvas_linux.h
index 4030a55..07f0d2d 100644
--- a/base/gfx/platform_canvas_linux.h
+++ b/base/gfx/platform_canvas_linux.h
@@ -27,7 +27,7 @@ class PlatformCanvasLinux : public SkCanvas {
virtual ~PlatformCanvasLinux();
// For two-part init, call if you use the no-argument constructor above
- void initialize(int width, int height, bool is_opaque);
+ bool initialize(int width, int height, bool is_opaque);
// Returns the platform device pointer of the topmost rect with a non-empty
// clip. Both the windows and mac versions have an equivalent of this method;