diff options
author | Jānis Rukšāns <thedogfarted@gmail.com> | 2009-07-05 13:09:41 +0100 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2009-07-05 13:09:41 +0100 |
commit | 2fa38af1f9c93eca7443de4bcdd342ce50e2b488 (patch) | |
tree | 9002762e8ed31b7dcca4719e38d228a77097757e | |
parent | b29d457e7f3cc8144d7ad1f423e35584e5c6a3e2 (diff) |
Restore 1.6.x API / ABI that was unintentionally broken in 1.8.x
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | cairomm/context.cc | 30 | ||||
-rw-r--r-- | cairomm/context.h | 14 | ||||
-rw-r--r-- | cairomm/pattern.cc | 12 | ||||
-rw-r--r-- | cairomm/pattern.h | 3 | ||||
-rw-r--r-- | cairomm/scaledfont.cc | 23 | ||||
-rw-r--r-- | cairomm/scaledfont.h | 12 |
7 files changed, 102 insertions, 4 deletions
@@ -1,3 +1,15 @@ +2009-07-05 Jānis Rukšāns <thedogfarted@gmail.com> + + Reviewed by Jonathon Jongsma + + * cairomm/context.cc: + * cairomm/context.h: + * cairomm/pattern.cc: + * cairomm/pattern.h: + * cairomm/scaledfont.cc: + * cairomm/scaledfont.h: Restore 1.6.x ABI / API that was + unintentionally broken by the matrix changes in the 1.8.x series + 2009-01-26 Jonathon Jongsma <jonathon@quotidian.org> * NEWS: diff --git a/cairomm/context.cc b/cairomm/context.cc index 8db25eb..0551378 100644 --- a/cairomm/context.cc +++ b/cairomm/context.cc @@ -209,12 +209,24 @@ void Context::transform(const Matrix& matrix) check_object_status_and_throw_exception(*this); } +void Context::transform(const cairo_matrix_t& matrix) +{ + cairo_transform(cobj(), &matrix); + check_object_status_and_throw_exception(*this); +} + void Context::set_matrix(const Matrix& matrix) { cairo_set_matrix(cobj(), &matrix); check_object_status_and_throw_exception(*this); } +void Context::set_matrix(const cairo_matrix_t& matrix) +{ + cairo_set_matrix(cobj(), &matrix); + check_object_status_and_throw_exception(*this); +} + void Context::set_identity_matrix() { cairo_identity_matrix(cobj()); @@ -467,12 +479,24 @@ void Context::set_font_matrix(const Matrix& matrix) check_object_status_and_throw_exception(*this); } +void Context::set_font_matrix(const cairo_matrix_t& matrix) +{ + cairo_set_font_matrix(cobj(), &matrix); + check_object_status_and_throw_exception(*this); +} + void Context::get_font_matrix(Matrix& matrix) const { cairo_get_font_matrix(const_cast<cobject*>(cobj()), &matrix); check_object_status_and_throw_exception(*this); } +void Context::get_font_matrix(cairo_matrix_t& matrix) const +{ + cairo_get_font_matrix(const_cast<cobject*>(cobj()), &matrix); + check_object_status_and_throw_exception(*this); +} + void Context::set_font_options(const FontOptions& options) { cairo_set_font_options(cobj(), options.cobj()); @@ -698,6 +722,12 @@ void Context::get_matrix(Matrix& matrix) check_object_status_and_throw_exception(*this); } +void Context::get_matrix(cairo_matrix_t& matrix) +{ + cairo_get_matrix(cobj(), &matrix); + check_object_status_and_throw_exception(*this); +} + Matrix Context::get_matrix() const { Cairo::Matrix m; diff --git a/cairomm/context.h b/cairomm/context.h index a5021ef..436527e 100644 --- a/cairomm/context.h +++ b/cairomm/context.h @@ -307,6 +307,9 @@ public: */ void transform(const Matrix& matrix); + /* To keep 1.6.x ABI */ + void transform(const cairo_matrix_t& matrix); + /** Modifies the current transformation matrix (CTM) by setting it equal to * matrix. * @@ -314,6 +317,9 @@ public: */ void set_matrix(const Matrix& matrix); + /* To keep 1.6.x ABI */ + void set_matrix(const cairo_matrix_t& matrix); + /** Resets the current transformation matrix (CTM) by setting it equal to the * identity matrix. That is, the user-space and device-space axes will be * aligned and one user-space unit will transform to one device-space unit. @@ -703,6 +709,10 @@ public: void get_font_matrix(Matrix& matrix) const; void set_font_options(const FontOptions& options); + /* To keep 1.6.x ABI */ + void set_font_matrix(const cairo_matrix_t& matrix); + void get_font_matrix(cairo_matrix_t& matrix) const; + //TODO: Documentation. /** * @since 1.8 @@ -815,6 +825,10 @@ public: * @param matrix return value for the matrix */ void get_matrix(Matrix& matrix); + + /* To keep 1.6.x ABI */ + void get_matrix(cairo_matrix_t& matrix); + /** @since 1.8 */ Matrix get_matrix() const; diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc index 8e49331..9fa27ee 100644 --- a/cairomm/pattern.cc +++ b/cairomm/pattern.cc @@ -65,6 +65,18 @@ void Pattern::get_matrix(Matrix& matrix) const check_object_status_and_throw_exception(*this); } +void Pattern::set_matrix(const cairo_matrix_t& 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 +{ + 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; diff --git a/cairomm/pattern.h b/cairomm/pattern.h index d5e4872..bb30d8a 100644 --- a/cairomm/pattern.h +++ b/cairomm/pattern.h @@ -59,6 +59,9 @@ public: /** @since 1.8 */ Matrix get_matrix() const; + /* To keep 1.6.x ABI */ + void set_matrix(const cairo_matrix_t& matrix); + void get_matrix(cairo_matrix_t& matrix) const; PatternType get_type() const; typedef cairo_pattern_t cobject; diff --git a/cairomm/scaledfont.cc b/cairomm/scaledfont.cc index 5663f36..5a616fc 100644 --- a/cairomm/scaledfont.cc +++ b/cairomm/scaledfont.cc @@ -31,8 +31,8 @@ ScaledFont::ScaledFont(cobject* cobj, bool has_reference) m_cobject = cairo_scaled_font_reference(cobj); } -ScaledFont::ScaledFont(const RefPtr<FontFace>& font_face, const Matrix& font_matrix, - const Matrix& ctm, const FontOptions& options) +ScaledFont::ScaledFont(const RefPtr<FontFace>& font_face, const cairo_matrix_t& font_matrix, + const cairo_matrix_t& ctm, const FontOptions& options) { m_cobject = cairo_scaled_font_create(font_face->cobj(), @@ -54,6 +54,12 @@ RefPtr<ScaledFont> ScaledFont::create(const RefPtr<FontFace>& font_face, const M return RefPtr<ScaledFont>(new ScaledFont(font_face, font_matrix, ctm, options)); } +RefPtr<ScaledFont> ScaledFont::create(const RefPtr<FontFace>& font_face, const cairo_matrix_t& font_matrix, + const cairo_matrix_t& ctm, const FontOptions& options) +{ + return RefPtr<ScaledFont>(new ScaledFont(font_face, font_matrix, ctm, options)); +} + void ScaledFont::extents(FontExtents& extents) const { cairo_scaled_font_extents(m_cobject, static_cast<cairo_font_extents_t*>(&extents)); @@ -103,12 +109,25 @@ void ScaledFont::get_font_matrix(Matrix& font_matrix) const check_object_status_and_throw_exception(*this); } +void ScaledFont::get_font_matrix(cairo_matrix_t& font_matrix) const +{ + cairo_scaled_font_get_font_matrix(m_cobject, + &font_matrix); + check_object_status_and_throw_exception(*this); +} + void ScaledFont::get_ctm(Matrix& ctm) const { cairo_scaled_font_get_ctm(m_cobject, &ctm); check_object_status_and_throw_exception(*this); } +void ScaledFont::get_ctm(cairo_matrix_t& ctm) const +{ + cairo_scaled_font_get_ctm(m_cobject, &ctm); + check_object_status_and_throw_exception(*this); +} + FontType ScaledFont::get_type() const { cairo_font_type_t font_type = cairo_scaled_font_get_type(m_cobject); diff --git a/cairomm/scaledfont.h b/cairomm/scaledfont.h index 9abe48f..921aaad 100644 --- a/cairomm/scaledfont.h +++ b/cairomm/scaledfont.h @@ -82,6 +82,9 @@ public: */ static RefPtr<ScaledFont> create(const RefPtr<FontFace>& font_face, const Matrix& font_matrix, const Matrix& ctm, const FontOptions& options = FontOptions()); + /* To keep 1.6.x ABI */ + static RefPtr<ScaledFont> create(const RefPtr<FontFace>& font_face, const cairo_matrix_t& font_matrix, + const cairo_matrix_t& ctm, const FontOptions& options = FontOptions()); // NOTE: the constructor doesn't take a RefPtr<const FontFace> because the // FontFace object can be changed in this constructor (in the case of user // fonts, the FontFace becomes immutable, i.e. you can't call any set_*_func() @@ -164,11 +167,15 @@ public: * @since 1.2 */ void get_font_matrix(Matrix& font_matrix) const; + /* To keep 1.6.x ABI */ + void get_font_matrix(cairo_matrix_t& font_matrix) const; /** Gets the CTM with which the ScaledFont was created. * @since 1.2 */ void get_ctm(Matrix& ctm) const; + /* To keep 1.6.x ABI */ + void get_ctm(cairo_matrix_t& ctm) const; /** Gets the type of scaled Font * @since 1.2 @@ -215,8 +222,9 @@ public: void get_scale_matrix(Matrix& scale_matrix) const; protected: - ScaledFont(const RefPtr<FontFace>& font_face, const Matrix& font_matrix, - const Matrix& ctm, const FontOptions& options = FontOptions()); + /* Cairo::Matrix parameters changed to cairo_matrix_t */ + ScaledFont(const RefPtr<FontFace>& font_face, const cairo_matrix_t& font_matrix, + const cairo_matrix_t& ctm, const FontOptions& options = FontOptions()); /** The underlying C cairo object that is wrapped by this ScaledFont */ cobject* m_cobject; }; |