Code

Remove the clipping path emitted before the 'sh' operator since that same path is...
authormiklosh <miklosh@users.sourceforge.net>
Sun, 19 Aug 2007 20:09:08 +0000 (20:09 +0000)
committermiklosh <miklosh@users.sourceforge.net>
Sun, 19 Aug 2007 20:09:08 +0000 (20:09 +0000)
src/extension/internal/pdfinput/svg-builder.cpp

index d5db5489d201742e5fe4c9db583466a6fe2deb7a..6e5620236c16220d42e795b6dfa58f6752c8b148 100644 (file)
@@ -473,6 +473,27 @@ void SvgBuilder::addShadedFill(GfxShading *shading, double *matrix, GfxPath *pat
 
     _container->appendChild(path_node);
     Inkscape::GC::release(path_node);
+
+    // Remove the clipping path emitted before the 'sh' operator
+    int up_walk = 0;
+    Inkscape::XML::Node *node = _container->parent();
+    while( node && node->childCount() == 1 && up_walk < 3 ) {
+        gchar const *clip_path_url = node->attribute("clip-path");
+        if (clip_path_url) {
+            // Obtain clipping path's id from the URL
+            gchar clip_path_id[32];
+            strncpy(clip_path_id, clip_path_url + 5, strlen(clip_path_url) - 6);
+            SPObject *clip_obj = _doc->getObjectById(clip_path_id);
+            if (clip_obj) {
+                clip_obj->deleteObject();
+                node->setAttribute("clip-path", NULL);
+                TRACE(("removed clipping path: %s\n", clip_path_id));
+            }
+            break;
+        }
+        node = node->parent();
+        up_walk++;
+    }
 }
 
 /**