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

Michael Meeks michael.meeks at collabora.com
Thu Feb 11 18:02:00 UTC 2016


 vcl/opengl/gdiimpl.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 4d379cd842a9d27a0aec54af5b2ce94c01dfa0bd
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Feb 11 17:35:20 2016 +0000

    tdf#97763 - avoid divide by zero for scaling images to tiny dimensions.
    
    Change-Id: I27efebcc1c24d45c17da2ad2959b673153c3eead
    Reviewed-on: https://gerrit.libreoffice.org/22297
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 6676baf..6828efb 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1072,6 +1072,10 @@ void OpenGLSalGraphicsImpl::DrawTransformedTexture(
     const long nDestWidth = basegfx::fround(basegfx::B2DVector(rX - rNull).getLength());
     const long nDestHeight = basegfx::fround(basegfx::B2DVector(rY - rNull).getLength());
 
+    // Invisibly small images shouldn't divide by zero.
+    if( nDestHeight == 0 || nDestWidth == 0 )
+        return;
+
     const double ixscale = rTexture.GetWidth()  / nDestWidth;
     const double iyscale = rTexture.GetHeight() / nDestHeight;
 


More information about the Libreoffice-commits mailing list