[cairo] [PATCH 30/39] [OpenVG] use meta surface instead of image surface for create_similar
tardyp at gmail.com
tardyp at gmail.com
Fri Jul 10 10:02:32 PDT 2009
From: Øyvind Kolås <pippin at gimp.org>
---
src/cairo-openvg-surface.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/cairo-openvg-surface.c b/src/cairo-openvg-surface.c
index bde9657..a430930 100644
--- a/src/cairo-openvg-surface.c
+++ b/src/cairo-openvg-surface.c
@@ -34,6 +34,7 @@
#include "cairoint.h"
#include "cairo-openvg.h"
#include "cairo-path-fixed-private.h"
+#include "cairo-meta-surface-private.h"
#include <vg/openvg.h>
typedef struct cairo_openvg_surface {
@@ -57,12 +58,7 @@ _cairo_openvg_surface_create_similar (void *asurface,
int width,
int height)
{
- /* Assuming that surface_create_simlilar will be used to create patterns
- * filled with cairo drawings, we cannot do this with openvg thus we simply
- * refuse to accept the request
- */
- return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
- /*return cairo_openvg_surface_create (width, height);*/
+ return _cairo_meta_surface_create (content, width, height);
}
static cairo_status_t
@@ -741,6 +737,16 @@ _cairo_openvg_surface_paint (void *asurface,
vgSeti(VG_BLEND_MODE, _cairo_openvg_cairo_operator_to_openvg (op));
+ if (source->type == CAIRO_PATTERN_TYPE_SURFACE)
+ {
+ cairo_surface_pattern_t *spat = (cairo_surface_pattern_t *)source;
+ if (_cairo_surface_is_meta (spat->surface))
+ {
+ _cairo_meta_surface_replay (spat->surface, asurface);
+ }
+ return CAIRO_STATUS_SUCCESS;
+ }
+
rv = setup_source (vgsurface, source);
if (rv)
goto BAIL;
@@ -783,15 +789,12 @@ _cairo_openvg_surface_mask (void *asurface,
vgsurface->height);
cr = cairo_create (image);
- cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_translate (cr, 0.0, vgsurface->height);
cairo_scale (cr, 1.0, -1.0);
cairo_set_source (cr, mask);
cairo_paint (cr);
- cairo_restore (cr);
- cairo_restore (cr);
{
VGImage vgimage;
--
1.6.0.4
More information about the cairo
mailing list