summaryrefslogtreecommitdiff
path: root/vcl/backendtest/outputdevice
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/backendtest/outputdevice')
-rw-r--r--vcl/backendtest/outputdevice/common.cxx16
-rw-r--r--vcl/backendtest/outputdevice/line.cxx4
-rw-r--r--vcl/backendtest/outputdevice/pixel.cxx4
-rw-r--r--vcl/backendtest/outputdevice/polygon.cxx6
-rw-r--r--vcl/backendtest/outputdevice/polyline.cxx4
-rw-r--r--vcl/backendtest/outputdevice/polyline_b2d.cxx50
-rw-r--r--vcl/backendtest/outputdevice/polypolygon.cxx10
-rw-r--r--vcl/backendtest/outputdevice/polypolygon_b2d.cxx65
-rw-r--r--vcl/backendtest/outputdevice/rectangle.cxx8
9 files changed, 147 insertions, 20 deletions
diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx
index 8124676d93aa..d6f1d50f8456 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -225,10 +225,14 @@ OutputDeviceTestCommon::OutputDeviceTestCommon()
: mpVirtualDevice(VclPtr<VirtualDevice>::Create())
{}
-void OutputDeviceTestCommon::initialSetup(long nWidth, long nHeight, Color aColor)
+void OutputDeviceTestCommon::initialSetup(long nWidth, long nHeight, Color aColor, bool bEnableAA)
{
maVDRectangle = tools::Rectangle(Point(), Size (nWidth, nHeight));
mpVirtualDevice->SetOutputSizePixel(maVDRectangle.GetSize());
+ if (bEnableAA)
+ mpVirtualDevice->SetAntialiasing(AntialiasingFlags::EnableB2dDraw | AntialiasingFlags::PixelSnapHairline);
+ else
+ mpVirtualDevice->SetAntialiasing(AntialiasingFlags::NONE);
mpVirtualDevice->SetBackground(Wallpaper(aColor));
mpVirtualDevice->Erase();
}
@@ -253,6 +257,16 @@ TestResult OutputDeviceTestCommon::checkRectangle(Bitmap& aBitmap)
return checkRectangles(aBitmap, aExpected);
}
+TestResult OutputDeviceTestCommon::checkRectangleAA(Bitmap& aBitmap)
+{
+ std::vector<Color> aExpected
+ {
+ constBackgroundColor, constBackgroundColor, constLineColor,
+ constBackgroundColor, constBackgroundColor, constLineColor, constBackgroundColor
+ };
+ return checkRectangles(aBitmap, aExpected);
+}
+
TestResult OutputDeviceTestCommon::checkFilledRectangle(Bitmap& aBitmap)
{
std::vector<Color> aExpected
diff --git a/vcl/backendtest/outputdevice/line.cxx b/vcl/backendtest/outputdevice/line.cxx
index 59a2294bfa38..ff03a777771e 100644
--- a/vcl/backendtest/outputdevice/line.cxx
+++ b/vcl/backendtest/outputdevice/line.cxx
@@ -31,9 +31,9 @@ void drawLineOffset(OutputDevice& rDevice, tools::Rectangle const & rRect, int n
} // end anonymous namespace
-Bitmap OutputDeviceTestLine::setupRectangle()
+Bitmap OutputDeviceTestLine::setupRectangle(bool bEnableAA)
{
- initialSetup(13, 13, constBackgroundColor);
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
diff --git a/vcl/backendtest/outputdevice/pixel.cxx b/vcl/backendtest/outputdevice/pixel.cxx
index eef758f9851e..b231396ab7ff 100644
--- a/vcl/backendtest/outputdevice/pixel.cxx
+++ b/vcl/backendtest/outputdevice/pixel.cxx
@@ -39,9 +39,9 @@ void drawPixelOffset(OutputDevice& rDevice, tools::Rectangle const & rRect, int
} // end anonymous namespace
-Bitmap OutputDeviceTestPixel::setupRectangle()
+Bitmap OutputDeviceTestPixel::setupRectangle(bool bEnableAA)
{
- initialSetup(13, 13, constBackgroundColor);
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
diff --git a/vcl/backendtest/outputdevice/polygon.cxx b/vcl/backendtest/outputdevice/polygon.cxx
index 785bc5dab72c..4a0fac9f92ed 100644
--- a/vcl/backendtest/outputdevice/polygon.cxx
+++ b/vcl/backendtest/outputdevice/polygon.cxx
@@ -30,9 +30,9 @@ void drawPolygonOffset(OutputDevice& rDevice, tools::Rectangle const & rRect, in
} // end anonymous namespace
-Bitmap OutputDeviceTestPolygon::setupRectangle()
+Bitmap OutputDeviceTestPolygon::setupRectangle(bool bEnableAA)
{
- initialSetup(13, 13, constBackgroundColor);
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
@@ -47,7 +47,7 @@ Bitmap OutputDeviceTestPolygon::setupFilledRectangle()
{
initialSetup(13, 13, constBackgroundColor);
- mpVirtualDevice->SetLineColor(constFillColor);
+ mpVirtualDevice->SetLineColor();
mpVirtualDevice->SetFillColor(constFillColor);
drawPolygonOffset(*mpVirtualDevice, maVDRectangle, 2);
diff --git a/vcl/backendtest/outputdevice/polyline.cxx b/vcl/backendtest/outputdevice/polyline.cxx
index 49894a1a2186..53a9edab9d11 100644
--- a/vcl/backendtest/outputdevice/polyline.cxx
+++ b/vcl/backendtest/outputdevice/polyline.cxx
@@ -30,9 +30,9 @@ void drawPolyLineOffset(OutputDevice& rDevice, tools::Rectangle const & rRect, i
} // end anonymous namespace
-Bitmap OutputDeviceTestPolyLine::setupRectangle()
+Bitmap OutputDeviceTestPolyLine::setupRectangle(bool bEnableAA)
{
- initialSetup(13, 13, constBackgroundColor);
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
diff --git a/vcl/backendtest/outputdevice/polyline_b2d.cxx b/vcl/backendtest/outputdevice/polyline_b2d.cxx
new file mode 100644
index 000000000000..d6b9886b41ee
--- /dev/null
+++ b/vcl/backendtest/outputdevice/polyline_b2d.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <test/outputdevice.hxx>
+
+namespace vcl
+{
+namespace test
+{
+namespace
+{
+void drawPolyLineOffset(OutputDevice& rDevice, tools::Rectangle const& rRect, int nOffset)
+{
+ basegfx::B2DPolygon aPolygon{
+ basegfx::B2DPoint(rRect.Left() + nOffset, rRect.Top() + nOffset),
+ basegfx::B2DPoint(rRect.Right() - nOffset, rRect.Top() + nOffset),
+ basegfx::B2DPoint(rRect.Right() - nOffset, rRect.Bottom() - nOffset),
+ basegfx::B2DPoint(rRect.Left() + nOffset, rRect.Bottom() - nOffset),
+ };
+ aPolygon.setClosed(true);
+
+ rDevice.DrawPolyLine(aPolygon, 0.0); // draw hairline
+}
+
+} // end anonymous namespace
+
+Bitmap OutputDeviceTestPolyLineB2D::setupRectangle(bool bEnableAA)
+{
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
+
+ mpVirtualDevice->SetLineColor(constLineColor);
+ mpVirtualDevice->SetFillColor();
+
+ drawPolyLineOffset(*mpVirtualDevice, maVDRectangle, 2);
+ drawPolyLineOffset(*mpVirtualDevice, maVDRectangle, 5);
+
+ return mpVirtualDevice->GetBitmapEx(maVDRectangle.TopLeft(), maVDRectangle.GetSize())
+ .GetBitmap();
+}
+}
+} // end namespace vcl::test
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/backendtest/outputdevice/polypolygon.cxx b/vcl/backendtest/outputdevice/polypolygon.cxx
index 10ebc85e2d62..f36db1e9fd65 100644
--- a/vcl/backendtest/outputdevice/polypolygon.cxx
+++ b/vcl/backendtest/outputdevice/polypolygon.cxx
@@ -30,9 +30,9 @@ tools::Polygon createPolygonOffset(tools::Rectangle const & rRect, int nOffset)
} // end anonymous namespace
-Bitmap OutputDeviceTestPolyPolygon::setupRectangle()
+Bitmap OutputDeviceTestPolyPolygon::setupRectangle(bool bEnableAA)
{
- initialSetup(13, 13, constBackgroundColor);
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
@@ -50,13 +50,11 @@ Bitmap OutputDeviceTestPolyPolygon::setupFilledRectangle()
{
initialSetup(13, 13, constBackgroundColor);
- mpVirtualDevice->SetLineColor(constFillColor);
+ mpVirtualDevice->SetLineColor();
mpVirtualDevice->SetFillColor(constFillColor);
- tools::PolyPolygon aPolyPolygon(3);
+ tools::PolyPolygon aPolyPolygon(1);
aPolyPolygon.Insert(createPolygonOffset(maVDRectangle, 2));
- aPolyPolygon.Insert(createPolygonOffset(maVDRectangle, 4));
- aPolyPolygon.Insert(createPolygonOffset(maVDRectangle, 4));
mpVirtualDevice->DrawPolyPolygon(aPolyPolygon);
diff --git a/vcl/backendtest/outputdevice/polypolygon_b2d.cxx b/vcl/backendtest/outputdevice/polypolygon_b2d.cxx
new file mode 100644
index 000000000000..808e8637c3d8
--- /dev/null
+++ b/vcl/backendtest/outputdevice/polypolygon_b2d.cxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <test/outputdevice.hxx>
+
+namespace vcl
+{
+namespace test
+{
+namespace
+{
+basegfx::B2DPolygon createPolygonOffset(tools::Rectangle const& rRect, int nOffset)
+{
+ basegfx::B2DPolygon aPolygon{
+ basegfx::B2DPoint(rRect.Left() + nOffset, rRect.Top() + nOffset),
+ basegfx::B2DPoint(rRect.Right() - nOffset, rRect.Top() + nOffset),
+ basegfx::B2DPoint(rRect.Right() - nOffset, rRect.Bottom() - nOffset),
+ basegfx::B2DPoint(rRect.Left() + nOffset, rRect.Bottom() - nOffset),
+ };
+ aPolygon.setClosed(true);
+ return aPolygon;
+}
+
+} // end anonymous namespace
+
+Bitmap OutputDeviceTestPolyPolygonB2D::setupRectangle(bool bEnableAA)
+{
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
+
+ mpVirtualDevice->SetLineColor(constLineColor);
+ mpVirtualDevice->SetFillColor();
+
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ aPolyPolygon.append(createPolygonOffset(maVDRectangle, 2));
+ aPolyPolygon.append(createPolygonOffset(maVDRectangle, 5));
+
+ mpVirtualDevice->DrawPolyPolygon(aPolyPolygon);
+
+ return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
+
+Bitmap OutputDeviceTestPolyPolygonB2D::setupFilledRectangle()
+{
+ initialSetup(13, 13, constBackgroundColor);
+
+ mpVirtualDevice->SetLineColor();
+ mpVirtualDevice->SetFillColor(constFillColor);
+
+ basegfx::B2DPolyPolygon aPolyPolygon(createPolygonOffset(maVDRectangle, 2));
+
+ mpVirtualDevice->DrawPolyPolygon(aPolyPolygon);
+
+ return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
+}
+} // end namespace vcl::test
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/backendtest/outputdevice/rectangle.cxx b/vcl/backendtest/outputdevice/rectangle.cxx
index 199c299b2b2d..a491d67f5c52 100644
--- a/vcl/backendtest/outputdevice/rectangle.cxx
+++ b/vcl/backendtest/outputdevice/rectangle.cxx
@@ -27,18 +27,17 @@ Bitmap OutputDeviceTestRect::setupFilledRectangle()
{
initialSetup(13, 13, constBackgroundColor);
- mpVirtualDevice->SetLineColor(constFillColor);
+ mpVirtualDevice->SetLineColor();
mpVirtualDevice->SetFillColor(constFillColor);
drawRectOffset(*mpVirtualDevice, maVDRectangle, 2);
- drawRectOffset(*mpVirtualDevice, maVDRectangle, 5);
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
}
-Bitmap OutputDeviceTestRect::setupRectangle()
+Bitmap OutputDeviceTestRect::setupRectangle(bool bEnableAA)
{
- initialSetup(13, 13, constBackgroundColor);
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
@@ -49,6 +48,7 @@ Bitmap OutputDeviceTestRect::setupRectangle()
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
}
+
}} // end namespace vcl::test
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */