[cairo-commit] rcairo/src rb_cairo_constants.c, 1.2,
1.3 rb_cairo_context.c, 1.9, 1.10 rb_cairo_font_extents.c, 1.2,
1.3 rb_cairo_font_face.c, 1.1, 1.2 rb_cairo_font_options.c,
1.1, 1.2 rb_cairo_glyph.c, 1.2, 1.3 rb_cairo_matrix.c, 1.1,
1.2 rb_cairo_path.c, 1.4, 1.5 rb_cairo_pattern.c, 1.6,
1.7 rb_cairo_private.c, 1.2, 1.3 rb_cairo_private.h, 1.2,
1.3 rb_cairo_scaled_font.c, 1.1, 1.2 rb_cairo_surface.c, 1.3,
1.4 rb_cairo_text_extents.c, 1.1, 1.2
Kouhei Sutou
commit at pdx.freedesktop.org
Wed May 2 19:47:49 PDT 2007
Committed by: kou
Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv25724/src
Modified Files:
rb_cairo_constants.c rb_cairo_context.c
rb_cairo_font_extents.c rb_cairo_font_face.c
rb_cairo_font_options.c rb_cairo_glyph.c rb_cairo_matrix.c
rb_cairo_path.c rb_cairo_pattern.c rb_cairo_private.c
rb_cairo_private.h rb_cairo_scaled_font.c rb_cairo_surface.c
rb_cairo_text_extents.c
Log Message:
* src/rb_cairo_private.h
(CBOOL2RVAL, RVAL2CBOOL): added.
(rb_cairo__is_kind_of): added.
* src/*.c: used rb_cairo__is_kind_of() instead of
RTEST(rb_obj_is_kind_of(...)).
Index: rb_cairo_constants.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_constants.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rb_cairo_constants.c 1 May 2007 11:49:43 -0000 1.2
+++ rb_cairo_constants.c 3 May 2007 02:47:39 -0000 1.3
@@ -70,7 +70,7 @@
{ \
cairo_ ## name ## _t name; \
\
- if (!rb_obj_is_kind_of (rb_ ## name, rb_cNumeric)) \
+ if (!rb_cairo__is_kind_of (rb_ ## name, rb_cNumeric)) \
rb_ ## name = rb_cairo__const_get (rb_ ## name, \
# const_name "_"); \
\
Index: rb_cairo_context.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- rb_cairo_context.c 1 May 2007 12:03:21 -0000 1.9
+++ rb_cairo_context.c 3 May 2007 02:47:39 -0000 1.10
@@ -52,7 +52,7 @@
rb_cairo_context_from_ruby_object (VALUE obj)
{
cairo_t *context;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_Context)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_Context))
{
rb_raise (rb_eTypeError, "not a cairo graphics context");
}
@@ -146,7 +146,7 @@
{
VALUE to_source;
rb_scan_args (argc, argv, "01", &to_source);
- if (RTEST(to_source))
+ if (RVAL2CBOOL (to_source))
return cr_pop_group_to_source (self);
else
return cr_pop_group (self);
@@ -175,7 +175,7 @@
result = rb_protect (rb_yield, self, &state);
if (cairo_status(_SELF) == CAIRO_STATUS_SUCCESS)
{
- if (RTEST (pop_to_source))
+ if (RVAL2CBOOL (pop_to_source))
cr_pop_group_to_source (self);
else
result = cr_pop_group (self);
@@ -206,7 +206,7 @@
n = rb_scan_args (argc, argv, "12", &red, &green, &blue);
- if (n == 1 && RTEST (rb_obj_is_kind_of (red, rb_cArray)))
+ if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray))
{
VALUE ary = red;
n = RARRAY (ary)->len;
@@ -244,7 +244,7 @@
n = rb_scan_args (argc, argv, "13", &red, &green, &blue, &alpha);
- if (n == 1 && RTEST (rb_obj_is_kind_of (red, rb_cArray)))
+ if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray))
{
VALUE ary = red;
n = RARRAY (ary)->len;
@@ -316,7 +316,7 @@
n = rb_scan_args (argc, argv, "13", &arg1, &arg2, &arg3, &arg4);
- if (n == 1 && RTEST (rb_obj_is_kind_of (arg1, rb_cArray)))
+ if (n == 1 && rb_cairo__is_kind_of (arg1, rb_cArray))
{
return cr_set_source_rgba (argc, argv, self);
}
@@ -324,7 +324,7 @@
{
return cr_set_source (self, arg1);
}
- else if (n == 3 && rb_obj_is_kind_of (arg1, rb_cCairo_Surface))
+ else if (n == 3 && rb_cairo__is_kind_of (arg1, rb_cCairo_Surface))
{
return cr_set_source_surface (self, arg1, arg2, arg3);
}
@@ -815,7 +815,7 @@
rb_yield (self);
}
- if (RTEST (preserve))
+ if (RVAL2CBOOL (preserve))
cairo_stroke_preserve (_SELF);
else
cairo_stroke (_SELF);
@@ -837,7 +837,7 @@
rb_yield (self);
}
- if (RTEST (preserve))
+ if (RVAL2CBOOL (preserve))
cairo_fill_preserve (_SELF);
else
cairo_fill (_SELF);
@@ -872,7 +872,7 @@
cr_new_path (self);
rb_yield (self);
}
- return cairo_in_stroke (_SELF, NUM2DBL (x), NUM2DBL (y)) ? Qtrue : Qfalse;
+ return CBOOL2RVAL (cairo_in_stroke (_SELF, NUM2DBL (x), NUM2DBL (y)));
}
static VALUE
@@ -883,7 +883,7 @@
cr_new_path (self);
rb_yield (self);
}
- return cairo_in_fill (_SELF, NUM2DBL (x), NUM2DBL (y)) ? Qtrue : Qfalse;
+ return CBOOL2RVAL (cairo_in_fill (_SELF, NUM2DBL (x), NUM2DBL (y)));
}
/* Rectangular extents */
@@ -935,7 +935,7 @@
rb_yield (self);
}
- if (RTEST (preserve))
+ if (RVAL2CBOOL (preserve))
cairo_clip_preserve(_SELF);
else
cairo_clip (_SELF);
@@ -1082,7 +1082,7 @@
int count;
cairo_glyph_t *glyphs;
- if (!rb_obj_is_kind_of (rb_glyphs, rb_cArray))
+ if (!rb_cairo__is_kind_of (rb_glyphs, rb_cArray))
rb_raise (rb_eTypeError, "expected array");
rb_cairo__glyphs_to_array (rb_glyphs, &glyphs, &count);
Index: rb_cairo_font_extents.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_font_extents.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rb_cairo_font_extents.c 1 May 2007 12:03:21 -0000 1.2
+++ rb_cairo_font_extents.c 3 May 2007 02:47:39 -0000 1.3
@@ -13,6 +13,7 @@
*/
#include "rb_cairo.h"
+#include "rb_cairo_private.h"
VALUE rb_cCairo_FontExtents;
@@ -22,7 +23,7 @@
rb_cairo_font_extents_from_ruby_object (VALUE obj)
{
cairo_font_extents_t *extents;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_FontExtents)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontExtents))
{
rb_raise (rb_eTypeError, "not a cairo font extents");
}
Index: rb_cairo_font_face.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_font_face.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rb_cairo_font_face.c 6 Mar 2007 12:17:34 -0000 1.1
+++ rb_cairo_font_face.c 3 May 2007 02:47:39 -0000 1.2
@@ -14,6 +14,7 @@
#include "rb_cairo.h"
+#include "rb_cairo_private.h"
VALUE rb_cCairo_FontFace;
@@ -23,7 +24,7 @@
rb_cairo_font_face_from_ruby_object (VALUE obj)
{
cairo_font_face_t *face;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_FontFace)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontFace))
{
rb_raise (rb_eTypeError, "not a cairo font face");
}
Index: rb_cairo_font_options.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_font_options.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rb_cairo_font_options.c 6 Mar 2007 12:17:34 -0000 1.1
+++ rb_cairo_font_options.c 3 May 2007 02:47:39 -0000 1.2
@@ -12,6 +12,7 @@
*/
#include "rb_cairo.h"
+#include "rb_cairo_private.h"
#define _SELF(self) (RVAL2CRFONTOPTIONS(self))
@@ -27,7 +28,7 @@
rb_cairo_font_options_from_ruby_object (VALUE obj)
{
cairo_font_options_t *options;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_FontOptions)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontOptions))
{
rb_raise (rb_eTypeError, "not a cairo font options");
}
@@ -95,7 +96,7 @@
static VALUE
cr_options_equal (VALUE self, VALUE other)
{
- return cairo_font_options_equal (_SELF (self), _SELF (other)) ? Qtrue : Qfalse;
+ return CBOOL2RVAL (cairo_font_options_equal (_SELF (self), _SELF (other)));
}
static VALUE
Index: rb_cairo_glyph.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_glyph.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rb_cairo_glyph.c 1 May 2007 12:03:21 -0000 1.2
+++ rb_cairo_glyph.c 3 May 2007 02:47:39 -0000 1.3
@@ -14,6 +14,7 @@
#include "rb_cairo.h"
+#include "rb_cairo_private.h"
VALUE rb_cCairo_Glyph;
@@ -23,7 +24,7 @@
rb_cairo_glyph_from_ruby_object (VALUE obj)
{
cairo_glyph_t *glyph;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_Glyph)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_Glyph))
{
rb_raise (rb_eTypeError, "not a cairo glyph");
}
Index: rb_cairo_matrix.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_matrix.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rb_cairo_matrix.c 6 Mar 2007 12:17:34 -0000 1.1
+++ rb_cairo_matrix.c 3 May 2007 02:47:39 -0000 1.2
@@ -24,7 +24,7 @@
rb_cairo_matrix_from_ruby_object (VALUE obj)
{
cairo_matrix_t *matrix;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_Matrix)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_Matrix))
{
rb_raise (rb_eTypeError, "not a cairo matrix");
}
Index: rb_cairo_path.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_path.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rb_cairo_path.c 3 May 2007 02:35:42 -0000 1.4
+++ rb_cairo_path.c 3 May 2007 02:47:39 -0000 1.5
@@ -81,7 +81,7 @@
rb_cairo_path_from_ruby_object (VALUE obj)
{
cairo_path_t *path;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_Path)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_Path))
{
rb_raise (rb_eTypeError, "not a cairo path");
}
@@ -136,7 +136,7 @@
{
cairo_path_t *path = _SELF (self);
- return path->num_data == 0 ? Qtrue : Qfalse;
+ return CBOOL2RVAL (path->num_data == 0);
}
static int
Index: rb_cairo_pattern.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_pattern.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- rb_cairo_pattern.c 1 May 2007 13:12:58 -0000 1.6
+++ rb_cairo_pattern.c 3 May 2007 02:47:39 -0000 1.7
@@ -42,7 +42,7 @@
rb_cairo_pattern_from_ruby_object (VALUE obj)
{
cairo_pattern_t *pattern;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_Pattern)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_Pattern))
{
rb_raise (rb_eTypeError, "not a cairo pattern");
}
@@ -106,11 +106,11 @@
VALUE color = red;
color = cr_color_parse (color);
- if (rb_obj_is_kind_of (color, rb_cCairo_Color_Base))
+ if (rb_cairo__is_kind_of (color, rb_cCairo_Color_Base))
red = rb_funcall (rb_funcall (color, id_to_rgb, 0), id_to_a, 0);
}
- if (n == 1 && rb_obj_is_kind_of (red, rb_cArray) &&
+ if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray) &&
(RARRAY (red)->len == 3 || RARRAY (red)->len == 4))
{
VALUE ary = red;
@@ -214,11 +214,11 @@
VALUE color = red;
color = cr_color_parse (color);
- if (rb_obj_is_kind_of (color, rb_cCairo_Color_Base))
+ if (rb_cairo__is_kind_of (color, rb_cCairo_Color_Base))
red = rb_funcall (rb_funcall (color, id_to_rgb, 0), id_to_a, 0);
}
- if (n == 2 && rb_obj_is_kind_of (red, rb_cArray))
+ if (n == 2 && rb_cairo__is_kind_of (red, rb_cArray))
{
VALUE ary = red;
n = RARRAY (ary)->len + 1;
Index: rb_cairo_private.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_private.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rb_cairo_private.c 1 May 2007 11:49:43 -0000 1.2
+++ rb_cairo_private.c 3 May 2007 02:47:39 -0000 1.3
@@ -35,7 +35,7 @@
{
int i;
- if (!rb_obj_is_kind_of (rb_array, rb_cArray))
+ if (!rb_cairo__is_kind_of (rb_array, rb_cArray))
rb_raise (rb_eTypeError, "expected array");
*length = RARRAY(rb_array)->len;
@@ -73,6 +73,13 @@
return rb_const_get (rb_mCairo, rb_intern (const_name));
}
+cairo_bool_t
+rb_cairo__is_kind_of (VALUE object, VALUE klass)
+{
+ return RVAL2CBOOL (rb_obj_is_kind_of (object, klass));
+}
+
+
void
Init_cairo_private (void)
{
Index: rb_cairo_private.h
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_private.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rb_cairo_private.h 1 May 2007 11:49:43 -0000 1.2
+++ rb_cairo_private.h 3 May 2007 02:47:39 -0000 1.3
@@ -20,6 +20,9 @@
#define CSTR2RVAL(str) rb_str_new2(str)
#define RVAL2CSTR(str) StringValueCStr(str)
+#define CBOOL2RVAL(bool) (bool ? Qtrue : Qfalse)
+#define RVAL2CBOOL(bool) RTEST(bool)
+
extern void Init_cairo_private (void);
extern void Init_cairo_constants (void);
@@ -40,5 +43,6 @@
void rb_cairo__glyphs_to_array (VALUE rb_array, cairo_glyph_t **glyphs, int *length);
VALUE rb_cairo__const_get (VALUE name, const char *prefix);
+cairo_bool_t rb_cairo__is_kind_of (VALUE object, VALUE klass);
#endif
Index: rb_cairo_scaled_font.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_scaled_font.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rb_cairo_scaled_font.c 6 Mar 2007 12:17:34 -0000 1.1
+++ rb_cairo_scaled_font.c 3 May 2007 02:47:39 -0000 1.2
@@ -29,7 +29,7 @@
rb_cairo_scaled_font_from_ruby_object (VALUE obj)
{
cairo_scaled_font_t *font;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_ScaledFont)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_ScaledFont))
{
rb_raise (rb_eTypeError, "not a cairo scaled font");
}
Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rb_cairo_surface.c 8 Apr 2007 06:12:50 -0000 1.3
+++ rb_cairo_surface.c 3 May 2007 02:47:39 -0000 1.4
@@ -224,7 +224,7 @@
rb_cairo_surface_from_ruby_object (VALUE obj)
{
cairo_surface_t *surface;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_Surface)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_Surface))
{
rb_raise (rb_eTypeError, "not a cairo surface");
}
Index: rb_cairo_text_extents.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_text_extents.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rb_cairo_text_extents.c 6 Mar 2007 12:17:34 -0000 1.1
+++ rb_cairo_text_extents.c 3 May 2007 02:47:39 -0000 1.2
@@ -13,6 +13,7 @@
*/
#include "rb_cairo.h"
+#include "rb_cairo_private.h"
VALUE rb_cCairo_TextExtents;
@@ -22,7 +23,7 @@
rb_cairo_text_extents_from_ruby_object (VALUE obj)
{
cairo_text_extents_t *extents;
- if (!RTEST (rb_obj_is_kind_of (obj, rb_cCairo_TextExtents)))
+ if (!rb_cairo__is_kind_of (obj, rb_cCairo_TextExtents))
{
rb_raise (rb_eTypeError, "not a cairo text_extents");
}
More information about the cairo-commit
mailing list