summaryrefslogtreecommitdiff
path: root/vcl/backendtest/outputdevice
diff options
context:
space:
mode:
authorhomeboy445 <akshitsan13@gmail.com>2021-07-22 17:05:33 +0530
committerTomaž Vajngerl <quikee@gmail.com>2021-08-27 05:29:35 +0200
commitc46d2c25ee790d02a97ed6bc7403571a2a0823bd (patch)
tree0cb381ab46112cc405679b27d47770b6ef10e257 /vcl/backendtest/outputdevice
parent9ed35109abb4179a3ab77498f550b4b9868e9cbc (diff)
backendtest: Test Drawing Bitmap other than 24bpp
This test draws bitmap formats other than 24bpp - namely 32bpp and 8bpp greyscale. Change-Id: I1b21214429be08fc7cf1eb086c2ad8946780f481 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119371 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/backendtest/outputdevice')
-rw-r--r--vcl/backendtest/outputdevice/bitmap.cxx36
1 files changed, 26 insertions, 10 deletions
diff --git a/vcl/backendtest/outputdevice/bitmap.cxx b/vcl/backendtest/outputdevice/bitmap.cxx
index 2c7d7569cde6..066355c53f14 100644
--- a/vcl/backendtest/outputdevice/bitmap.cxx
+++ b/vcl/backendtest/outputdevice/bitmap.cxx
@@ -15,10 +15,10 @@
namespace vcl::test {
-Bitmap OutputDeviceTestBitmap::setupDrawTransformedBitmap()
+Bitmap OutputDeviceTestBitmap::setupDrawTransformedBitmap(vcl::PixelFormat aBitmapFormat,bool isBitmapGreyScale)
{
Size aBitmapSize(9, 9);
- Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
+ Bitmap aBitmap(aBitmapSize, aBitmapFormat);
{
BitmapScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(constFillColor);
@@ -27,6 +27,9 @@ Bitmap OutputDeviceTestBitmap::setupDrawTransformedBitmap()
aWriteAccess->DrawRect(tools::Rectangle(2, 2, 6, 6));
}
+ if (isBitmapGreyScale)
+ aBitmap.Convert(BmpConversion::N8BitGreys);
+
initialSetup(13, 13, constBackgroundColor);
basegfx::B2DHomMatrix aTransform;
@@ -40,10 +43,10 @@ Bitmap OutputDeviceTestBitmap::setupDrawTransformedBitmap()
}
-Bitmap OutputDeviceTestBitmap::setupDrawBitmap()
+Bitmap OutputDeviceTestBitmap::setupDrawBitmap(vcl::PixelFormat aBitmapFormat,bool isBitmapGreyScale)
{
Size aBitmapSize(9, 9);
- Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
+ Bitmap aBitmap(aBitmapSize, aBitmapFormat);
{
BitmapScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(constFillColor);
@@ -52,6 +55,9 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmap()
aWriteAccess->DrawRect(tools::Rectangle(2, 2, 6, 6));
}
+ if (isBitmapGreyScale)
+ aBitmap.Convert(BmpConversion::N8BitGreys);
+
initialSetup(13, 13, constBackgroundColor);
Point aPoint((maVDRectangle.GetWidth() / 2.0) - (aBitmapSize.Width() / 2.0),
@@ -62,10 +68,10 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmap()
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
}
-Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha()
+Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha(vcl::PixelFormat aBitmapFormat)
{
Size aBitmapSize(9, 9);
- Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
+ Bitmap aBitmap(aBitmapSize, aBitmapFormat);
{
BitmapScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(COL_WHITE);
@@ -92,10 +98,10 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha()
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
}
-Bitmap OutputDeviceTestBitmap::setupDrawMask()
+Bitmap OutputDeviceTestBitmap::setupDrawMask(vcl::PixelFormat aBitmapFormat)
{
Size aBitmapSize(9, 9);
- Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
+ Bitmap aBitmap(aBitmapSize, aBitmapFormat);
{
BitmapScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(COL_WHITE);
@@ -111,10 +117,10 @@ Bitmap OutputDeviceTestBitmap::setupDrawMask()
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
}
-BitmapEx OutputDeviceTestBitmap::setupDrawBlend()
+BitmapEx OutputDeviceTestBitmap::setupDrawBlend(vcl::PixelFormat aBitmapFormat)
{
Size aBitmapSize(9, 9);
- Bitmap aBitmap(aBitmapSize, vcl::PixelFormat::N24_BPP);
+ Bitmap aBitmap(aBitmapSize, aBitmapFormat);
{
BitmapScopedWriteAccess aWriteAccess(aBitmap);
aWriteAccess->Erase(COL_WHITE);
@@ -157,6 +163,16 @@ TestResult OutputDeviceTestBitmap::checkTransformedBitmap(Bitmap& rBitmap)
return checkRectangles(rBitmap, aExpected);
}
+TestResult OutputDeviceTestBitmap::checkTransformedBitmap8bppGreyScale(Bitmap& rBitmap)
+{
+ std::vector<Color> aExpected
+ {
+ Color(0xC0,0xC0,0xC0), Color(0xC0,0xC0,0xC0),
+ Color(0xE2,0xE2,0xE2), Color(0xE,0xE,0xE), Color(0xE2,0xE2,0xE2), Color(0xE,0xE,0xE), Color(0xE,0xE,0xE)
+ };
+ return checkRectangles(rBitmap, aExpected);
+}
+
TestResult OutputDeviceTestBitmap::checkBitmapExWithAlpha(Bitmap& rBitmap)
{
const Color aBlendedColor(0xEE, 0xEE, 0x33);