summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2005-12-07 14:41:10 +0000
committerMurray Cumming <murrayc@murrayc.com>2005-12-07 14:41:10 +0000
commit519637621e86438a8e3bf811e9954f49787f8a22 (patch)
tree8fc7b06c659f3204588baec08916f3310956decf
parent135df807290e519eb7cf92690413acc587f4f4d2 (diff)
2005-12-07 Murray Cumming <murrayc@murrayc.com>
* cairomm/context.cc: * cairomm/fontoptions.cc: * cairomm/surface.cc: Check for errors in constructors, as per the error-handling advice in the language bindings section of the cairo documentation.
-rw-r--r--ChangeLog8
-rw-r--r--cairomm/context.cc1
-rw-r--r--cairomm/fontoptions.cc5
-rw-r--r--cairomm/surface.cc6
4 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8535450..b1a54f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
2005-12-07 Murray Cumming <murrayc@murrayc.com>
* cairomm/context.cc:
+ * cairomm/fontoptions.cc:
+ * cairomm/surface.cc: Check for errors in
+ constructors, as per the error-handling advice in the
+ language bindings section of the cairo documentation.
+
+2005-12-07 Murray Cumming <murrayc@murrayc.com>
+
+ * cairomm/context.cc:
* cairomm/context.h: Change mask_surface() to
mask() and set_source_surface() to set_source(),
as per the method overloading advice in the
diff --git a/cairomm/context.cc b/cairomm/context.cc
index 7e46e43..faeaeb4 100644
--- a/cairomm/context.cc
+++ b/cairomm/context.cc
@@ -25,6 +25,7 @@ Context::Context(Surface& target)
: m_cobject(0)
{
m_cobject = cairo_create(target.cobj());
+ check_object_status_and_throw_exception(*this);
}
Context::Context(cairo_t* cobject, bool has_reference)
diff --git a/cairomm/fontoptions.cc b/cairomm/fontoptions.cc
index 006e6d6..45e22a9 100644
--- a/cairomm/fontoptions.cc
+++ b/cairomm/fontoptions.cc
@@ -25,6 +25,7 @@ FontOptions::FontOptions()
: m_cobject(0)
{
m_cobject = cairo_font_options_create();
+ check_object_status_and_throw_exception(*this);
}
FontOptions::FontOptions(cairo_font_options_t* cobject, bool take_ownership)
@@ -34,6 +35,8 @@ FontOptions::FontOptions(cairo_font_options_t* cobject, bool take_ownership)
m_cobject = cobject;
else
m_cobject = cairo_font_options_copy(cobject);
+
+ check_object_status_and_throw_exception(*this);
}
FontOptions::FontOptions(const FontOptions& src)
@@ -43,6 +46,8 @@ FontOptions::FontOptions(const FontOptions& src)
m_cobject = 0;
else
m_cobject = cairo_font_options_copy(src.m_cobject);
+
+ check_object_status_and_throw_exception(*this);
}
FontOptions::~FontOptions()
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index 4cdeb57..e2194b0 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -73,21 +73,21 @@ Surface& Surface::operator=(const Surface& src)
Surface Surface::create(Format format, int width, int height)
{
cairo_surface_t* cobject = cairo_image_surface_create((cairo_format_t)format, width, height);
- //Not possible with a static method: check_object_status_and_throw_exception(*this);
+ check_status_and_throw_exception(cairo_surface_status(cobject));
return Surface(cobject, true /* has reference */);
}
Surface Surface::create(unsigned char* data, Format format, int width, int height, int stride)
{
cairo_surface_t* cobject = cairo_image_surface_create_for_data(data, (cairo_format_t)format, width, height, stride);
- //Not possible with a static method: check_object_status_and_throw_exception(*this);
+ check_status_and_throw_exception(cairo_surface_status(cobject));
return Surface(cobject, true /* has reference */);
}
Surface Surface::create(const 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);
- //Not possible with a static method: check_object_status_and_throw_exception(*this);
+ check_status_and_throw_exception(cairo_surface_status(cobject));
return Surface(cobject, true /* has reference */);
}