Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / vcl / backendtest / outputdevice / polypolygon.cxx
blobf36db1e9fd651540bd0103b2e410e28b8fd37561
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
11 #include <test/outputdevice.hxx>
14 namespace vcl {
15 namespace test {
17 namespace
20 tools::Polygon createPolygonOffset(tools::Rectangle const & rRect, int nOffset)
22 tools::Polygon aPolygon(4);
23 aPolygon.SetPoint(Point(rRect.Left() + nOffset, rRect.Top() + nOffset), 0);
24 aPolygon.SetPoint(Point(rRect.Right() - nOffset, rRect.Top() + nOffset), 1);
25 aPolygon.SetPoint(Point(rRect.Right() - nOffset, rRect.Bottom() - nOffset), 2);
26 aPolygon.SetPoint(Point(rRect.Left() + nOffset, rRect.Bottom() - nOffset), 3);
27 aPolygon.Optimize(PolyOptimizeFlags::CLOSE);
28 return aPolygon;
31 } // end anonymous namespace
33 Bitmap OutputDeviceTestPolyPolygon::setupRectangle(bool bEnableAA)
35 initialSetup(13, 13, constBackgroundColor, bEnableAA);
37 mpVirtualDevice->SetLineColor(constLineColor);
38 mpVirtualDevice->SetFillColor();
40 tools::PolyPolygon aPolyPolygon(2);
41 aPolyPolygon.Insert(createPolygonOffset(maVDRectangle, 2));
42 aPolyPolygon.Insert(createPolygonOffset(maVDRectangle, 5));
44 mpVirtualDevice->DrawPolyPolygon(aPolyPolygon);
46 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
49 Bitmap OutputDeviceTestPolyPolygon::setupFilledRectangle()
51 initialSetup(13, 13, constBackgroundColor);
53 mpVirtualDevice->SetLineColor();
54 mpVirtualDevice->SetFillColor(constFillColor);
56 tools::PolyPolygon aPolyPolygon(1);
57 aPolyPolygon.Insert(createPolygonOffset(maVDRectangle, 2));
59 mpVirtualDevice->DrawPolyPolygon(aPolyPolygon);
61 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
64 }} // end namespace vcl::test
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */