summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/cairo-renderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/extension/internal/cairo-renderer.cpp')
-rw-r--r--src/extension/internal/cairo-renderer.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 3463925b6..cace251cf 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -27,6 +27,7 @@
#include <signal.h>
#include <errno.h>
+#include <boost/scoped_ptr.hpp>
#include "libnrtype/Layout-TNG.h"
#include <2geom/transforms.h>
@@ -347,8 +348,8 @@ static void sp_image_render(SPItem *item, CairoRenderContext *ctx)
if (!image->pixbuf) return;
if ((image->width.computed <= 0.0) || (image->height.computed <= 0.0)) return;
- w = gdk_pixbuf_get_width (image->pixbuf);
- h = gdk_pixbuf_get_height (image->pixbuf);
+ w = image->pixbuf->width();
+ h = image->pixbuf->height();
double x = image->x.computed;
double y = image->y.computed;
@@ -497,22 +498,15 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx)
GSList *items = NULL;
items = g_slist_append(items, item);
- GdkPixbuf *pb = sp_generate_internal_bitmap(document, NULL,
- bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y],
- width, height, res, res, (guint32) 0xffffff00, items );
+ boost::scoped_ptr<Inkscape::Pixbuf> pb(
+ sp_generate_internal_bitmap(document, NULL,
+ bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y],
+ width, height, res, res, (guint32) 0xffffff00, items ));
if (pb) {
- TEST(gdk_pixbuf_save( pb, "bitmap.png", "png", NULL, NULL ));
-
- /* TODO: find a way to avoid a duplicate conversion between
- * Cairo and GdkPixbuf pixel formats here.
- * Internally, generate_internal_bitmap creates a Cairo surface,
- * but then converts it to pixbuf format. In turn, renderImage()
- * below converts back to Cairo format.
- */
- ctx->renderImage(pb, t, item->style);
- g_object_unref(pb);
- pb = 0;
+ //TEST(gdk_pixbuf_save( pb, "bitmap.png", "png", NULL, NULL ));
+
+ ctx->renderImage(pb.get(), t, item->style);
}
g_slist_free (items);
}
@@ -586,9 +580,9 @@ void CairoRenderer::renderItem(CairoRenderContext *ctx, SPItem *item)
setStateForItem(ctx, item);
CairoRenderState *state = ctx->getCurrentState();
- state->need_layer = ( state->mask || state->clip_path || state->opacity != 1.0 );
+ state->need_layer = ( state->mask || state->opacity != 1.0 );
- // Draw item on a temporary surface so a mask, clip path, or opacity can be applied to it.
+ // Draw item on a temporary surface so a mask or opacity can be applied to it.
if (state->need_layer) {
state->merge_opacity = FALSE;
ctx->pushLayer();