diff options
author | Jonathon Jongsma <jjongsma@gnome.org> | 2008-01-30 16:14:53 -0600 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2008-01-30 16:14:53 -0600 |
commit | 259af6cb264770d2aa8e27d2c73df2ad4500cdd5 (patch) | |
tree | b45952accf25f51a3353121dfd1c57ac4f4406fb | |
parent | 5f5319856b2d44f70b72bbec663c65e82c514d6a (diff) |
* cairomm/context.cc:
* cairomm/context.h: add new has_current_point() API to deal with the fact
that cairo_get_current_point() changed from a void to a cairo_status_t
return type, and we don't necessarily want to throw an exception here or it
could break existing applications. But this could be reconsidered
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | cairomm/context.cc | 14 | ||||
-rw-r--r-- | cairomm/context.h | 6 |
3 files changed, 27 insertions, 1 deletions
@@ -1,5 +1,13 @@ 2008-01-30 Jonathon Jongsma <jjongsma@gnome.org> + * cairomm/context.cc: + * cairomm/context.h: add new has_current_point() API to deal with the fact + that cairo_get_current_point() changed from a void to a cairo_status_t + return type, and we don't necessarily want to throw an exception here or it + could break existing applications. But this could be reconsidered + +2008-01-30 Jonathon Jongsma <jjongsma@gnome.org> + * cairomm/xlib_surface.cc: * cairomm/xlib_surface.h: add new get_xrender_format() function (new in 1.5.8) and add missing static create_with_xrender_format() function diff --git a/cairomm/context.cc b/cairomm/context.cc index c4fdc65..48e193e 100644 --- a/cairomm/context.cc +++ b/cairomm/context.cc @@ -592,9 +592,21 @@ Antialias Context::get_antialias() const return result; } +bool Context::has_current_point() const +{ + double x, y; + cairo_status_t status = cairo_get_current_point(m_cobject, &x, &y); + return (status != CAIRO_STATUS_NO_CURRENT_POINT); +} + void Context::get_current_point(double& x, double& y) const { - cairo_get_current_point(m_cobject, &x, &y); + // NOTE: this function used to return void, but was changed to return a status + // if there was no current point. We would normally check the status and + // throw an exception on error, but this could break existing code, so we + // added a has_current_point() function to be able to determine the case where + // there is no current point. + (void) cairo_get_current_point(m_cobject, &x, &y); check_object_status_and_throw_exception(*this); } diff --git a/cairomm/context.h b/cairomm/context.h index 44375ca..711309e 100644 --- a/cairomm/context.h +++ b/cairomm/context.h @@ -746,9 +746,15 @@ public: * * @param x return value for X coordinate of the current point * @param y return value for Y coordinate of the current point + * + * @see has_current_point */ void get_current_point (double& x, double& y) const; + /** Checks if there is a current point defined + */ + bool has_current_point() const; + /** Gets the current fill rule, as set by set_fill_rule(). */ FillRule get_fill_rule() const; |