[cairo] [PATCH 14/39] [OpenVG] Made _cairo_openvg_surface_show_glyphs fill paths.

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


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

---
 src/cairo-openvg-surface.c |   37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/cairo-openvg-surface.c b/src/cairo-openvg-surface.c
index 8d9840f..11687ee 100644
--- a/src/cairo-openvg-surface.c
+++ b/src/cairo-openvg-surface.c
@@ -36,6 +36,7 @@
 
 #include "cairoint.h"
 #include "cairo-openvg.h"
+#include "cairo-path-fixed-private.h"
 #include <vg/openvg.h>
 
 typedef struct cairo_openvg_surface {
@@ -421,7 +422,9 @@ _cairo_openvg_setup_surface_source (cairo_openvg_surface_t  *vgsurface,
     return CAIRO_INT_STATUS_UNSUPPORTED;
 
   if (!_cairo_surface_is_image (spat->surface))
-    return CAIRO_INT_STATUS_UNSUPPORTED;
+    {
+      return CAIRO_INT_STATUS_UNSUPPORTED;
+    }
 
   assert (image->format == CAIRO_FORMAT_RGB24 ||
           image->format == CAIRO_FORMAT_ARGB32 ||
@@ -434,9 +437,10 @@ _cairo_openvg_setup_surface_source (cairo_openvg_surface_t  *vgsurface,
 
   data = malloc (image->width * image->height * 4);
 
-  /* This extra allocation and copy/conversion should not be neccesary if the OpenVG implementation
-   * supports the pixelformats in the specification, at the moment it doesn't seem like neither
-   * ShivaVG nor AmantihVG does so however.
+  /* This extra allocation and copy/conversion should not be neccesary if the
+   * OpenVG implementation supports the pixelformats in the specification, at
+   * the moment it doesn't seem like neither ShivaVG nor AmantihVG does so
+   * however.
    */
   {
     int i;
@@ -502,6 +506,8 @@ setup_source (cairo_openvg_surface_t *vgsurface,
    */
 
   assert (vgsurface->source_paint == 0);
+  assert (vgsurface->source_image == 0);
+
   vgsurface->source_paint = vgCreatePaint();
   if (source->type == CAIRO_PATTERN_TYPE_SOLID)
     {
@@ -689,7 +695,6 @@ BAIL:
 }
 
 
-#if 0
 static cairo_int_status_t
 _cairo_openvg_surface_show_glyphs (void *asurface,
                                 cairo_operator_t op,
@@ -698,10 +703,26 @@ _cairo_openvg_surface_show_glyphs (void *asurface,
                                 int num_glyphs,
                                 cairo_scaled_font_t *scaled_font)
 {
-    printf ("show_glyphs\n");
+  cairo_status_t status = CAIRO_STATUS_SUCCESS;
+  cairo_path_fixed_t path;
+
+  if (num_glyphs <= 0)
     return CAIRO_STATUS_SUCCESS;
+
+  _cairo_path_fixed_init (&path);
+
+  status = _cairo_scaled_font_glyph_path (scaled_font,
+          (cairo_glyph_t *)glyphs, num_glyphs, &path);
+  if (status)
+    {
+      _cairo_path_fixed_fini (&path);
+      return status;
+    }
+
+  status = _cairo_openvg_surface_fill (asurface, op, source, &path, CAIRO_FILL_RULE_WINDING, 0.0, CAIRO_ANTIALIAS_SUBPIXEL);
+  _cairo_path_fixed_fini (&path);
+  return status;
 }
-#endif
 
 static const struct _cairo_surface_backend
 cairo_openvg_surface_backend = {
@@ -732,7 +753,7 @@ cairo_openvg_surface_backend = {
     _cairo_openvg_surface_mask,
     _cairo_openvg_surface_stroke,
     _cairo_openvg_surface_fill,
-    NULL, /* _cairo_openvg_surface_show_glyphs, */
+    _cairo_openvg_surface_show_glyphs,
 
     NULL, /* snapshot */
     NULL, /* is_simila */
-- 
1.6.0.4



More information about the cairo mailing list