summaryrefslogtreecommitdiffstats
path: root/src/trace/trace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trace/trace.cpp')
-rw-r--r--src/trace/trace.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index cad8ea9be..cb83541e3 100644
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
@@ -31,6 +31,7 @@
#include <2geom/transforms.h>
#include "verbs.h"
+#include "display/cairo-utils.h"
#include "display/drawing.h"
#include "display/drawing-shape.h"
@@ -212,7 +213,7 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr<Gd
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (!desktop)
{
- g_warning(_("Trace: No active desktop"));
+ g_warning("%s", _("Trace: No active desktop"));
return Glib::RefPtr<Gdk::Pixbuf>(NULL);
}
@@ -309,7 +310,7 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr<Gd
SioxImage result = sengine.extractForeground(simage, 0xffffff);
if (!result.isValid())
{
- g_warning(_("Invalid SIOX result"));
+ g_warning("%s", _("Invalid SIOX result"));
return Glib::RefPtr<Gdk::Pixbuf>(NULL);
}
@@ -336,8 +337,17 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::getSelectedImage()
if (!img->pixbuf)
return Glib::RefPtr<Gdk::Pixbuf>(NULL);
- Glib::RefPtr<Gdk::Pixbuf> pixbuf =
- Glib::wrap(img->pixbuf, true);
+ GdkPixbuf *raw_pb = img->pixbuf->getPixbufRaw(false);
+ GdkPixbuf *trace_pb = gdk_pixbuf_copy(raw_pb);
+ if (img->pixbuf->pixelFormat() == Inkscape::Pixbuf::PF_CAIRO) {
+ convert_pixels_argb32_to_pixbuf(
+ gdk_pixbuf_get_pixels(trace_pb),
+ gdk_pixbuf_get_width(trace_pb),
+ gdk_pixbuf_get_height(trace_pb),
+ gdk_pixbuf_get_rowstride(trace_pb));
+ }
+
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(trace_pb, false);
if (sioxEnabled)
{
@@ -410,7 +420,16 @@ void Tracer::traceThread()
return;
}
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(img->pixbuf, true);
+ GdkPixbuf *trace_pb = gdk_pixbuf_copy(img->pixbuf->getPixbufRaw(false));
+ if (img->pixbuf->pixelFormat() == Inkscape::Pixbuf::PF_CAIRO) {
+ convert_pixels_argb32_to_pixbuf(
+ gdk_pixbuf_get_pixels(trace_pb),
+ gdk_pixbuf_get_width(trace_pb),
+ gdk_pixbuf_get_height(trace_pb),
+ gdk_pixbuf_get_rowstride(trace_pb));
+ }
+
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(trace_pb, false);
pixbuf = sioxProcessImage(img, pixbuf);