From d12b9c9fa87c4fc4f7842e5d6512c4f17298cce7 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 3 Apr 2010 03:56:36 +0200 Subject: Initial fix for the inverted coordinate system bug (bzr r9281.1.1) --- src/selection-chemistry.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 730467ee5..7ac2e5471 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2748,12 +2748,12 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop) Geom::Matrix t; double shift_x = bbox.x0; - double shift_y = bbox.y1; + double shift_y = bbox.y0; if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid shift_x = round(shift_x); - shift_y = -round(-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone + shift_y = round(shift_y); } - t = Geom::Scale(1, -1) * Geom::Translate(shift_x, shift_y) * eek.inverse(); + t = Geom::Translate(shift_x, shift_y) * eek.inverse(); // Do the export sp_export_png_file(document, filepath, -- cgit v1.2.3 From c2b0be4faa9e98c00ecce70c4aeb8e2fe1afdb2b Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 3 Apr 2010 14:47:02 +0200 Subject: Fix behavior when loading a document (bzr r9281.1.7) --- src/selection-chemistry.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 7ac2e5471..452a4ff9d 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2273,9 +2273,8 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) } // calculate the transform to be applied to objects to move them to 0,0 - Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - *c; - move_p[Geom::Y] = -move_p[Geom::Y]; - Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p)); + Geom::Point move_p = -*c; + Geom::Matrix move = Geom::Translate(move_p); GSList *items = g_slist_copy((GSList *) selection->itemList()); @@ -2396,8 +2395,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) } // calculate the transform to be applied to objects to move them to 0,0 - Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - (r->min() + Geom::Point(0, r->dimensions()[Geom::Y])); - move_p[Geom::Y] = -move_p[Geom::Y]; + Geom::Point move_p = -(r->min() + Geom::Point(0, r->dimensions()[Geom::Y])); Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p)); GSList *items = g_slist_copy((GSList *) selection->itemList()); -- cgit v1.2.3 From 95a0c8412e84f5e0cc1d9a63fce2be75f9fa517e Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 6 Apr 2010 16:11:54 +0200 Subject: Revert the inverted coordinate system fix. 3D Boxes and guides require an XML-level backwards compatibility mechanism to fix properly, and it's too late in the 0.48 cycle to introduce it. (bzr r9298) --- src/selection-chemistry.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 452a4ff9d..730467ee5 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2273,8 +2273,9 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) } // calculate the transform to be applied to objects to move them to 0,0 - Geom::Point move_p = -*c; - Geom::Matrix move = Geom::Translate(move_p); + Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - *c; + move_p[Geom::Y] = -move_p[Geom::Y]; + Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p)); GSList *items = g_slist_copy((GSList *) selection->itemList()); @@ -2395,7 +2396,8 @@ sp_selection_tile(SPDesktop *desktop, bool apply) } // calculate the transform to be applied to objects to move them to 0,0 - Geom::Point move_p = -(r->min() + Geom::Point(0, r->dimensions()[Geom::Y])); + Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - (r->min() + Geom::Point(0, r->dimensions()[Geom::Y])); + move_p[Geom::Y] = -move_p[Geom::Y]; Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p)); GSList *items = g_slist_copy((GSList *) selection->itemList()); @@ -2746,12 +2748,12 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop) Geom::Matrix t; double shift_x = bbox.x0; - double shift_y = bbox.y0; + double shift_y = bbox.y1; if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid shift_x = round(shift_x); - shift_y = round(shift_y); + shift_y = -round(-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone } - t = Geom::Translate(shift_x, shift_y) * eek.inverse(); + t = Geom::Scale(1, -1) * Geom::Translate(shift_x, shift_y) * eek.inverse(); // Do the export sp_export_png_file(document, filepath, -- cgit v1.2.3 From 20dae7a7ce078ec4e0cd5c808c21eba4d549ddc7 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 10 Apr 2010 17:21:01 +0200 Subject: * improve boundingbox calculation: include strokecaps. * increasing boundingbox calculation precision for selection to marker, selection to pattern and fit canvas to selection (bzr r9307) --- src/selection-chemistry.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 730467ee5..cc153aa71 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2266,7 +2266,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) } sp_document_ensure_up_to_date(doc); - Geom::OptRect r = selection->bounds(); + Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX); boost::optional c = selection->center(); if ( !r || !c ) { return; @@ -2390,7 +2390,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) } sp_document_ensure_up_to_date(doc); - Geom::OptRect r = selection->bounds(); + Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX); if ( !r ) { return; } @@ -3173,7 +3173,7 @@ fit_canvas_to_selection(SPDesktop *desktop, bool with_margins) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to fit canvas to.")); return false; } - Geom::OptRect const bbox(desktop->selection->bounds()); + Geom::OptRect const bbox(desktop->selection->bounds(SPItem::RENDERING_BBOX)); if (bbox) { doc->fitToRect(*bbox, with_margins); return true; -- cgit v1.2.3