tdf#136337 cairo canvas: fix missing image with negative height
Regression from commit 78036f74fa
(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>
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user