summaryrefslogtreecommitdiffstats
path: root/src/display/cairo-utils.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-07-14 02:32:10 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-07-14 02:32:10 +0000
commitbb8404b19557519bd828113fa93604b10e9e7fe3 (patch)
tree01fd9c531829445801184b172fd7636cde1ab86e /src/display/cairo-utils.cpp
parentGaussian blur (diff)
downloadinkscape-bb8404b19557519bd828113fa93604b10e9e7fe3.tar.gz
inkscape-bb8404b19557519bd828113fa93604b10e9e7fe3.zip
Merge redundant *-fns.h into respective filter headers.
Move gaussian blur to filters directory. Blend filter effect. (bzr r9508.1.16)
Diffstat (limited to 'src/display/cairo-utils.cpp')
-rw-r--r--src/display/cairo-utils.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp
index a063a62bb..36202f42e 100644
--- a/src/display/cairo-utils.cpp
+++ b/src/display/cairo-utils.cpp
@@ -337,11 +337,21 @@ ink_cairo_surface_copy(cairo_surface_t *s)
{
cairo_surface_t *ns = ink_cairo_surface_create_identical(s);
- cairo_t *ct = cairo_create(ns);
- cairo_set_source_surface(ct, s, 0, 0);
- cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
- cairo_paint(ct);
- cairo_destroy(ct);
+ if (cairo_surface_get_type(s) == CAIRO_SURFACE_TYPE_IMAGE) {
+ // use memory copy instead of using a Cairo context
+ cairo_surface_flush(s);
+ int stride = cairo_image_surface_get_stride(s);
+ int h = cairo_image_surface_get_height(s);
+ memcpy(cairo_image_surface_get_data(ns), cairo_image_surface_get_data(s), stride * h);
+ cairo_surface_mark_dirty(ns);
+ } else {
+ // generic implementation
+ cairo_t *ct = cairo_create(ns);
+ cairo_set_source_surface(ct, s, 0, 0);
+ cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
+ cairo_paint(ct);
+ cairo_destroy(ct);
+ }
return ns;
}