SalInvert::N50 has 1x1 pixel checker size, not 2x2 (tdf#131580)
This can be seen with widget styles that use invert() to draw focus
rectangle, such as with VCL gen or win backends.
Change-Id: I7fb36d1be5333e917f871f8504585e32abe82b5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91380
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx
index e76150c..f9052fb 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -302,11 +302,11 @@ TestResult OutputDeviceTestCommon::checkChecker(Bitmap& rBitmap, sal_Int32 nStar
TestResult aReturnValue = TestResult::Passed;
int choice = 0;
for (sal_Int32 y = nStartY; y <= nEndY; y+=2)
for (sal_Int32 y = nStartY; y <= nEndY; ++y)
{
for (sal_Int32 x = nStartX; x <= nEndX; x+=2)
for (sal_Int32 x = nStartX; x <= nEndX; ++x)
{
TestResult eResult = checkFilled(rBitmap, tools::Rectangle(Point(x, y), Size(2, 2)), rExpected[choice % 2]);
TestResult eResult = checkFilled(rBitmap, tools::Rectangle(Point(x, y), Size(1, 1)), rExpected[choice % 2]);
checkResult(eResult, aReturnValue);
choice++;
}
@@ -324,13 +324,13 @@ TestResult OutputDeviceTestCommon::checkInvertN50Rectangle(Bitmap& aBitmap)
eResult = checkRectangles(aBitmap, aExpected);
checkResult(eResult, aReturnValue);
eResult = checkChecker(aBitmap, 2, 8, 2, 8, { COL_LIGHTCYAN, COL_LIGHTRED });
eResult = checkChecker(aBitmap, 2, 9, 2, 9, { COL_LIGHTCYAN, COL_LIGHTRED });
checkResult(eResult, aReturnValue);
eResult = checkChecker(aBitmap, 2, 8, 10, 16, { COL_YELLOW, COL_LIGHTBLUE });
eResult = checkChecker(aBitmap, 2, 9, 10, 17, { COL_YELLOW, COL_LIGHTBLUE });
checkResult(eResult, aReturnValue);
eResult = checkChecker(aBitmap, 10, 16, 2, 8, { COL_LIGHTMAGENTA, COL_LIGHTGREEN });
eResult = checkChecker(aBitmap, 10, 17, 2, 9, { COL_LIGHTMAGENTA, COL_LIGHTGREEN });
checkResult(eResult, aReturnValue);
eResult = checkChecker(aBitmap, 10, 16, 10, 16, { COL_BLACK, COL_WHITE });
eResult = checkChecker(aBitmap, 10, 17, 10, 17, { COL_BLACK, COL_WHITE });
checkResult(eResult, aReturnValue);
return aReturnValue;
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 9529fd5..127c0d6 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1067,35 +1067,21 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFl
aPaint.setStyle(SkPaint::kFill_Style);
aPaint.setBlendMode(SkBlendMode::kDifference);
// N50 inverts in 4x4 checker pattern
// N50 inverts in checker pattern
if (eFlags == SalInvert::N50)
{
// This creates 4x4 checker pattern bitmap
// This creates 2x2 checker pattern bitmap
// TODO Use SkiaHelper::createSkSurface() and cache the image
SkBitmap aBitmap;
aBitmap.allocN32Pixels(4, 4);
aBitmap.allocN32Pixels(2, 2);
const SkPMColor white = SkPreMultiplyARGB(0xFF, 0xFF, 0xFF, 0xFF);
const SkPMColor black = SkPreMultiplyARGB(0xFF, 0x00, 0x00, 0x00);
SkPMColor* scanline;
scanline = aBitmap.getAddr32(0, 0);
*scanline++ = white;
*scanline++ = white;
*scanline++ = black;
*scanline++ = black;
scanline = aBitmap.getAddr32(0, 1);
*scanline++ = white;
*scanline++ = white;
*scanline++ = black;
*scanline++ = black;
scanline = aBitmap.getAddr32(0, 2);
*scanline++ = black;
*scanline++ = black;
*scanline++ = white;
*scanline++ = white;
scanline = aBitmap.getAddr32(0, 3);
*scanline++ = black;
*scanline++ = black;
*scanline++ = white;
*scanline++ = white;
aBitmap.setImmutable();
// The bitmap is repeated in both directions the checker pattern is as big