summaryrefslogtreecommitdiff
path: root/vcl/backendtest
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-09-23 12:13:32 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-09-25 12:18:04 +0200
commit787bc48c883b70b1721805b5d6a93bd731983410 (patch)
treea61f9f45a77466b61d6e306e924a77096be21e66 /vcl/backendtest
parenteb2753560d9238f60131ff9f64aaf1eb4ae2d764 (diff)
xor drawing done twice in the same place should be a no-op
This extends the VCL backend unittest to check for this, and also fixes Skia to handle that properly. This makes tdf#132241 slow again. The problem there is that it does drawGradient() with xor enabled (for whatever strange reason), and since Skia does not implement drawGradient(), it gets drawn using polygons and their bounds overlap, causing applyXor() after each operation again. Implementing drawGradient() will handle that. Change-Id: Ibea433ad95f8c6d53049f4a49295e57a5aec184f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103280 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/backendtest')
-rw-r--r--vcl/backendtest/outputdevice/outputdevice.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/vcl/backendtest/outputdevice/outputdevice.cxx b/vcl/backendtest/outputdevice/outputdevice.cxx
index c05c03e06a3a..07d66ffb413c 100644
--- a/vcl/backendtest/outputdevice/outputdevice.cxx
+++ b/vcl/backendtest/outputdevice/outputdevice.cxx
@@ -49,6 +49,19 @@ Bitmap OutputDeviceTestAnotherOutDev::setupXOR()
mpVirtualDevice->SetFillColor(constFillColor);
mpVirtualDevice->DrawRect(aDrawRectangle);
+ mpVirtualDevice->SetRasterOp(RasterOp::Xor);
+ mpVirtualDevice->SetLineColor(constFillColor);
+ mpVirtualDevice->SetFillColor();
+ // Rectangle drawn twice is a no-op.
+ aDrawRectangle = maVDRectangle;
+ mpVirtualDevice->DrawRect(aDrawRectangle);
+ mpVirtualDevice->DrawRect(aDrawRectangle);
+ // Rectangle drawn three times is like drawing once.
+ aDrawRectangle.shrink(1);
+ mpVirtualDevice->DrawRect(aDrawRectangle);
+ mpVirtualDevice->DrawRect(aDrawRectangle);
+ mpVirtualDevice->DrawRect(aDrawRectangle);
+
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
}
@@ -64,9 +77,12 @@ TestResult OutputDeviceTestAnotherOutDev::checkDrawOutDev(Bitmap& rBitmap)
TestResult OutputDeviceTestAnotherOutDev::checkXOR(Bitmap& rBitmap)
{
+ Color xorColor( constBackgroundColor.GetRed() ^ constFillColor.GetRed(),
+ constBackgroundColor.GetGreen() ^ constFillColor.GetGreen(),
+ constBackgroundColor.GetBlue() ^ constFillColor.GetBlue());
std::vector<Color> aExpected
{
- constBackgroundColor, constBackgroundColor,
+ constBackgroundColor, xorColor,
constBackgroundColor, constBackgroundColor,
constFillColor, constFillColor,
constFillColor