summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-05-15 22:46:18 +0200
committerMichael Stahl <mstahl@redhat.com>2015-05-15 22:49:12 +0200
commitc8dad7ebb7c1738ae1348f92d67124c165d83f00 (patch)
treec1291e643f2ee73b663c72564763ab7983ac06de
parent6ea1d1d341988cf36682c4362aa6badbfb114ff9 (diff)
tdf#91195: vcl: reduce MapMode Fraction precision to avoid...
... overlow in ImplMapLogicToPixel. 50 bits is still too much, 44 appears to work for exporting PNG. DocumentToGraphicRenderer::renderToGraphic() converts a double to Fraction which is the source of the excess precision. Change-Id: I93b11ef3a8be1c2f816f9697e5cd33eb00f7c2f9
-rw-r--r--vcl/source/gdi/mapmod.cxx2
-rw-r--r--vcl/source/outdev/map.cxx1
2 files changed, 3 insertions, 0 deletions
diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx
index b3b71c54582f..8980a8d30719 100644
--- a/vcl/source/gdi/mapmod.cxx
+++ b/vcl/source/gdi/mapmod.cxx
@@ -193,6 +193,7 @@ void MapMode::SetScaleX( const Fraction& rScaleX )
ImplMakeUnique();
mpImplMapMode->maScaleX = rScaleX;
+ mpImplMapMode->maScaleX.ReduceInaccurate(44);
}
void MapMode::SetScaleY( const Fraction& rScaleY )
@@ -200,6 +201,7 @@ void MapMode::SetScaleY( const Fraction& rScaleY )
ImplMakeUnique();
mpImplMapMode->maScaleY = rScaleY;
+ mpImplMapMode->maScaleY.ReduceInaccurate(44);
}
MapMode& MapMode::operator=( const MapMode& rMapMode )
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index e7eed8872143..6e34573bf303 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -78,6 +78,7 @@ static Fraction ImplMakeFraction( long nN1, long nN2, long nD1, long nD2 )
aF = Fraction( i*nN1, nD1 ) * Fraction( nN2, nD2 );
}
+ aF.ReduceInaccurate(44);
return aF;
}