summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 16:45:24 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 16:45:24 +0000
commitd2e7bcc9bf90c13add4a246ef56c09e1a0145e5b (patch)
tree72c9a35f4e914a5c67d07fb7b58d104e01ce24be
parent6610d56ab0db07cc3487d0cc6e0b8015fe676c93 (diff)
downloadchromium_src-d2e7bcc9bf90c13add4a246ef56c09e1a0145e5b.zip
chromium_src-d2e7bcc9bf90c13add4a246ef56c09e1a0145e5b.tar.gz
chromium_src-d2e7bcc9bf90c13add4a246ef56c09e1a0145e5b.tar.bz2
Make PlatformCanvasLinux match up with recent changes in the Windows one, which is able to report allocation failures.
Review URL: http://codereview.chromium.org/9510 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4991 0039d316-1c4b-4281-b951-d872f2087c98
-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;