diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-08-09 20:45:22 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-08-09 20:45:22 +0000 |
| commit | 2cfc657521d2c22e9238ce1904a6a4a90d3b4517 (patch) | |
| tree | b07eb4e1fefea78fdac087e5fc6eaa3a179a6b41 /src/display/cairo-utils.cpp | |
| parent | OpenMP-enabled matrix convolution (diff) | |
| download | inkscape-2cfc657521d2c22e9238ce1904a6a4a90d3b4517.tar.gz inkscape-2cfc657521d2c22e9238ce1904a6a4a90d3b4517.zip | |
Fix performance regression when displaying large images
(bzr r9508.1.54)
Diffstat (limited to 'src/display/cairo-utils.cpp')
| -rw-r--r-- | src/display/cairo-utils.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index 15fceedae..96219e834 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -327,6 +327,14 @@ ink_cairo_pattern_set_matrix(cairo_pattern_t *cp, Geom::Matrix const &m) void ink_cairo_set_source_argb32_pixbuf(cairo_t *ct, GdkPixbuf *pb, double x, double y) { + cairo_surface_t *pbs = ink_cairo_surface_create_for_argb32_pixbuf(pb); + cairo_set_source_surface(ct, pbs, x, y); + cairo_surface_destroy(pbs); +} + +cairo_surface_t * +ink_cairo_surface_create_for_argb32_pixbuf(GdkPixbuf *pb) +{ guchar *data = gdk_pixbuf_get_pixels(pb); int w = gdk_pixbuf_get_width(pb); int h = gdk_pixbuf_get_height(pb); @@ -334,8 +342,7 @@ ink_cairo_set_source_argb32_pixbuf(cairo_t *ct, GdkPixbuf *pb, double x, double cairo_surface_t *pbs = cairo_image_surface_create_for_data( data, CAIRO_FORMAT_ARGB32, w, h, stride); - cairo_set_source_surface(ct, pbs, x, y); - cairo_surface_destroy(pbs); + return pbs; } /** @brief Create an exact copy of a surface. |
