summaryrefslogtreecommitdiff
path: root/vcl/backendtest
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-10-23 21:50:12 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-11-27 09:55:11 +0100
commite3d0b69c7f26ca8df261c67476355290387f5c68 (patch)
treeab7e64a98fa4bb437fd0f1c08aa00c31a1a26da4 /vcl/backendtest
parent25fad1c74a6c601677b6fcec090cd06a453b86c9 (diff)
backendtest: Add PolyLine B2D test diamond
Change-Id: I6e754e72ff698d62c493b827f9804f63d0e39e2d
Diffstat (limited to 'vcl/backendtest')
-rw-r--r--vcl/backendtest/outputdevice/polyline_b2d.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/vcl/backendtest/outputdevice/polyline_b2d.cxx b/vcl/backendtest/outputdevice/polyline_b2d.cxx
index b59685c7a817..43b814b2915e 100644
--- a/vcl/backendtest/outputdevice/polyline_b2d.cxx
+++ b/vcl/backendtest/outputdevice/polyline_b2d.cxx
@@ -30,6 +30,17 @@ void drawPolyLineOffset(OutputDevice& rDevice, tools::Rectangle const& rRect, in
rDevice.DrawPolyLine(aPolygon, 0.0); // draw hairline
}
+void addDiamondPoints(tools::Rectangle rRect, int nOffset, basegfx::B2DPolygon& rPolygon)
+{
+ double midPointX = rRect.Left() + (rRect.Right() - rRect.Left()) / 2.0;
+ double midPointY = rRect.Top() + (rRect.Bottom() - rRect.Top()) / 2.0;
+
+ rPolygon.append({ midPointX, midPointY - nOffset });
+ rPolygon.append({ midPointX + nOffset, midPointY });
+ rPolygon.append({ midPointX, midPointY + nOffset });
+ rPolygon.append({ midPointX - nOffset, midPointY });
+}
+
} // end anonymous namespace
Bitmap OutputDeviceTestPolyLineB2D::setupRectangle(bool bEnableAA)
@@ -45,6 +56,22 @@ Bitmap OutputDeviceTestPolyLineB2D::setupRectangle(bool bEnableAA)
return mpVirtualDevice->GetBitmapEx(maVDRectangle.TopLeft(), maVDRectangle.GetSize())
.GetBitmap();
}
+
+Bitmap OutputDeviceTestPolyLineB2D::setupDiamond()
+{
+ initialSetup(11, 11, constBackgroundColor);
+
+ mpVirtualDevice->SetLineColor(constLineColor);
+ mpVirtualDevice->SetFillColor();
+
+ basegfx::B2DPolygon aPolygon;
+ addDiamondPoints(maVDRectangle, 4, aPolygon);
+ aPolygon.setClosed(true);
+
+ mpVirtualDevice->DrawPolyLine(aPolygon);
+
+ return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
}
} // end namespace vcl::test