[cairo-commit] rcairo/packages/cairo/ext rb_cairo_context.c, 1.6,
1.7 rb_cairo_exception.c, 1.3, 1.4 rb_cairo_exception.h, 1.1,
1.2 rb_cairo_matrix.c, 1.4, 1.5
Oeyvind Kolaas
commit at pdx.freedesktop.org
Thu Sep 8 02:17:01 PDT 2005
Committed by: pippin
Update of /cvs/cairo/rcairo/packages/cairo/ext
In directory gabe:/tmp/cvs-serv16413/packages/cairo/ext
Modified Files:
rb_cairo_context.c rb_cairo_exception.c rb_cairo_exception.h
rb_cairo_matrix.c
Log Message:
patch from Kouhei Sutou
Index: rb_cairo_context.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_context.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- rb_cairo_context.c 23 Jun 2005 09:30:48 -0000 1.6
+++ rb_cairo_context.c 8 Sep 2005 09:16:59 -0000 1.7
@@ -48,7 +48,7 @@
status = cairo_status (context);
if (status)
{
- rb_cairo_raise_exception (status, cairo_status_string (context));
+ rb_cairo_raise_exception (status);
}
}
@@ -770,8 +770,7 @@
if (cairo_status (_SELF))
{
rb_free_font_face (xform);
- rb_cairo_raise_exception (cairo_status (_SELF),
- cairo_status_string (_SELF));
+ rb_cairo_raise_exception (cairo_status (_SELF));
}
return Data_Wrap_Struct (rb_cCairo_FontFace, NULL, rb_free_font_face, xform);
}
@@ -910,8 +909,7 @@
if (cairo_status (_SELF))
{
rb_free_matrix (matrix);
- rb_cairo_raise_exception (cairo_status (_SELF),
- cairo_status_string (_SELF));
+ rb_cairo_raise_exception (cairo_status (_SELF));
}
return rb_cairo_matrix_wrap (matrix);
}
Index: rb_cairo_exception.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_exception.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rb_cairo_exception.c 23 Jun 2005 09:30:48 -0000 1.3
+++ rb_cairo_exception.c 8 Sep 2005 09:16:59 -0000 1.4
@@ -14,7 +14,7 @@
static VALUE rb_eCairo_InvalidRestoreError;
static VALUE rb_eCairo_NoCurrentPointError;
static VALUE rb_eCairo_InvalidMatrixError;
-static VALUE rb_eCairo_NoTargetSurfaceError;
+static VALUE rb_eCairo_InvalidStatusError;
static VALUE rb_eCairo_NullPointerError;
static VALUE rb_eCairo_WriteError;
static VALUE rb_eCairo_SurfaceFinishedError;
@@ -23,11 +23,17 @@
static VALUE rb_eCairo_ReadError;
static VALUE rb_eCairo_SurfaceTypeMismatchError;
static VALUE rb_eCairo_PatternTypeMismatchError;
+static VALUE rb_eCairo_InvalidContentError;
+static VALUE rb_eCairo_InvalidFormatError;
+static VALUE rb_eCairo_InvalidVisualError;
+static VALUE rb_eCairo_FileNotFoundError;
+static VALUE rb_eCairo_InvalidDashError;
void
-rb_cairo_raise_exception (cairo_status_t status,
- const char *string)
+rb_cairo_raise_exception (cairo_status_t status)
{
+ const char *string = cairo_status_to_string (status);
+
switch (status)
{
case CAIRO_STATUS_NO_MEMORY:
@@ -45,8 +51,8 @@
case CAIRO_STATUS_INVALID_MATRIX:
rb_raise (rb_eCairo_InvalidMatrixError, string);
break;
- case CAIRO_STATUS_NO_TARGET_SURFACE:
- rb_raise (rb_eCairo_NoTargetSurfaceError, string);
+ case CAIRO_STATUS_INVALID_STATUS:
+ rb_raise (rb_eCairo_InvalidStatusError, string);
break;
case CAIRO_STATUS_NULL_POINTER:
rb_raise (rb_eCairo_NullPointerError, string);
@@ -72,6 +78,21 @@
case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
rb_raise (rb_eCairo_PatternTypeMismatchError, string);
break;
+ case CAIRO_STATUS_INVALID_CONTENT:
+ rb_raise (rb_eCairo_InvalidContentError, string);
+ break;
+ case CAIRO_STATUS_INVALID_FORMAT:
+ rb_raise (rb_eCairo_InvalidFormatError, string);
+ break;
+ case CAIRO_STATUS_INVALID_VISUAL:
+ rb_raise (rb_eCairo_InvalidVisualError, string);
+ break;
+ case CAIRO_STATUS_FILE_NOT_FOUND:
+ rb_raise (rb_eCairo_FileNotFoundError, string);
+ break;
+ case CAIRO_STATUS_INVALID_DASH:
+ rb_raise (rb_eCairo_InvalidDashError, string);
+ break;
case CAIRO_STATUS_SUCCESS:
break;
}
@@ -92,9 +113,9 @@
rb_eCairo_InvalidMatrixError =
rb_define_class_under (rb_mCairo, "InvalidMatrixError",
rb_eArgError);
- rb_eCairo_NoTargetSurfaceError =
- rb_define_class_under (rb_mCairo, "NoTargetSurfaceError",
- rb_eRuntimeError);
+ rb_eCairo_InvalidStatusError =
+ rb_define_class_under (rb_mCairo, "InvalidStatusError",
+ rb_eArgError);
rb_eCairo_NullPointerError =
rb_define_class_under (rb_mCairo, "NullPointerError",
rb_eTypeError);
@@ -119,4 +140,19 @@
rb_eCairo_PatternTypeMismatchError =
rb_define_class_under (rb_mCairo, "PatternTypeMismatch",
rb_eTypeError);
+ rb_eCairo_InvalidContentError =
+ rb_define_class_under (rb_mCairo, "InvalidContentError",
+ rb_eArgError);
+ rb_eCairo_InvalidFormatError =
+ rb_define_class_under (rb_mCairo, "InvalidFormatError",
+ rb_eArgError);
+ rb_eCairo_InvalidVisualError =
+ rb_define_class_under (rb_mCairo, "InvalidVisualError",
+ rb_eArgError);
+ rb_eCairo_FileNotFoundError =
+ rb_define_class_under (rb_mCairo, "FileNotFound",
+ rb_eRuntimeError);
+ rb_eCairo_InvalidDashError =
+ rb_define_class_under (rb_mCairo, "InvalidDashError",
+ rb_eArgError);
}
Index: rb_cairo_exception.h
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_exception.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rb_cairo_exception.h 8 Feb 2005 01:28:21 -0000 1.1
+++ rb_cairo_exception.h 8 Sep 2005 09:16:59 -0000 1.2
@@ -15,7 +15,6 @@
void Init_cairo_exception ();
-void rb_cairo_raise_exception (cairo_status_t status,
- const char *string);
+void rb_cairo_raise_exception (cairo_status_t status);
#endif
Index: rb_cairo_matrix.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_matrix.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rb_cairo_matrix.c 23 Jun 2005 09:30:48 -0000 1.4
+++ rb_cairo_matrix.c 8 Sep 2005 09:16:59 -0000 1.5
@@ -96,8 +96,12 @@
static VALUE
rb_cairo_matrix_copy (VALUE self, VALUE other)
{
- cairo_matrix_copy (_SELF,
- rb_v_to_cairo_matrix_t (other));
+ cairo_matrix_t *matrix = rb_v_to_cairo_matrix_t (other);
+
+ cairo_matrix_init (_SELF,
+ matrix->xx, matrix->yx,
+ matrix->xy, matrix->yy,
+ matrix->x0, matrix->y0);
return self;
}
@@ -165,7 +169,13 @@
static VALUE
rb_cairo_matrix_invert (VALUE self)
{
- cairo_matrix_invert (_SELF);
+ cairo_status_t status;
+ status = cairo_matrix_invert (_SELF);
+ if (status)
+ {
+ rb_cairo_raise_exception (status);
+ }
+
return self;
}
@@ -226,6 +236,8 @@
RUBY_METHOD_FUNC (rb_cairo_matrix_scale), 2);
rb_define_method (rb_cCairo_Matrix, "rotate!",
RUBY_METHOD_FUNC (rb_cairo_matrix_rotate), 2);
+ rb_define_method (rb_cCairo_Matrix, "invert!",
+ RUBY_METHOD_FUNC (rb_cairo_matrix_invert), 0);
rb_define_method (rb_cCairo_Matrix, "multiply!",
RUBY_METHOD_FUNC (rb_cairo_matrix_multiply), 3);
rb_define_method (rb_cCairo_Matrix, "transform_point",
More information about the cairo-commit
mailing list