diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 03:37:00 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 03:37:00 +0000 |
commit | 9513f20493f07ab43d68ccb55fa321086bf955b3 (patch) | |
tree | 82c91d40127cc72266edef46812b3f71a2ff4bc8 /app/gfx | |
parent | 134c47b9e74ab7aa6dce7e1beeaf5e406a925b76 (diff) | |
download | chromium_src-9513f20493f07ab43d68ccb55fa321086bf955b3.zip chromium_src-9513f20493f07ab43d68ccb55fa321086bf955b3.tar.gz chromium_src-9513f20493f07ab43d68ccb55fa321086bf955b3.tar.bz2 |
Makes Path::CreateGdkRegion return NULL for empty paths. Without this
gdk_region_polygon asserts. And adds the null check in WindowGtk.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/164441
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23691 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx')
-rw-r--r-- | app/gfx/path.h | 1 | ||||
-rw-r--r-- | app/gfx/path_gtk.cc | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/app/gfx/path.h b/app/gfx/path.h index 96ae427..8062e34 100644 --- a/app/gfx/path.h +++ b/app/gfx/path.h @@ -28,6 +28,7 @@ class Path : public SkPath { #elif defined(OS_LINUX) // Creates a Gdkregion from the path. The caller is responsible for freeing // resources used by this region. This only supports polygon paths. + // WARNING: this returns NULL for an empty Path. GdkRegion* CreateGdkRegion() const; #endif diff --git a/app/gfx/path_gtk.cc b/app/gfx/path_gtk.cc index bc35857..9a2b92c 100644 --- a/app/gfx/path_gtk.cc +++ b/app/gfx/path_gtk.cc @@ -7,11 +7,18 @@ #include <gdk/gdk.h> #include "base/scoped_ptr.h" +#include "base/command_line.h" namespace gfx { GdkRegion* Path::CreateGdkRegion() const { int point_count = getPoints(NULL, 0); + if (point_count <= 1) { + // NOTE: ideally this would return gdk_empty_region, but that returns a + // region with nothing in it. + return NULL; + } + scoped_array<SkPoint> points(new SkPoint[point_count]); getPoints(points.get(), point_count); |