From bbf5159397aac3f952d0c17a5e66e7fc40177b8b Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Wed, 22 Oct 2008 21:40:03 -0500 Subject: 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 --- ChangeLog | 9 +++++++++ cairomm/pattern.cc | 17 +++++++++++++---- cairomm/pattern.h | 9 +++++++-- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c8127e..5b6402d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-22 Jonathon Jongsma + + * 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 * 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 #include +#include 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; -- cgit v1.2.3