[cairo] [PATCH 18/39] [OpenVG] Comment and indentation enhancements.

tardyp at gmail.com tardyp at gmail.com
Fri Jul 10 10:02:20 PDT 2009


From: Øyvind Kolås <pippin at gimp.org>

---
 src/cairo-openvg-surface.c |  141 ++++++++++++++++++++++----------------------
 1 files changed, 70 insertions(+), 71 deletions(-)

diff --git a/src/cairo-openvg-surface.c b/src/cairo-openvg-surface.c
index 9bcf6bb..2419d55 100644
--- a/src/cairo-openvg-surface.c
+++ b/src/cairo-openvg-surface.c
@@ -55,34 +55,34 @@ _cairo_openvg_cairo_matrix_to_openvg (const cairo_matrix_t *src,
 
 
 static cairo_surface_t *
-_cairo_openvg_surface_create_similar (void *asurface,
-                                      cairo_content_t content,
-                                      int width,
-                                      int height)
+_cairo_openvg_surface_create_similar (void            *asurface,
+                                      cairo_content_t  content,
+                                      int              width,
+                                      int              height)
 {
-    return cairo_openvg_surface_create(width, height);
+    return cairo_openvg_surface_create (width, height);
 }
 
 static cairo_status_t
-_cairo_openvg_surface_clone_similar (void *asurface,
-                                  cairo_surface_t *src,
-                                  int sc_x,
-                                  int sc_y,
-                                  int width,
-                                  int height,
-                                  cairo_surface_t **clone_out)
+_cairo_openvg_surface_clone_similar (void             *asurface,
+                                     cairo_surface_t  *src,
+                                     int               sc_x,
+                                     int               sc_y,
+                                     int               width,
+                                     int               height,
+                                     cairo_surface_t **clone_out)
 {
-    *clone_out = cairo_openvg_surface_create(width ,height);
+    *clone_out = cairo_openvg_surface_create (width, height);
     return CAIRO_STATUS_SUCCESS;
 }
 
 #if 0
 static cairo_int_status_t
-_cairo_openvg_surface_intersect_clip_path (void *asurface,
-                                        cairo_path_fixed_t *path,
-                                        cairo_fill_rule_t fill_rule,
-                                        double toleance,
-                                        cairo_antialias_t antialias)
+_cairo_openvg_surface_intersect_clip_path (void               *asurface,
+                                           cairo_path_fixed_t *path,
+                                           cairo_fill_rule_t   fill_rule,
+                                           double              toleance,
+                                           cairo_antialias_t   antialias)
 {
   printf ("intersect clip path\n");
   return CAIRO_STATUS_SUCCESS;
@@ -90,7 +90,7 @@ _cairo_openvg_surface_intersect_clip_path (void *asurface,
 #endif
 
 static cairo_int_status_t
-_cairo_openvg_surface_get_extents (void *asurface,
+_cairo_openvg_surface_get_extents (void                  *asurface,
                                    cairo_rectangle_int_t *extents)
 {
     extents->x = 0;
@@ -102,10 +102,10 @@ _cairo_openvg_surface_get_extents (void *asurface,
 }
 
 static cairo_int_status_t
-_cairo_openvg_surface_mask (void *asurface,
-                         cairo_operator_t op,
-                         cairo_pattern_t *source,
-                         cairo_pattern_t *mask)
+_cairo_openvg_surface_mask (void             *asurface,
+                            cairo_operator_t  op,
+                            cairo_pattern_t  *source,
+                            cairo_pattern_t  *mask)
 {
     printf ("mask\n");
     return CAIRO_STATUS_SUCCESS;
@@ -117,7 +117,8 @@ typedef struct _openvg_stroke {
 } openvg_stroke_t;
 
 static cairo_status_t
-_cairo_path_to_openvg_path_move_to (void *closure, cairo_point_t *point)
+_cairo_path_to_openvg_path_move_to (void          *closure,
+                                    cairo_point_t *point)
 {
   VGubyte seg[1]={VG_MOVE_TO};
   VGfloat data[4];
@@ -137,7 +138,8 @@ _cairo_path_to_openvg_path_move_to (void *closure, cairo_point_t *point)
 }
 
 static cairo_status_t
-_cairo_path_to_openvg_path_line_to (void *closure, cairo_point_t *point)
+_cairo_path_to_openvg_path_line_to (void          *closure,
+                                    cairo_point_t *point)
 {
   VGubyte seg[1]={VG_LINE_TO};
   VGfloat data[4];
@@ -157,9 +159,10 @@ _cairo_path_to_openvg_path_line_to (void *closure, cairo_point_t *point)
 }
 
 static cairo_status_t
-_cairo_path_to_openvg_path_curve_to (void *closure, cairo_point_t *p0,
-                                                    cairo_point_t *p1,
-                                                    cairo_point_t *p2)
+_cairo_path_to_openvg_path_curve_to (void          *closure,
+                                     cairo_point_t *p0,
+                                     cairo_point_t *p1,
+                                     cairo_point_t *p2)
 {
   VGubyte seg[1]={VG_CUBIC_TO};
   VGfloat data[6];
@@ -256,8 +259,8 @@ static VGCapStyle
 _cairo_openvg_cairo_line_cap_to_openvg (cairo_line_cap_t ccap)
 {
     switch (ccap) {
-        case CAIRO_LINE_CAP_BUTT: return VG_CAP_BUTT; break;
-        case CAIRO_LINE_CAP_ROUND: return VG_CAP_ROUND; break;
+        case CAIRO_LINE_CAP_BUTT:   return VG_CAP_BUTT;   break;
+        case CAIRO_LINE_CAP_ROUND:  return VG_CAP_ROUND;  break;
         case CAIRO_LINE_CAP_SQUARE: return VG_CAP_SQUARE; break;
     }
 
@@ -544,15 +547,15 @@ teardown_source (cairo_openvg_surface_t *vgsurface,
 }
 
 static cairo_int_status_t
-_cairo_openvg_surface_stroke (void *asurface,
-                              cairo_operator_t op,
-                              cairo_pattern_t *source,
-                              cairo_path_fixed_t *path,
+_cairo_openvg_surface_stroke (void                 *asurface,
+                              cairo_operator_t      op,
+                              cairo_pattern_t      *source,
+                              cairo_path_fixed_t   *path,
                               cairo_stroke_style_t *style,
-                              cairo_matrix_t *ctm,
-                              cairo_matrix_t *ctm_inverse,
-                              double toleance,
-                              cairo_antialias_t antialias)
+                              cairo_matrix_t       *ctm,
+                              cairo_matrix_t       *ctm_inverse,
+                              double                tolerance,
+                              cairo_antialias_t     antialias)
 {
   cairo_openvg_surface_t *vgsurface = asurface;
   cairo_status_t rv = CAIRO_STATUS_SUCCESS;
@@ -599,13 +602,13 @@ BAIL:
 }
 
 static cairo_int_status_t
-_cairo_openvg_surface_fill (void *asurface,
-                         cairo_operator_t op,
-                         cairo_pattern_t *source,
-                         cairo_path_fixed_t *path,
-                         cairo_fill_rule_t fill_rule,
-                         double toleance,
-                         cairo_antialias_t antialias)
+_cairo_openvg_surface_fill (void               *asurface,
+                            cairo_operator_t    op,
+                            cairo_pattern_t    *source,
+                            cairo_path_fixed_t *path,
+                            cairo_fill_rule_t   fill_rule,
+                            double              tolerance,
+                            cairo_antialias_t   antialias)
 {
   cairo_openvg_surface_t *vgsurface = asurface;
   cairo_status_t rv = CAIRO_STATUS_SUCCESS;
@@ -639,9 +642,9 @@ BAIL:
 }
 
 static cairo_int_status_t
-_cairo_openvg_surface_paint (void *asurface,
-                             cairo_operator_t op,
-                             cairo_pattern_t *source)
+_cairo_openvg_surface_paint (void             *asurface,
+                             cairo_operator_t  op,
+                             cairo_pattern_t  *source)
 {
   cairo_openvg_surface_t *vgsurface = asurface;
   cairo_status_t rv = CAIRO_STATUS_SUCCESS;
@@ -686,12 +689,12 @@ BAIL:
 
 
 static cairo_int_status_t
-_cairo_openvg_surface_show_glyphs (void *asurface,
-                                cairo_operator_t op,
-                                cairo_pattern_t *source,
-                                cairo_glyph_t *glyphs,
-                                int num_glyphs,
-                                cairo_scaled_font_t *scaled_font)
+_cairo_openvg_surface_show_glyphs (void                *asurface,
+                                   cairo_operator_t     op,
+                                   cairo_pattern_t     *source,
+                                   cairo_glyph_t       *glyphs,
+                                   int                  num_glyphs,
+                                   cairo_scaled_font_t *scaled_font)
 {
   cairo_status_t status = CAIRO_STATUS_SUCCESS;
   cairo_path_fixed_t path;
@@ -719,14 +722,14 @@ cairo_openvg_surface_backend = {
     CAIRO_SURFACE_TYPE_OPENVG,
     _cairo_openvg_surface_create_similar,
     NULL, /* finish */
-    NULL, /* acquie_source_image */
-    NULL, /* elease_source_image */
-    NULL, /* acquie_dest_image */
-    NULL, /* elease_dest_image */
+    NULL, /* acquire_source_image */
+    NULL, /* release_source_image */
+    NULL, /* acquire_dest_image */
+    NULL, /* release_dest_image */
     _cairo_openvg_surface_clone_similar,
     NULL, /* composite */
-    NULL, /* fill_ectangles */
-    NULL, /* composite_tapezoids */
+    NULL, /* fill_rectangles */
+    NULL, /* composite_trapezoids */
     NULL, /* copy_page */
     NULL, /* show_page */
     NULL, /* set_clip_egion */
@@ -735,7 +738,7 @@ cairo_openvg_surface_backend = {
     NULL, /* old_show_glyphs */
     NULL, /* get_font_options */
     NULL, /* flush */
-    NULL, /* mak_dirty_rectangle */
+    NULL, /* mark_dirty_rectangle */
     NULL, /* scaled_font_fini */
     NULL, /* scaled_glyph_fini */
 
@@ -746,8 +749,8 @@ cairo_openvg_surface_backend = {
     _cairo_openvg_surface_show_glyphs,
 
     NULL, /* snapshot */
-    NULL, /* is_simila */
-    NULL, /* eset */
+    NULL, /* is_similar */
+    NULL, /* reset */
 };
 
 cairo_surface_t *
@@ -759,17 +762,13 @@ cairo_openvg_surface_create (int width, int height)
     s->width = width;
     s->height = height;
 
-
     vgLoadIdentity();
-#if 0
-    /* ShivaVG */
-    vgTranslate (-1.0, 1.0);
-    vgScale (2.0/width, -2.0/height);
-#else
-    /* AmanithVG */
+    /* The default transform of cairo and OpenVG differ, (cairo has the
+     * y axis pointing downwards while openvg has it pointing upwards,
+     * let's swap that around
+     */
     vgTranslate (0.0, height);
     vgScale (1.0, -1.0);
-#endif
 
     return (cairo_surface_t *) s;
 }
-- 
1.6.0.4



More information about the cairo mailing list