Code

Make curvature work again by fixing a minor omission
[inkscape.git] / src / sp-image.cpp
index e23dddaf629b25ff348b1ed5b37d77db0e3ead14..65aad1e2d097a30f0e20df76275becc1ce5386c0 100644 (file)
@@ -15,6 +15,9 @@
 # include "config.h"
 #endif
 
+// This has to be included prior to anything that includes setjmp.h, it croaks otherwise
+#include <png.h>
+
 #include <cstring>
 #include <string>
 #include <libnr/nr-matrix-fns.h>
@@ -45,7 +48,6 @@
 #include "libnr/nr-matrix-fns.h"
 
 #include "io/sys.h"
-#include <png.h>
 #if ENABLE_LCMS
 #include "color-profile-fns.h"
 #include "color-profile.h"
@@ -71,6 +73,7 @@ static void sp_image_build (SPObject * object, SPDocument * document, Inkscape::
 static void sp_image_release (SPObject * object);
 static void sp_image_set (SPObject *object, unsigned int key, const gchar *value);
 static void sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags);
+static void sp_image_modified (SPObject *object, unsigned int flags);
 static Inkscape::XML::Node *sp_image_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
 
 static void sp_image_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
@@ -582,6 +585,7 @@ sp_image_class_init (SPImageClass * klass)
     sp_object_class->release = sp_image_release;
     sp_object_class->set = sp_image_set;
     sp_object_class->update = sp_image_update;
+    sp_object_class->modified = sp_image_modified;
     sp_object_class->write = sp_image_write;
 
     item_class->bbox = sp_image_bbox;
@@ -1007,6 +1011,22 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags)
     sp_image_update_canvas_image ((SPImage *) object);
 }
 
+static void
+sp_image_modified (SPObject *object, unsigned int flags)
+{
+    SPImage *image = SP_IMAGE (object);
+
+    if (((SPObjectClass *) (parent_class))->modified) {
+      (* ((SPObjectClass *) (parent_class))->modified) (object, flags);
+    }
+
+    if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
+        for (SPItemView *v = SP_ITEM (image)->display; v != NULL; v = v->next) {
+            nr_arena_image_set_style (NR_ARENA_IMAGE (v->arenaitem), object->style);
+        }
+    }
+}
+
 static Inkscape::XML::Node *
 sp_image_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
 {
@@ -1328,7 +1348,7 @@ static void sp_image_snappoints(SPItem const *item, bool const target, SnapPoint
         double const y1 = y0 + image.height.computed;
         Geom::Matrix const i2d (sp_item_i2d_affine (item));
         Geom::Point pt;
-        int type = target ? int(Inkscape::SNAPTARGET_HANDLE) : int(Inkscape::SNAPSOURCE_HANDLE);
+        int type = target ? int(Inkscape::SNAPTARGET_CORNER) : int(Inkscape::SNAPSOURCE_CORNER);
         p.push_back(std::make_pair(Geom::Point(x0, y0) * i2d, type));
         p.push_back(std::make_pair(Geom::Point(x0, y1) * i2d, type));
         p.push_back(std::make_pair(Geom::Point(x1, y1) * i2d, type));