summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2019-08-18 15:29:16 +0000
committerThomas Holder <thomas@thomas-holder.de>2019-08-18 15:29:16 +0000
commit3ffefe1e05e3858ce6584dc644817c411232dc77 (patch)
treee992648f9c1598efe6c810009213dbf9b7b31ff4 /src/ui/dialog
parentFormatting last commit (diff)
downloadinkscape-3ffefe1e05e3858ce6584dc644817c411232dc77.tar.gz
inkscape-3ffefe1e05e3858ce6584dc644817c411232dc77.zip
reduce usage of desktop coordinates (#341)
- avoid unnecessary internal usage of desktop coordinates, e.g. in SpellCheck::compareTextBboxes - document whether a function argument is in document or desktop coordinates, e.g. for SPDocument::getItemsInBox
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/export.cpp6
-rw-r--r--src/ui/dialog/spellcheck.cpp7
2 files changed, 7 insertions, 6 deletions
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 160f83965..2c1ebb45d 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -1050,7 +1050,7 @@ void Export::onExport ()
}
pHYs = (pHYs_adj->get_value() > 0.01) ? pHYs_adj->get_value() : dpi;
- Geom::OptRect area = item->desktopVisualBounds();
+ Geom::OptRect area = item->documentVisualBounds();
if (area) {
gint width = (gint) (area->width() * dpi / DPI_BASE + 0.5);
gint height = (gint) (area->height() * dpi / DPI_BASE + 0.5);
@@ -1154,11 +1154,13 @@ void Export::onExport ()
prog_dlg->set_data("current", GINT_TO_POINTER(0));
prog_dlg->set_data("total", GINT_TO_POINTER(0));
+ auto area = Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)) * desktop->dt2doc();
+
/* Do export */
std::vector<SPItem*> x;
std::vector<SPItem*> selected(desktop->getSelection()->items().begin(), desktop->getSelection()->items().end());
ExportResult status = sp_export_png_file(desktop->getDocument(), path.c_str(),
- Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, pHYs, pHYs, //previously xdpi, ydpi.
+ area, width, height, pHYs, pHYs, //previously xdpi, ydpi.
nv->pagecolor,
onProgressCallback, (void*)prog_dlg,
FALSE,
diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp
index ab0282298..eb32d2245 100644
--- a/src/ui/dialog/spellcheck.cpp
+++ b/src/ui/dialog/spellcheck.cpp
@@ -252,15 +252,14 @@ bool SpellCheck::compareTextBboxes (gconstpointer a, gconstpointer b)//returns a
SPItem *i1 = SP_ITEM(a);
SPItem *i2 = SP_ITEM(b);
- Geom::OptRect bbox1 = i1->desktopVisualBounds();
- Geom::OptRect bbox2 = i2->desktopVisualBounds();
+ Geom::OptRect bbox1 = i1->documentVisualBounds();
+ Geom::OptRect bbox2 = i2->documentVisualBounds();
if (!bbox1 || !bbox2) {
return false;
}
// vector between top left corners
- Geom::Point diff = Geom::Point(bbox2->min()[Geom::X], bbox2->max()[Geom::Y]) -
- Geom::Point(bbox1->min()[Geom::X], bbox1->max()[Geom::Y]);
+ Geom::Point diff = bbox1->min() - bbox2->min();
return diff[Geom::Y] == 0 ? (diff[Geom::X] < 0) : (diff[Geom::Y] < 0);
}