summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-03-02 17:10:33 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-03-02 17:10:33 +0000
commit0853a656cfacf9a14a486bb03c90ea73702dbcf2 (patch)
treedb37e7b701c5b77a17b2baa9e21f9f07016ee222 /src
parentfix comment to match code (diff)
downloadinkscape-0853a656cfacf9a14a486bb03c90ea73702dbcf2.tar.gz
inkscape-0853a656cfacf9a14a486bb03c90ea73702dbcf2.zip
fix an error in rounding negative coords
(bzr r2503)
Diffstat (limited to 'src')
-rw-r--r--src/selection-chemistry.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 33f14e050..680a2e871 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2504,11 +2504,14 @@ sp_selection_create_bitmap_copy ()
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
NR::Matrix eek = sp_item_i2d_affine (SP_ITEM(parent_object));
NR::Matrix t;
+
+ double shift_x = bbox.x0;
+ double shift_y = bbox.y1;
if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
- t = NR::scale (1, -1) * NR::translate ((unsigned) (bbox.x0 + 0.5), (unsigned) (bbox.y1 + 0.5)) * eek.inverse();
- } else {
- t = NR::scale (1, -1) * NR::translate (bbox.x0, bbox.y1) * eek.inverse();
+ 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
}
+ t = NR::scale(1, -1) * NR::translate (shift_x, shift_y) * eek.inverse();
// Do the export
sp_export_png_file(document, filepath,