Code

I'm an idiot who forgot that MOTION_HINT_MASK still needs MOTION_MASK
[inkscape.git] / src / display / canvas-bpath.cpp
index eccaf4aeddd1652fce1a26831acc7a11b8a4cced..ac3779029d6e093471583f9683af81ac9af8f92f 100644 (file)
@@ -118,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);
 }
@@ -189,10 +186,10 @@ sp_canvas_bpath_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_it
         return NR_HUGE;
 
     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;
-    pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), 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;