summaryrefslogtreecommitdiff
path: root/vcl/backendtest/outputdevice/polygon.cxx
diff options
context:
space:
mode:
authorhomeboy445 <akshitsan13@gmail.com>2021-07-13 21:04:46 +0530
committerTomaž Vajngerl <quikee@gmail.com>2021-08-16 13:49:38 +0200
commite401a3385ae9dd767bc815085535cd30a658f054 (patch)
tree08f7234b4d7d36fb7d70cc201c5b9dfcc81d129f /vcl/backendtest/outputdevice/polygon.cxx
parent183f66f79b40b6159a0edcf1b49c3aa612c90525 (diff)
backendtest: Asymmetrical Filled Drop Like Shape test
Change-Id: Iacf121483aefa71d6f24e14782fcaf22c0d5d56e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118859 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/backendtest/outputdevice/polygon.cxx')
-rw-r--r--vcl/backendtest/outputdevice/polygon.cxx43
1 files changed, 27 insertions, 16 deletions
diff --git a/vcl/backendtest/outputdevice/polygon.cxx b/vcl/backendtest/outputdevice/polygon.cxx
index a94bf0a6f306..82593bc432c8 100644
--- a/vcl/backendtest/outputdevice/polygon.cxx
+++ b/vcl/backendtest/outputdevice/polygon.cxx
@@ -10,22 +10,22 @@
#include <test/outputdevice.hxx>
-namespace vcl::test {
-
+namespace vcl::test
+{
namespace
{
-
-void drawPolygonOffset(OutputDevice& rDevice, tools::Rectangle const & rRect, int nOffset, int nFix = 0)
+void drawPolygonOffset(OutputDevice& rDevice, tools::Rectangle const& rRect, int nOffset,
+ int nFix = 0)
{
// Note: According to https://lists.freedesktop.org/archives/libreoffice/2019-November/083709.html
// filling polygons always skips the right-most and bottom-most pixels, in order to avoid
// overlaps when drawing adjacent polygons. Specifying nFix = 1 allows to visually compensate
// for this by making the polygon explicitly larger.
tools::Polygon aPolygon(4);
- aPolygon.SetPoint(Point(rRect.Left() + nOffset, rRect.Top() + nOffset), 0);
- aPolygon.SetPoint(Point(rRect.Right() - nOffset + nFix, rRect.Top() + nOffset), 1);
+ aPolygon.SetPoint(Point(rRect.Left() + nOffset, rRect.Top() + nOffset), 0);
+ aPolygon.SetPoint(Point(rRect.Right() - nOffset + nFix, rRect.Top() + nOffset), 1);
aPolygon.SetPoint(Point(rRect.Right() - nOffset + nFix, rRect.Bottom() - nOffset + nFix), 2);
- aPolygon.SetPoint(Point(rRect.Left() + nOffset, rRect.Bottom() - nOffset + nFix), 3);
+ aPolygon.SetPoint(Point(rRect.Left() + nOffset, rRect.Bottom() - nOffset + nFix), 3);
aPolygon.Optimize(PolyOptimizeFlags::CLOSE);
rDevice.DrawPolygon(aPolygon);
@@ -50,7 +50,7 @@ Bitmap OutputDeviceTestPolygon::setupFilledRectangle(bool useLineColor)
{
initialSetup(13, 13, constBackgroundColor);
- if(useLineColor)
+ if (useLineColor)
mpVirtualDevice->SetLineColor(constLineColor);
else
mpVirtualDevice->SetLineColor();
@@ -68,7 +68,8 @@ Bitmap OutputDeviceTestPolygon::setupDiamond()
mpVirtualDevice->SetFillColor();
Point aPoint1, aPoint2, aPoint3, aPoint4;
- OutputDeviceTestCommon::createDiamondPoints(maVDRectangle, 4, aPoint1, aPoint2, aPoint3, aPoint4);
+ OutputDeviceTestCommon::createDiamondPoints(maVDRectangle, 4, aPoint1, aPoint2, aPoint3,
+ aPoint4);
tools::Polygon aPolygon(4);
@@ -95,9 +96,8 @@ Bitmap OutputDeviceTestPolygon::setupLines()
Point aDiagonalLinePoint1, aDiagonalLinePoint2;
OutputDeviceTestCommon::createHorizontalVerticalDiagonalLinePoints(
- maVDRectangle, aHorizontalLinePoint1, aHorizontalLinePoint2,
- aVerticalLinePoint1, aVerticalLinePoint2,
- aDiagonalLinePoint1, aDiagonalLinePoint2);
+ maVDRectangle, aHorizontalLinePoint1, aHorizontalLinePoint2, aVerticalLinePoint1,
+ aVerticalLinePoint2, aDiagonalLinePoint1, aDiagonalLinePoint2);
tools::Polygon aHorizontalPolygon(2);
aHorizontalPolygon.SetPoint(aHorizontalLinePoint1, 0);
@@ -130,9 +130,8 @@ Bitmap OutputDeviceTestPolygon::setupAALines()
Point aDiagonalLinePoint1, aDiagonalLinePoint2;
OutputDeviceTestCommon::createHorizontalVerticalDiagonalLinePoints(
- maVDRectangle, aHorizontalLinePoint1, aHorizontalLinePoint2,
- aVerticalLinePoint1, aVerticalLinePoint2,
- aDiagonalLinePoint1, aDiagonalLinePoint2);
+ maVDRectangle, aHorizontalLinePoint1, aHorizontalLinePoint2, aVerticalLinePoint1,
+ aVerticalLinePoint2, aDiagonalLinePoint1, aDiagonalLinePoint2);
tools::Polygon aHorizontalPolygon(2);
aHorizontalPolygon.SetPoint(aHorizontalLinePoint1, 0);
@@ -166,7 +165,7 @@ Bitmap OutputDeviceTestPolygon::setupDropShape()
Bitmap OutputDeviceTestPolygon::setupAADropShape()
{
- initialSetup(21, 21, constBackgroundColor,true);
+ initialSetup(21, 21, constBackgroundColor, true);
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
@@ -200,6 +199,18 @@ Bitmap OutputDeviceTestPolygon::setupClosedBezier()
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
}
+
+Bitmap OutputDeviceTestPolygon::setupFilledAsymmetricalDropShape()
+{
+ initialSetup(21, 21, constBackgroundColor);
+
+ mpVirtualDevice->SetLineColor();
+ mpVirtualDevice->SetFillColor(constFillColor);
+
+ mpVirtualDevice->DrawPolygon(OutputDeviceTestCommon::createDropShapePolygon());
+
+ return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
} // end namespace vcl::test
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */