diff options
author | Jonathon Jongsma <jjongsma@gnome.org> | 2008-10-22 21:40:03 -0500 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2008-10-22 21:40:03 -0500 |
commit | bbf5159397aac3f952d0c17a5e66e7fc40177b8b (patch) | |
tree | 5b16a32bc14be3f3f0509547ac88cdae00558829 | |
parent | 83de59d7c7a218cb0502d65335cd9eae3e73077e (diff) |
Fix broken Pattern::get/set_matrix() API that was using the C types
* cairomm/pattern.h: Fix broken get/set_matrix() API that was using the C
cairo_matrix_t type instead of Cairo::Matrix. This should be an
ABI-compatible change since Cairo::Matrix is ABI-compatible with
cairo_matrix_t, however it is a minor API change that could result in some
compile warnings for existing code
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | cairomm/pattern.cc | 17 | ||||
-rw-r--r-- | cairomm/pattern.h | 9 |
3 files changed, 29 insertions, 6 deletions
@@ -1,3 +1,12 @@ +2008-10-22 Jonathon Jongsma <jonathon@quotidian.org> + + * cairomm/pattern.cc: + * cairomm/pattern.h: Fix broken get/set_matrix() API that was using the C + cairo_matrix_t type instead of Cairo::Matrix. This should be an + ABI-compatible change since Cairo::Matrix is ABI-compatible with + cairo_matrix_t, however it is a minor API change that could result in some + compile warnings for existing code + 2008-10-15 Jonathon Jongsma <jonathon@quotidian.org> * configure.in: add all of the _LIBS and _CFLAGS for those features that are diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc index 420ed82..8e49331 100644 --- a/cairomm/pattern.cc +++ b/cairomm/pattern.cc @@ -18,6 +18,7 @@ #include <cairomm/pattern.h> #include <cairomm/private.h> +#include <cairomm/matrix.h> namespace Cairo { @@ -52,18 +53,26 @@ void Pattern::unreference() const cairo_pattern_destroy(m_cobject); } -void Pattern::set_matrix(const cairo_matrix_t &matrix) +void Pattern::set_matrix(const Matrix& matrix) { - cairo_pattern_set_matrix(m_cobject, &matrix); + cairo_pattern_set_matrix(m_cobject, (cairo_matrix_t*)&matrix); check_object_status_and_throw_exception(*this); } -void Pattern::get_matrix(cairo_matrix_t &matrix) const +void Pattern::get_matrix(Matrix& matrix) const { - cairo_pattern_get_matrix(m_cobject, &matrix); + cairo_pattern_get_matrix(m_cobject, (cairo_matrix_t*)&matrix); check_object_status_and_throw_exception(*this); } +Matrix Pattern::get_matrix() const +{ + Cairo::Matrix m; + cairo_pattern_get_matrix(m_cobject, (cairo_matrix_t*)&m); + check_object_status_and_throw_exception(*this); + return m; +} + PatternType Pattern::get_type() const { cairo_pattern_type_t pattern_type = cairo_pattern_get_type(m_cobject); diff --git a/cairomm/pattern.h b/cairomm/pattern.h index e56d383..6070b1e 100644 --- a/cairomm/pattern.h +++ b/cairomm/pattern.h @@ -32,6 +32,8 @@ struct ColorStop double red, green, blue, alpha; }; +struct Matrix; + /** * This is a reference-counted object that should be used via Cairo::RefPtr. */ @@ -52,8 +54,11 @@ public: virtual ~Pattern(); - void set_matrix(const cairo_matrix_t &matrix); - void get_matrix(cairo_matrix_t &matrix) const; + void set_matrix(const Matrix& matrix); + void get_matrix(Matrix& matrix) const; + /** @since 1.8 + */ + Matrix get_matrix() const; PatternType get_type() const; typedef cairo_pattern_t cobject; |