summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-21 21:16:28 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-22 09:00:56 +0200
commit446de9cbea55af65b5f1a274f1ac4b88a6be9ae6 (patch)
tree3e67d90ca3517a52055b13aeb8d062042317759e /canvas
parentafb62b0e96e9bf91ec99857cc16ddb094bcaa3be (diff)
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@collabora.com>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx2
1 files changed, 1 insertions, 1 deletions
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)