summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-09-11 00:14:36 -0500
committerJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-09-11 00:14:36 -0500
commite59c2827dcf5c39bcd1b09e676da94627fd1984d (patch)
tree59eb028338d8137a9e39e7dae97cf93f13e91e64
parent04020a953ef4c31e31927a1994a1035a0351c6ff (diff)
style fixups: use cobj() instead of using m_cobject directly whenever possible
-rw-r--r--ChangeLog6
-rw-r--r--cairomm/context.cc211
-rw-r--r--cairomm/surface.cc69
3 files changed, 149 insertions, 137 deletions
diff --git a/ChangeLog b/ChangeLog
index ee080f3..d476c3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-09-10 Jonathon Jongsma <jjongsma@gnome.org>
+ * cairomm/context.cc:
+ * cairomm/surface.cc: style fixups: use cobj() instead of using m_cobject
+ directly whenever possible
+
+2008-09-10 Jonathon Jongsma <jjongsma@gnome.org>
+
* cairomm/win32_surface.cc:
* cairomm/win32_surface.h: add Win32Surface::create_with_ddb (and an alias for
create_with_dib()), and Win32Surface::get_image()
diff --git a/cairomm/context.cc b/cairomm/context.cc
index ee9d708..78e9b53 100644
--- a/cairomm/context.cc
+++ b/cairomm/context.cc
@@ -68,362 +68,362 @@ Context::~Context()
void Context::reference() const
{
- cairo_reference(m_cobject);
+ cairo_reference(const_cast<cobject*>(cobj()));
}
void Context::unreference() const
{
- cairo_destroy(m_cobject);
+ cairo_destroy(const_cast<cobject*>(cobj()));
}
void Context::save()
{
- cairo_save(m_cobject);
+ cairo_save(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::restore()
{
- cairo_restore(m_cobject);
+ cairo_restore(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::set_operator(Operator op)
{
- cairo_set_operator(m_cobject, static_cast<cairo_operator_t>(op));
+ cairo_set_operator(cobj(), static_cast<cairo_operator_t>(op));
check_object_status_and_throw_exception(*this);
}
void Context::set_source(const RefPtr<const Pattern>& source)
{
- cairo_set_source(m_cobject, const_cast<cairo_pattern_t*>(source->cobj()));
+ cairo_set_source(cobj(), const_cast<cairo_pattern_t*>(source->cobj()));
check_object_status_and_throw_exception(*this);
}
void Context::set_source_rgb(double red, double green, double blue)
{
- cairo_set_source_rgb(m_cobject, red, green, blue);
+ cairo_set_source_rgb(cobj(), red, green, blue);
check_object_status_and_throw_exception(*this);
}
void Context::set_source_rgba(double red, double green, double blue,
double alpha)
{
- cairo_set_source_rgba(m_cobject, red, green, blue, alpha);
+ cairo_set_source_rgba(cobj(), red, green, blue, alpha);
check_object_status_and_throw_exception(*this);
}
void Context::set_source(const RefPtr<Surface>& surface, double x, double y)
{
- cairo_set_source_surface(m_cobject, surface->cobj(), x, y);
+ cairo_set_source_surface(cobj(), surface->cobj(), x, y);
check_object_status_and_throw_exception(*this);
}
void Context::set_tolerance(double tolerance)
{
- cairo_set_tolerance(m_cobject, tolerance);
+ cairo_set_tolerance(cobj(), tolerance);
check_object_status_and_throw_exception(*this);
}
void Context::set_antialias(Antialias antialias)
{
- cairo_set_antialias(m_cobject, static_cast<cairo_antialias_t>(antialias));
+ cairo_set_antialias(cobj(), static_cast<cairo_antialias_t>(antialias));
check_object_status_and_throw_exception(*this);
}
void Context::set_fill_rule(FillRule fill_rule)
{
- cairo_set_fill_rule(m_cobject, static_cast<cairo_fill_rule_t>(fill_rule));
+ cairo_set_fill_rule(cobj(), static_cast<cairo_fill_rule_t>(fill_rule));
check_object_status_and_throw_exception(*this);
}
void Context::set_line_width(double width)
{
- cairo_set_line_width(m_cobject, width);
+ cairo_set_line_width(cobj(), width);
check_object_status_and_throw_exception(*this);
}
void Context::set_line_cap(LineCap line_cap)
{
- cairo_set_line_cap(m_cobject, static_cast<cairo_line_cap_t>(line_cap));
+ cairo_set_line_cap(cobj(), static_cast<cairo_line_cap_t>(line_cap));
check_object_status_and_throw_exception(*this);
}
void Context::set_line_join(LineJoin line_join)
{
- cairo_set_line_join(m_cobject, static_cast<cairo_line_join_t>(line_join));
+ cairo_set_line_join(cobj(), static_cast<cairo_line_join_t>(line_join));
check_object_status_and_throw_exception(*this);
}
void Context::set_dash(std::valarray<double>& dashes, double offset)
{
- cairo_set_dash(m_cobject, &dashes[0], dashes.size(), offset);
+ cairo_set_dash(cobj(), &dashes[0], dashes.size(), offset);
check_object_status_and_throw_exception(*this);
}
void Context::set_dash(std::vector<double>& dashes, double offset)
{
- cairo_set_dash(m_cobject, &dashes[0], dashes.size(), offset);
+ cairo_set_dash(cobj(), &dashes[0], dashes.size(), offset);
check_object_status_and_throw_exception(*this);
}
void Context::unset_dash()
{
- cairo_set_dash(m_cobject, NULL, 0, 0.0);
+ cairo_set_dash(cobj(), NULL, 0, 0.0);
check_object_status_and_throw_exception(*this);
}
void Context::set_miter_limit(double limit)
{
- cairo_set_miter_limit(m_cobject, limit);
+ cairo_set_miter_limit(cobj(), limit);
check_object_status_and_throw_exception(*this);
}
void Context::translate(double tx, double ty)
{
- cairo_translate(m_cobject, tx, ty);
+ cairo_translate(cobj(), tx, ty);
check_object_status_and_throw_exception(*this);
}
void Context::scale(double sx, double sy)
{
- cairo_scale(m_cobject, sx, sy);
+ cairo_scale(cobj(), sx, sy);
check_object_status_and_throw_exception(*this);
}
void Context::rotate(double angle_radians)
{
- cairo_rotate(m_cobject, angle_radians);
+ cairo_rotate(cobj(), angle_radians);
check_object_status_and_throw_exception(*this);
}
void Context::rotate_degrees(double angle_degrees)
{
- cairo_rotate(m_cobject, angle_degrees * M_PI/180.0);
+ cairo_rotate(cobj(), angle_degrees * M_PI/180.0);
check_object_status_and_throw_exception(*this);
}
void Context::transform(const Matrix& matrix)
{
- cairo_transform(m_cobject, &matrix);
+ cairo_transform(cobj(), &matrix);
check_object_status_and_throw_exception(*this);
}
void Context::set_matrix(const Matrix& matrix)
{
- cairo_set_matrix(m_cobject, &matrix);
+ cairo_set_matrix(cobj(), &matrix);
check_object_status_and_throw_exception(*this);
}
void Context::set_identity_matrix()
{
- cairo_identity_matrix(m_cobject);
+ cairo_identity_matrix(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::user_to_device(double& x, double& y)
{
- cairo_user_to_device(m_cobject, &x, &y);
+ cairo_user_to_device(cobj(), &x, &y);
check_object_status_and_throw_exception(*this);
}
void Context::user_to_device_distance(double& dx, double& dy)
{
- cairo_user_to_device_distance(m_cobject, &dx, &dy);
+ cairo_user_to_device_distance(cobj(), &dx, &dy);
check_object_status_and_throw_exception(*this);
}
void Context::device_to_user(double& x, double& y)
{
- cairo_device_to_user(m_cobject, &x, &y);
+ cairo_device_to_user(cobj(), &x, &y);
check_object_status_and_throw_exception(*this);
}
void Context::device_to_user_distance(double& dx, double& dy)
{
- cairo_device_to_user_distance(m_cobject, &dx, &dy);
+ cairo_device_to_user_distance(cobj(), &dx, &dy);
check_object_status_and_throw_exception(*this);
}
void Context::begin_new_path()
{
- cairo_new_path(m_cobject);
+ cairo_new_path(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::begin_new_sub_path()
{
- cairo_new_sub_path(m_cobject);
+ cairo_new_sub_path(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::move_to(double x, double y)
{
- cairo_move_to(m_cobject, x, y);
+ cairo_move_to(cobj(), x, y);
check_object_status_and_throw_exception(*this);
}
void Context::line_to(double x, double y)
{
- cairo_line_to(m_cobject, x, y);
+ cairo_line_to(cobj(), x, y);
check_object_status_and_throw_exception(*this);
}
void Context::curve_to(double x1, double y1, double x2, double y2, double x3, double y3)
{
- cairo_curve_to(m_cobject, x1, y1, x2, y2, x3, y3);
+ cairo_curve_to(cobj(), x1, y1, x2, y2, x3, y3);
check_object_status_and_throw_exception(*this);
}
void Context::arc(double xc, double yc, double radius, double angle1, double angle2)
{
- cairo_arc(m_cobject, xc, yc, radius, angle1, angle2);
+ cairo_arc(cobj(), xc, yc, radius, angle1, angle2);
check_object_status_and_throw_exception(*this);
}
void Context::arc_negative(double xc, double yc, double radius, double angle1, double angle2)
{
- cairo_arc_negative(m_cobject, xc, yc, radius, angle1, angle2);
+ cairo_arc_negative(cobj(), xc, yc, radius, angle1, angle2);
check_object_status_and_throw_exception(*this);
}
void Context::rel_move_to(double dx, double dy)
{
- cairo_rel_move_to(m_cobject, dx, dy);
+ cairo_rel_move_to(cobj(), dx, dy);
check_object_status_and_throw_exception(*this);
}
void Context::rel_line_to(double dx, double dy)
{
- cairo_rel_line_to(m_cobject, dx, dy);
+ cairo_rel_line_to(cobj(), dx, dy);
check_object_status_and_throw_exception(*this);
}
void Context::rel_curve_to(double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
{
- cairo_rel_curve_to(m_cobject, dx1, dy1, dx2, dy2, dx3, dy3);
+ cairo_rel_curve_to(cobj(), dx1, dy1, dx2, dy2, dx3, dy3);
check_object_status_and_throw_exception(*this);
}
void Context::rectangle(double x, double y, double width, double height)
{
- cairo_rectangle(m_cobject, x, y, width, height);
+ cairo_rectangle(cobj(), x, y, width, height);
check_object_status_and_throw_exception(*this);
}
void Context::close_path()
{
- cairo_close_path(m_cobject);
+ cairo_close_path(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::paint()
{
- cairo_paint(m_cobject);
+ cairo_paint(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::paint_with_alpha(double alpha)
{
- cairo_paint_with_alpha(m_cobject, alpha);
+ cairo_paint_with_alpha(cobj(), alpha);
check_object_status_and_throw_exception(*this);
}
void Context::mask(const RefPtr<const Pattern>& pattern)
{
- cairo_mask(m_cobject, const_cast<cairo_pattern_t*>(pattern->cobj()));
+ cairo_mask(cobj(), const_cast<cairo_pattern_t*>(pattern->cobj()));
check_object_status_and_throw_exception(*this);
}
void Context::mask(const RefPtr<const Surface>& surface, double surface_x, double surface_y)
{
- cairo_mask_surface(m_cobject, const_cast<cairo_surface_t*>(surface->cobj()), surface_x, surface_y);
+ cairo_mask_surface(cobj(), const_cast<cairo_surface_t*>(surface->cobj()), surface_x, surface_y);
check_object_status_and_throw_exception(*this);
}
void Context::stroke()
{
- cairo_stroke(m_cobject);
+ cairo_stroke(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::stroke_preserve()
{
- cairo_stroke_preserve(m_cobject);
+ cairo_stroke_preserve(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::fill()
{
- cairo_fill(m_cobject);
+ cairo_fill(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::fill_preserve()
{
- cairo_fill_preserve(m_cobject);
+ cairo_fill_preserve(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::copy_page()
{
- cairo_copy_page(m_cobject);
+ cairo_copy_page(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::show_page()
{
- cairo_show_page(m_cobject);
+ cairo_show_page(cobj());
check_object_status_and_throw_exception(*this);
}
bool Context::in_stroke(double x, double y) const
{
- const bool result = cairo_in_stroke(m_cobject, x, y);
+ const bool result = cairo_in_stroke(const_cast<cobject*>(cobj()), x, y);
check_object_status_and_throw_exception(*this);
return result;
}
bool Context::in_fill(double x, double y) const
{
- const bool result = cairo_in_fill(m_cobject, x, y);
+ const bool result = cairo_in_fill(const_cast<cobject*>(cobj()), x, y);
check_object_status_and_throw_exception(*this);
return result;
}
void Context::get_stroke_extents(double& x1, double& y1, double& x2, double& y2) const
{
- cairo_stroke_extents(m_cobject, &x1, &y1, &x2, &y2);
+ cairo_stroke_extents(const_cast<cobject*>(cobj()), &x1, &y1, &x2, &y2);
check_object_status_and_throw_exception(*this);
}
void Context::get_fill_extents(double& x1, double& y1, double& x2, double& y2) const
{
- cairo_fill_extents(m_cobject, &x1, &y1, &x2, &y2);
+ cairo_fill_extents(const_cast<cobject*>(cobj()), &x1, &y1, &x2, &y2);
check_object_status_and_throw_exception(*this);
}
void Context::reset_clip()
{
- cairo_reset_clip(m_cobject);
+ cairo_reset_clip(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::clip()
{
- cairo_clip(m_cobject);
+ cairo_clip(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::clip_preserve()
{
- cairo_clip_preserve(m_cobject);
+ cairo_clip_preserve(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::get_clip_extents(double& x1, double& y1, double& x2, double& y2) const
{
- cairo_clip_extents(const_cast<cairo_t*>(m_cobject), &x1, &y1, &x2, &y2);
+ cairo_clip_extents(const_cast<cairo_t*>(const_cast<cobject*>(cobj())), &x1, &y1, &x2, &y2);
check_object_status_and_throw_exception(*this);
}
@@ -432,7 +432,7 @@ void Context::copy_clip_rectangle_list(std::vector<Rectangle>& rectangles) const
cairo_rectangle_list_t* c_list = 0;
// It would be nice if the cairo interface didn't copy it into a C array first
// and just let us do the copying...
- c_list = cairo_copy_clip_rectangle_list(const_cast<cairo_t*>(m_cobject));
+ c_list = cairo_copy_clip_rectangle_list(const_cast<cairo_t*>(const_cast<cobject*>(cobj())));
// the rectangle list contains a status field that we need to check and the
// cairo context also has a status that we need to check
// FIXME: do we want to throw an exception if the clip can't be represented by
@@ -449,7 +449,7 @@ void Context::copy_clip_rectangle_list(std::vector<Rectangle>& rectangles) const
void Context::select_font_face(const std::string& family, FontSlant slant, FontWeight weight)
{
- cairo_select_font_face(m_cobject, family.c_str(),
+ cairo_select_font_face(cobj(), family.c_str(),
static_cast<cairo_font_slant_t>(slant),
static_cast<cairo_font_weight_t>(weight));
check_object_status_and_throw_exception(*this);
@@ -457,31 +457,31 @@ void Context::select_font_face(const std::string& family, FontSlant slant, FontW
void Context::set_font_size(double size)
{
- cairo_set_font_size(m_cobject, size);
+ cairo_set_font_size(cobj(), size);
check_object_status_and_throw_exception(*this);
}
void Context::set_font_matrix(const Matrix& matrix)
{
- cairo_set_font_matrix(m_cobject, &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(m_cobject, &matrix);
+ 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(m_cobject, options.cobj());
+ cairo_set_font_options(cobj(), options.cobj());
check_object_status_and_throw_exception(*this);
}
void Context::get_font_options(FontOptions& options) const
{
- cairo_get_font_options(m_cobject, options.cobj());
+ cairo_get_font_options(const_cast<cobject*>(cobj()), options.cobj());
check_object_status_and_throw_exception(*this);
}
@@ -500,7 +500,7 @@ RefPtr<ScaledFont> Context::get_scaled_font()
void Context::show_text(const std::string& utf8)
{
- cairo_show_text(m_cobject, utf8.c_str());
+ cairo_show_text(cobj(), utf8.c_str());
check_object_status_and_throw_exception(*this);
}
@@ -525,63 +525,66 @@ void Context::show_text_glyphs(const std::string& utf8,
void Context::show_glyphs(const std::vector<Glyph>& glyphs)
{
- cairo_show_glyphs(m_cobject, const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size());
+ cairo_show_glyphs(cobj(), const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size());
check_object_status_and_throw_exception(*this);
}
RefPtr<FontFace> Context::get_font_face()
{
- cairo_font_face_t* cfontface = cairo_get_font_face(m_cobject);
+ cairo_font_face_t* cfontface = cairo_get_font_face(cobj());
check_object_status_and_throw_exception(*this);
return RefPtr<FontFace>(new FontFace(cfontface, false /* does not have reference */));
}
RefPtr<const FontFace> Context::get_font_face() const
{
- cairo_font_face_t* cfontface = cairo_get_font_face(m_cobject);
+ cairo_font_face_t* cfontface = cairo_get_font_face(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return RefPtr<const FontFace>(new FontFace(cfontface, false /* does not have reference */));
}
void Context::get_font_extents(FontExtents& extents) const
{
- cairo_font_extents(m_cobject, &extents);
+ cairo_font_extents(const_cast<cobject*>(cobj()), &extents);
check_object_status_and_throw_exception(*this);
}
void Context::set_font_face(const RefPtr<const FontFace>& font_face)
{
- cairo_set_font_face(m_cobject, const_cast<cairo_font_face_t*>(font_face->cobj()));
+ cairo_set_font_face(cobj(), const_cast<cairo_font_face_t*>(font_face->cobj()));
check_object_status_and_throw_exception(*this);
}
void Context::get_text_extents(const std::string& utf8, TextExtents& extents) const
{
- cairo_text_extents(m_cobject, utf8.c_str(), &extents);
+ cairo_text_extents(const_cast<cobject*>(cobj()), utf8.c_str(), &extents);
check_object_status_and_throw_exception(*this);
}
void Context::get_glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& extents) const
{
- cairo_glyph_extents(m_cobject, const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size(), &extents);
+ cairo_glyph_extents(const_cast<cobject*>(cobj()),
+ const_cast<cairo_glyph_t*>(&glyphs[0]),
+ glyphs.size(), &extents);
check_object_status_and_throw_exception(*this);
}
void Context::text_path(const std::string& utf8)
{
- cairo_text_path(m_cobject, utf8.c_str());
+ cairo_text_path(cobj(), utf8.c_str());
check_object_status_and_throw_exception(*this);
}
void Context::glyph_path(const std::vector<Glyph>& glyphs)
{
- cairo_glyph_path(m_cobject, const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size());
+ cairo_glyph_path(cobj(), const_cast<cairo_glyph_t*>(&glyphs[0]), glyphs.size());
check_object_status_and_throw_exception(*this);
}
Operator Context::get_operator() const
{
- const Operator result = static_cast<Operator>(cairo_get_operator(m_cobject));
+ const Operator result =
+ static_cast<Operator>(cairo_get_operator(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -610,74 +613,74 @@ static RefPtr<Pattern> get_pattern_wrapper (cairo_pattern_t* pattern)
RefPtr<Pattern> Context::get_source()
{
- cairo_pattern_t* pattern = cairo_get_source(m_cobject);
+ cairo_pattern_t* pattern = cairo_get_source(cobj());
check_object_status_and_throw_exception(*this);
return get_pattern_wrapper (pattern);
}
RefPtr<const Pattern> Context::get_source() const
{
- cairo_pattern_t* pattern = cairo_get_source(m_cobject);
+ cairo_pattern_t* pattern = cairo_get_source(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return RefPtr<const Pattern>::cast_const (get_pattern_wrapper (pattern));
}
double Context::get_tolerance() const
{
- const double result = cairo_get_tolerance(m_cobject);
+ const double result = cairo_get_tolerance(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
Antialias Context::get_antialias() const
{
- const Antialias result = static_cast<Antialias>(cairo_get_antialias(m_cobject));
+ const Antialias result = static_cast<Antialias>(cairo_get_antialias(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
bool Context::has_current_point() const
{
- return cairo_has_current_point(m_cobject);
+ return cairo_has_current_point(const_cast<cobject*>(cobj()));
}
void Context::get_current_point(double& x, double& y) const
{
- cairo_get_current_point(m_cobject, &x, &y);
+ cairo_get_current_point(const_cast<cobject*>(cobj()), &x, &y);
check_object_status_and_throw_exception(*this);
}
FillRule Context::get_fill_rule() const
{
- const FillRule result = static_cast<FillRule>(cairo_get_fill_rule(m_cobject));
+ const FillRule result = static_cast<FillRule>(cairo_get_fill_rule(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
double Context::get_line_width() const
{
- const double result = cairo_get_line_width(m_cobject);
+ const double result = cairo_get_line_width(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
LineCap Context::get_line_cap() const
{
- const LineCap result = static_cast<LineCap>(cairo_get_line_cap(m_cobject));
+ const LineCap result = static_cast<LineCap>(cairo_get_line_cap(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
LineJoin Context::get_line_join() const
{
- const LineJoin result = static_cast<LineJoin>(cairo_get_line_join(m_cobject));
+ const LineJoin result = static_cast<LineJoin>(cairo_get_line_join(const_cast<cobject*>(cobj())));
check_object_status_and_throw_exception(*this);
return result;
}
double Context::get_miter_limit() const
{
- const double result = cairo_get_miter_limit(m_cobject);
+ const double result = cairo_get_miter_limit(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
@@ -688,9 +691,9 @@ Context::get_dash(std::vector<double>& dashes, double& offset) const
// Allocate this array dynamically because some compilers complain about
// allocating arrays on the stack when the array size isn't a compile-time
// constant...
- const int cnt = cairo_get_dash_count(m_cobject);
+ const int cnt = cairo_get_dash_count(const_cast<cobject*>(cobj()));
double* dash_array = new double[cnt];
- cairo_get_dash(const_cast<cairo_t*>(m_cobject), dash_array, &offset);
+ cairo_get_dash(const_cast<cairo_t*>(cobj()), dash_array, &offset);
check_object_status_and_throw_exception(*this);
dashes.assign(dash_array, dash_array + cnt);
delete[] dash_array;
@@ -698,7 +701,7 @@ Context::get_dash(std::vector<double>& dashes, double& offset) const
void Context::get_matrix(Matrix& matrix)
{
- cairo_get_matrix(m_cobject, &matrix);
+ cairo_get_matrix(cobj(), &matrix);
check_object_status_and_throw_exception(*this);
}
@@ -758,73 +761,73 @@ RefPtr<Surface> get_surface_wrapper (cairo_surface_t* surface)
RefPtr<Surface> Context::get_target()
{
- cairo_surface_t* surface = cairo_get_target(const_cast<cairo_t*>(m_cobject));
+ cairo_surface_t* surface = cairo_get_target(const_cast<cairo_t*>(cobj()));
check_object_status_and_throw_exception(*this);
return get_surface_wrapper (surface);
}
RefPtr<const Surface> Context::get_target() const
{
- cairo_surface_t* surface = cairo_get_target(const_cast<cairo_t*>(m_cobject));
+ cairo_surface_t* surface = cairo_get_target(const_cast<cairo_t*>(cobj()));
check_object_status_and_throw_exception(*this);
return RefPtr<const Surface>::cast_const (get_surface_wrapper (surface));
}
Path* Context::copy_path() const
{
- cairo_path_t* cresult = cairo_copy_path(const_cast<cairo_t*>(m_cobject));
+ cairo_path_t* cresult = cairo_copy_path(const_cast<cairo_t*>(cobj()));
check_object_status_and_throw_exception(*this);
return new Path(cresult, true /* take ownership */); //The caller must delete it.
}
void Context::get_path_extents(double& x1, double& y1, double& x2, double& y2) const
{
- cairo_path_extents(m_cobject, &x1, &y1, &x2, &y2);
+ cairo_path_extents(const_cast<cobject*>(cobj()), &x1, &y1, &x2, &y2);
check_object_status_and_throw_exception(*this);
}
Path* Context::copy_path_flat() const
{
- cairo_path_t* cresult = cairo_copy_path_flat(const_cast<cairo_t*>(m_cobject));
+ cairo_path_t* cresult = cairo_copy_path_flat(const_cast<cairo_t*>(cobj()));
check_object_status_and_throw_exception(*this);
return new Path(cresult, true /* take ownership */); //The caller must delete it.
}
void Context::append_path(const Path& path)
{
- cairo_append_path(m_cobject, const_cast<cairo_path_t*>(path.cobj()));
+ cairo_append_path(cobj(), const_cast<cairo_path_t*>(path.cobj()));
check_object_status_and_throw_exception(*this);
}
void Context::push_group()
{
- cairo_push_group(m_cobject);
+ cairo_push_group(cobj());
check_object_status_and_throw_exception(*this);
}
void Context::push_group_with_content(Content content)
{
- cairo_push_group_with_content(m_cobject, static_cast<cairo_content_t>(content));
+ cairo_push_group_with_content(cobj(), static_cast<cairo_content_t>(content));
check_object_status_and_throw_exception(*this);
}
RefPtr<Pattern> Context::pop_group()
{
- cairo_pattern_t* pattern = cairo_pop_group(m_cobject);
+ cairo_pattern_t* pattern = cairo_pop_group(cobj());
check_object_status_and_throw_exception(*this);
return get_pattern_wrapper(pattern);
}
void Context::pop_group_to_source()
{
- cairo_pop_group_to_source(m_cobject);
+ cairo_pop_group_to_source(cobj());
check_object_status_and_throw_exception(*this);
}
RefPtr<Surface> Context::get_group_target()
{
- cairo_surface_t* surface = cairo_get_group_target(m_cobject);
+ cairo_surface_t* surface = cairo_get_group_target(cobj());
// surface can be NULL if you're not between push/pop group calls
if(!surface)
{
@@ -837,7 +840,7 @@ RefPtr<Surface> Context::get_group_target()
RefPtr<const Surface> Context::get_group_target() const
{
- cairo_surface_t* surface = cairo_get_group_target(m_cobject);
+ cairo_surface_t* surface = cairo_get_group_target(const_cast<cobject*>(cobj()));
// surface can be NULL if you're not between push/pop group calls
if(!surface)
{
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index abcf49a..dba1df7 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -85,14 +85,14 @@ Surface::~Surface()
void Surface::finish()
{
- cairo_surface_finish(m_cobject);
+ cairo_surface_finish(cobj());
check_object_status_and_throw_exception(*this);
}
void Surface::get_font_options(FontOptions& options) const
{
cairo_font_options_t* cfontoptions = cairo_font_options_create();
- cairo_surface_get_font_options(m_cobject, cfontoptions);
+ cairo_surface_get_font_options(const_cast<cobject*>(cobj()), cfontoptions);
options = FontOptions(cfontoptions);
cairo_font_options_destroy(cfontoptions);
check_object_status_and_throw_exception(*this);
@@ -100,36 +100,36 @@ void Surface::get_font_options(FontOptions& options) const
void Surface::flush()
{
- cairo_surface_flush(m_cobject);
+ cairo_surface_flush(cobj());
check_object_status_and_throw_exception(*this);
}
void Surface::mark_dirty()
{
- cairo_surface_mark_dirty(m_cobject);
+ cairo_surface_mark_dirty(cobj());
check_object_status_and_throw_exception(*this);
}
void Surface::mark_dirty(int x, int y, int width, int height)
{
- cairo_surface_mark_dirty_rectangle(m_cobject, x, y, width, height);
+ cairo_surface_mark_dirty_rectangle(cobj(), x, y, width, height);
check_object_status_and_throw_exception(*this);
}
void Surface::set_device_offset(double x_offset, double y_offset)
{
- cairo_surface_set_device_offset(m_cobject, x_offset, y_offset);
+ cairo_surface_set_device_offset(cobj(), x_offset, y_offset);
check_object_status_and_throw_exception(*this);
}
void Surface::get_device_offset(double& x_offset, double& y_offset) const
{
- cairo_surface_get_device_offset(const_cast<cobject*>(m_cobject), &x_offset, &y_offset);
+ cairo_surface_get_device_offset(const_cast<cobject*>(cobj()), &x_offset, &y_offset);
}
void Surface::set_fallback_resolution(double x_pixels_per_inch, double y_pixels_per_inch)
{
- cairo_surface_set_fallback_resolution(m_cobject, x_pixels_per_inch, y_pixels_per_inch);
+ cairo_surface_set_fallback_resolution(cobj(), x_pixels_per_inch, y_pixels_per_inch);
check_object_status_and_throw_exception(*this);
}
@@ -144,7 +144,8 @@ void Surface::get_fallback_resolution(double& x_pixels_per_inch,
SurfaceType Surface::get_type() const
{
- cairo_surface_type_t surface_type = cairo_surface_get_type(m_cobject);
+ cairo_surface_type_t surface_type =
+ cairo_surface_get_type(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return static_cast<SurfaceType>(surface_type);
}
@@ -158,31 +159,31 @@ Content Surface::get_content() const
void Surface::copy_page()
{
- cairo_surface_copy_page(m_cobject);
+ cairo_surface_copy_page(cobj());
check_object_status_and_throw_exception(*this);
}
void Surface::show_page()
{
- cairo_surface_show_page(m_cobject);
+ cairo_surface_show_page(cobj());
check_object_status_and_throw_exception(*this);
}
#ifdef CAIRO_HAS_PNG_FUNCTIONS
void Surface::write_to_png(const std::string& filename)
{
- ErrorStatus status = cairo_surface_write_to_png(m_cobject, filename.c_str());
+ ErrorStatus status = cairo_surface_write_to_png(cobj(), filename.c_str());
check_status_and_throw_exception(status);
}
void Surface::write_to_png_stream(const SlotWriteFunc& write_func)
{
- SlotWriteFunc* old_slot = get_slot(m_cobject);
+ SlotWriteFunc* old_slot = get_slot(cobj());
if (old_slot)
delete old_slot;
SlotWriteFunc* slot_copy = new SlotWriteFunc(write_func);
- set_write_slot(m_cobject, slot_copy);
- ErrorStatus status = cairo_surface_write_to_png_stream(m_cobject,
+ set_write_slot(cobj(), slot_copy);
+ ErrorStatus status = cairo_surface_write_to_png_stream(cobj(),
&write_func_wrapper,
slot_copy /*closure*/);
check_status_and_throw_exception(status);
@@ -190,24 +191,24 @@ void Surface::write_to_png_stream(const SlotWriteFunc& write_func)
void Surface::write_to_png(cairo_write_func_t write_func, void *closure)
{
- ErrorStatus status = cairo_surface_write_to_png_stream(m_cobject, write_func, closure);
+ ErrorStatus status = cairo_surface_write_to_png_stream(cobj(), write_func, closure);
check_status_and_throw_exception(status);
}
#endif
void Surface::reference() const
{
- cairo_surface_reference(m_cobject);
+ cairo_surface_reference(const_cast<cobject*>(cobj()));
}
void Surface::unreference() const
{
- cairo_surface_destroy(m_cobject);
+ cairo_surface_destroy(const_cast<cobject*>(cobj()));
}
RefPtr<Surface> Surface::create(const RefPtr<Surface> other, Content content, int width, int height)
{
- cairo_surface_t* cobject = cairo_surface_create_similar(other->m_cobject, (cairo_content_t)content, width, height);
+ cairo_surface_t* cobject = cairo_surface_create_similar(other->cobj(), (cairo_content_t)content, width, height);
check_status_and_throw_exception(cairo_surface_status(cobject));
return RefPtr<Surface>(new Surface(cobject, true /* has reference */));
}
@@ -267,36 +268,38 @@ RefPtr<ImageSurface> ImageSurface::create_from_png(cairo_read_func_t read_func,
int ImageSurface::get_width() const
{
- const int result = cairo_image_surface_get_width(m_cobject);
+ const int result =
+ cairo_image_surface_get_width(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
int ImageSurface::get_height() const
{
- const int result = cairo_image_surface_get_height(m_cobject);
+ const int result =
+ cairo_image_surface_get_height(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
return result;
}
unsigned char* ImageSurface::get_data()
{
- return cairo_image_surface_get_data(m_cobject);
+ return cairo_image_surface_get_data(cobj());
}
const unsigned char* ImageSurface::get_data() const
{
- return cairo_image_surface_get_data(m_cobject);
+ return cairo_image_surface_get_data(const_cast<cobject*>(cobj()));
}
Format ImageSurface::get_format() const
{
- return static_cast<Format>(cairo_image_surface_get_format(m_cobject));
+ return static_cast<Format>(cairo_image_surface_get_format(const_cast<cobject*>(cobj())));
}
int ImageSurface::get_stride() const
{
- return cairo_image_surface_get_stride(m_cobject);
+ return cairo_image_surface_get_stride(const_cast<cobject*>(cobj()));
}
int ImageSurface::format_stride_for_width (Cairo::Format format, int width)
@@ -348,7 +351,7 @@ RefPtr<PdfSurface> PdfSurface::create_for_stream(const SlotWriteFunc& write_func
void PdfSurface::set_size(double width_in_points, double height_in_points)
{
- cairo_pdf_surface_set_size(m_cobject, width_in_points, height_in_points);
+ cairo_pdf_surface_set_size(cobj(), width_in_points, height_in_points);
check_object_status_and_throw_exception(*this);
}
@@ -396,26 +399,26 @@ RefPtr<PsSurface> PsSurface::create(cairo_write_func_t write_func, void *closure
void PsSurface::set_size(double width_in_points, double height_in_points)
{
- cairo_ps_surface_set_size(m_cobject, width_in_points, height_in_points);
+ cairo_ps_surface_set_size(cobj(), width_in_points, height_in_points);
check_object_status_and_throw_exception(*this);
}
void PsSurface::dsc_comment(std::string comment)
{
- cairo_ps_surface_dsc_comment(m_cobject, comment.c_str());
+ cairo_ps_surface_dsc_comment(cobj(), comment.c_str());
check_object_status_and_throw_exception(*this);
}
void PsSurface::dsc_begin_setup()
{
- cairo_ps_surface_dsc_begin_setup(m_cobject);
+ cairo_ps_surface_dsc_begin_setup(cobj());
check_object_status_and_throw_exception(*this);
}
void PsSurface::dsc_begin_page_setup()
{
- cairo_ps_surface_dsc_begin_page_setup(m_cobject);
+ cairo_ps_surface_dsc_begin_page_setup(cobj());
check_object_status_and_throw_exception(*this);
}
@@ -428,13 +431,13 @@ bool PsSurface::get_eps() const
void PsSurface::set_eps(bool eps)
{
- cairo_ps_surface_set_eps(m_cobject, eps);
+ cairo_ps_surface_set_eps(cobj(), eps);
check_object_status_and_throw_exception(*this);
}
void PsSurface::restrict_to_level(PsLevel level)
{
- cairo_ps_surface_restrict_to_level(m_cobject, static_cast<cairo_ps_level_t>(level));
+ cairo_ps_surface_restrict_to_level(cobj(), static_cast<cairo_ps_level_t>(level));
check_object_status_and_throw_exception(*this);
}
@@ -505,7 +508,7 @@ RefPtr<SvgSurface> SvgSurface::create(cairo_write_func_t write_func, void *closu
void SvgSurface::restrict_to_version(SvgVersion version)
{
- cairo_svg_surface_restrict_to_version(m_cobject, static_cast<cairo_svg_version_t>(version));
+ cairo_svg_surface_restrict_to_version(cobj(), static_cast<cairo_svg_version_t>(version));
check_object_status_and_throw_exception(*this);
}