diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 16:45:24 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 16:45:24 +0000 |
commit | d2e7bcc9bf90c13add4a246ef56c09e1a0145e5b (patch) | |
tree | 72c9a35f4e914a5c67d07fb7b58d104e01ce24be | |
parent | 6610d56ab0db07cc3487d0cc6e0b8015fe676c93 (diff) | |
download | chromium_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.cc | 9 | ||||
-rw-r--r-- | base/gfx/platform_canvas_linux.h | 2 |
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; |