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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 22 07:01:41 UTC 2020


 canvas/source/cairo/cairo_canvashelper.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 446de9cbea55af65b5f1a274f1ac4b88a6be9ae6
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Sep 21 21:16:28 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Sep 22 09:00:56 2020 +0200

    tdf#136337 cairo canvas: fix missing image with negative height
    
    Regression from commit 78036f74fa74ee2552e79064660634e1342692ff
    (tdf#135094 cairo canvas: fix black slide containing a very small image,
    2020-08-14), we try to predict when cairo would end up in an invalid
    state due to an invalid transformation matrix, but in this case we were
    too aggressive, so the image was missing while presenting.
    
    Fix the problem by allowing negative sizes, just require that neither of
    width/height is zero, because negative values are poor, but valid way of
    vertical/horizontal flip.
    
    [ No testcase, our tests are typically headless and currently
    SvpSalGraphics::SupportsCairo() reports false, so this would be tricky
    to test. ]
    
    Change-Id: Iaf843c0d40c108d5221c9b94b39d617e4d50f65c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103127
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 09a87e2ecc4c..0ca169ca1fe4 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1179,7 +1179,7 @@ namespace cairocanvas
 
             int nPixelWidth = std::round(rSize.Width * aMatrix.xx);
             int nPixelHeight = std::round(rSize.Height * aMatrix.yy);
-            if (nPixelWidth > 0 && nPixelHeight > 0)
+            if (std::abs(nPixelWidth) > 0 && std::abs(nPixelHeight) > 0)
             {
                 // Only render the image if it's at least 1x1 px sized.
                 if (bModulateColors)


More information about the Libreoffice-commits mailing list