diff options
author | Jonathon Jongsma <jjongsma@gnome.org> | 2010-12-30 16:21:21 -0600 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2010-12-30 17:18:58 -0600 |
commit | 59538c87691e7f05dbd3433bbd52f17709496240 (patch) | |
tree | c53d795c0359e3d66ad42b941bd74efbd18750c9 | |
parent | a68411d2a13b311fd4fc84e36ddc772833292eb7 (diff) |
Fix Region api to throw exception rather than return status
All other API throws exceptions instead of returning error statuses, so make
this be consistent as well. (the only possible error for these operations is
NO_MEMORY)
-rw-r--r-- | cairomm/region.cc | 30 | ||||
-rw-r--r-- | cairomm/region.h | 12 |
2 files changed, 24 insertions, 18 deletions
diff --git a/cairomm/region.cc b/cairomm/region.cc index 0d37b9b..021c31b 100644 --- a/cairomm/region.cc +++ b/cairomm/region.cc @@ -96,34 +96,40 @@ void Region::translate(int dx, int dy) cairo_region_translate(m_cobject, dx, dy); } -ErrorStatus Region::subtract(const RefPtr<Region>& other) +void Region::subtract(const RefPtr<Region>& other) { - return cairo_region_subtract(m_cobject, (other ? other->cobj() : 0)); + ErrorStatus status = cairo_region_subtract(m_cobject, (other ? other->cobj() : 0)); + check_status_and_throw_exception (status); } -ErrorStatus Region::subtract(const RectangleInt& rectangle) +void Region::subtract(const RectangleInt& rectangle) { - return cairo_region_subtract_rectangle(m_cobject, &rectangle); + ErrorStatus status = cairo_region_subtract_rectangle(m_cobject, &rectangle); + check_status_and_throw_exception (status); } -ErrorStatus Region::intersect(const RefPtr<Region>& other) +void Region::intersect(const RefPtr<Region>& other) { - return cairo_region_intersect(m_cobject, (other ? other->cobj() : 0)); + ErrorStatus status = cairo_region_intersect(m_cobject, (other ? other->cobj() : 0)); + check_status_and_throw_exception (status); } -ErrorStatus Region::intersect(const RectangleInt& rectangle) +void Region::intersect(const RectangleInt& rectangle) { - return cairo_region_intersect_rectangle(m_cobject, &rectangle); + ErrorStatus status = cairo_region_intersect_rectangle(m_cobject, &rectangle); + check_status_and_throw_exception (status); } -ErrorStatus Region::do_union(const RefPtr<Region>& other) +void Region::do_union(const RefPtr<Region>& other) { - return cairo_region_union(m_cobject, (other ? other->cobj() : 0)); + ErrorStatus status = cairo_region_union(m_cobject, (other ? other->cobj() : 0)); + check_status_and_throw_exception (status); } -ErrorStatus Region::do_union(const RectangleInt& rectangle) +void Region::do_union(const RectangleInt& rectangle) { - return cairo_region_union_rectangle(m_cobject, &rectangle); + ErrorStatus status = cairo_region_union_rectangle(m_cobject, &rectangle); + check_status_and_throw_exception (status); } diff --git a/cairomm/region.h b/cairomm/region.h index 9909d8e..ea26a74 100644 --- a/cairomm/region.h +++ b/cairomm/region.h @@ -70,19 +70,19 @@ public: void translate(int dx, int dy); - ErrorStatus subtract(const RefPtr<Region>& other); + void subtract(const RefPtr<Region>& other); - ErrorStatus subtract(const RectangleInt& rectangle); + void subtract(const RectangleInt& rectangle); - ErrorStatus intersect(const RefPtr<Region>& other); + void intersect(const RefPtr<Region>& other); - ErrorStatus intersect(const RectangleInt& rectangle); + void intersect(const RectangleInt& rectangle); //We don't call this method union() because that is a C++ keyword. - ErrorStatus do_union(const RefPtr<Region>& other); + void do_union(const RefPtr<Region>& other); - ErrorStatus do_union(const RectangleInt& rectangle); + void do_union(const RectangleInt& rectangle); |