summaryrefslogtreecommitdiff
path: root/basegfx/source/matrix/b2dhommatrix.cxx
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2012-01-18 14:52:20 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-01-18 14:57:04 -0500
commit800806ba850c7fd03e37acb011fa993e08cb8fc8 (patch)
tree2f0dceddca4a68a6f437b23b5986a0462808d969 /basegfx/source/matrix/b2dhommatrix.cxx
parent105546f7f11ccee50f8066bfb7c753fabb177fc8 (diff)
decompose() should return the original rotation angle and scales.
decompose() would return incorrect rotation angle and scales when the angle was exactly 180 degrees, due to FPU rounding error. This commit fixes it. This problem would manifest itself when inserting an image into Calc/Draw, cropping it, and flipping it vertically or rotating it at exactly 180 degrees. Before the fix the image would simply disappear.
Diffstat (limited to 'basegfx/source/matrix/b2dhommatrix.cxx')
-rw-r--r--basegfx/source/matrix/b2dhommatrix.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx
index 942f313eac10..8538d2263657 100644
--- a/basegfx/source/matrix/b2dhommatrix.cxx
+++ b/basegfx/source/matrix/b2dhommatrix.cxx
@@ -289,6 +289,14 @@ namespace basegfx
// no rotation and shear, copy scale values
rScale.setX(get(0, 0));
rScale.setY(get(1, 1));
+
+ // or is there?
+ if( rScale.getX() < 0 && rScale.getY() < 0 )
+ {
+ // there is - 180 degree rotated
+ rScale *= -1;
+ rRotate = 180*F_PI180;
+ }
}
else
{