summaryrefslogtreecommitdiffstats
path: root/src/trace
diff options
context:
space:
mode:
authorSebastian Wüst <sebi@timewaster.de>2013-10-20 15:32:08 +0000
committerSebastian Wüst <sebi@timewaster.de>2013-10-20 15:32:08 +0000
commit82908f949129e1fcbf62002799ee7b1b77986eed (patch)
treec02098dd7720cdf424f2793ecd3ddac2ea86b969 /src/trace
parentchanged text (diff)
parentFix build errors with clang 3.3 and c++11 enabled. (diff)
downloadinkscape-82908f949129e1fcbf62002799ee7b1b77986eed.tar.gz
inkscape-82908f949129e1fcbf62002799ee7b1b77986eed.zip
merge from trunk
(bzr r12417.1.24)
Diffstat (limited to 'src/trace')
-rw-r--r--src/trace/imagemap-gdk.cpp4
-rw-r--r--src/trace/pool.h18
-rw-r--r--src/trace/trace.cpp29
-rw-r--r--src/trace/trace.h2
4 files changed, 38 insertions, 15 deletions
diff --git a/src/trace/imagemap-gdk.cpp b/src/trace/imagemap-gdk.cpp
index 7c7139002..298414074 100644
--- a/src/trace/imagemap-gdk.cpp
+++ b/src/trace/imagemap-gdk.cpp
@@ -152,9 +152,9 @@ RgbMap *gdkPixbufToRgbMap(GdkPixbuf *buf)
{
int alpha = (int)p[3];
int white = 255 - alpha;
- int r = (int)p[2]; r = r * alpha / 256 + white;
+ int r = (int)p[0]; r = r * alpha / 256 + white;
int g = (int)p[1]; g = g * alpha / 256 + white;
- int b = (int)p[0]; b = b * alpha / 256 + white;
+ int b = (int)p[2]; b = b * alpha / 256 + white;
rgbMap->setPixel(rgbMap, x, y, r, g, b);
p += n_channels;
diff --git a/src/trace/pool.h b/src/trace/pool.h
index d072a460b..88fd82bcd 100644
--- a/src/trace/pool.h
+++ b/src/trace/pool.h
@@ -59,17 +59,21 @@ class pool {
public:
pool()
- {
+ {
cblock = 0;
size = sizeof(T) > sizeof(void *) ? sizeof(T) : sizeof(void *);
next = NULL;
- }
+ for (int k = 0; k < 64; k++) {
+ block[k] = NULL;
+ }
+ }
~pool()
- {
- for (int k = 0; k < cblock; k++)
- free(block[k]);
- }
+ {
+ for (int k = 0; k < cblock; k++) {
+ free(block[k]);
+ }
+ }
T *draw()
{
@@ -89,7 +93,7 @@ class pool {
int size;
int cblock;
- void *block[64]; //enough to store unlimited number of objects
+ void *block[64]; //enough to store unlimited number of objects, if 64 is changed: see constructor too
void *next;
void addblock()
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);
diff --git a/src/trace/trace.h b/src/trace/trace.h
index 9f9f44b14..662b2537e 100644
--- a/src/trace/trace.h
+++ b/src/trace/trace.h
@@ -26,7 +26,7 @@
#include <vector>
#include <sp-shape.h>
-struct SPImage;
+class SPImage;
class SPItem;
namespace Inkscape {