[Libreoffice-commits] core.git: vcl/source

Michael Stahl mstahl at redhat.com
Fri May 15 13:54:58 PDT 2015


 vcl/source/gdi/mapmod.cxx |    2 ++
 vcl/source/outdev/map.cxx |    1 +
 2 files changed, 3 insertions(+)

New commits:
commit c8dad7ebb7c1738ae1348f92d67124c165d83f00
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri May 15 22:46:18 2015 +0200

    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

diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx
index b3b71c5..8980a8d 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 e7eed88..6e34573 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;
 }
 


More information about the Libreoffice-commits mailing list