Code

Patch from codedread. Prevents rendering of title/desc/metadata elements in text...
[inkscape.git] / src / display / canvas-bpath.cpp
index 714538d1b455cc9fdfd1b48fefc3b991e9d54c98..ac3779029d6e093471583f9683af81ac9af8f92f 100644 (file)
@@ -26,6 +26,7 @@
 #include <libnr/nr-pixops.h>
 #include <libnr/nr-convert2geom.h>
 #include <libnr/nr-path.h>
+#include "helper/geom.h"
 
 void nr_pixblock_render_bpath_rgba (Shape* theS,uint32_t color,NRRectL &area,char* destBuf,int stride);
 
@@ -117,15 +118,12 @@ sp_canvas_bpath_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
 
     cbp->affine = affine;
 
-    const_NRBPath bp;
-    bp.path = cbp->curve->get_bpath();
-    NRRect bbox;
-    nr_path_matrix_bbox_union(&bp, affine, &bbox);
+    Geom::Rect bbox = bounds_exact_transformed(cbp->curve->get_pathvector(), to_2geom(affine));
 
-    item->x1 = (int)bbox.x0 - 1;
-    item->y1 = (int)bbox.y0 - 1;
-    item->x2 = (int)bbox.x1 + 1;
-    item->y2 = (int)bbox.y1 + 1;
+    item->x1 = (int)bbox.min()[Geom::X] - 1;
+    item->y1 = (int)bbox.min()[Geom::Y] - 1;
+    item->x2 = (int)bbox.max()[Geom::X] + 1;
+    item->y2 = (int)bbox.max()[Geom::Y] + 1;
 
     sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
 }
@@ -182,19 +180,16 @@ sp_canvas_bpath_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_it
 {
     SPCanvasBPath *cbp = SP_CANVAS_BPATH (item);
 
-    const_NRBPath bp;
     if ( !cbp->curve  || 
          ((cbp->stroke_rgba & 0xff) == 0 && (cbp->fill_rgba & 0xff) == 0 ) || 
          cbp->curve->get_length() <= 1)
         return NR_HUGE;
 
-    bp.path = cbp->curve->get_bpath();
-
     double width = 0.5;
-    NR::Rect viewbox = item->canvas->getViewbox();
-        viewbox.growBy (width);
+    Geom::Rect viewbox = to_2geom(item->canvas->getViewbox());
+    viewbox.expandBy (width);
     double dist = NR_HUGE;
-    nr_path_matrix_point_bbox_wind_distance(&bp, cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox);
+    pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), to_2geom(cbp->affine), to_2geom(p), NULL, NULL, &dist, 0.5, &viewbox);
 
     if (dist <= 1.0) {
         *actual_item = item;