nss: upgrade to release 3.73
[LibreOffice.git] / vcl / backendtest / outputdevice / rectangle.cxx
blob1401a39e16955948aee17e081e6905e5033f0573
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>
13 namespace vcl::test
15 namespace
17 void drawRectOffset(OutputDevice& rDevice, tools::Rectangle const& rRect, int nOffset)
19 rDevice.DrawRect(tools::Rectangle(rRect.Left() + nOffset, rRect.Top() + nOffset,
20 rRect.Right() - nOffset, rRect.Bottom() - nOffset));
23 void drawInvertOffset(OutputDevice& rDevice, tools::Rectangle const& rRect, int nOffset,
24 InvertFlags eFlags)
26 tools::Rectangle aRectangle(rRect.Left() + nOffset, rRect.Top() + nOffset,
27 rRect.Right() - nOffset, rRect.Bottom() - nOffset);
28 rDevice.Invert(aRectangle, eFlags);
31 } // end anonymous namespace
33 Bitmap OutputDeviceTestRect::setupFilledRectangle(bool useLineColor)
35 initialSetup(13, 13, constBackgroundColor);
37 if (useLineColor)
38 mpVirtualDevice->SetLineColor(constLineColor);
39 else
40 mpVirtualDevice->SetLineColor();
41 mpVirtualDevice->SetFillColor(constFillColor);
43 drawRectOffset(*mpVirtualDevice, maVDRectangle, 2);
45 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
48 Bitmap OutputDeviceTestRect::setupRectangle(bool bEnableAA)
50 initialSetup(13, 13, constBackgroundColor, bEnableAA);
52 mpVirtualDevice->SetLineColor(constLineColor);
53 mpVirtualDevice->SetFillColor();
55 drawRectOffset(*mpVirtualDevice, maVDRectangle, 2);
56 drawRectOffset(*mpVirtualDevice, maVDRectangle, 5);
58 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
61 Bitmap OutputDeviceTestRect::setupInvert_NONE()
63 initialSetup(20, 20, COL_WHITE);
65 mpVirtualDevice->SetLineColor();
66 mpVirtualDevice->SetFillColor(COL_LIGHTRED);
67 mpVirtualDevice->DrawRect(tools::Rectangle(Point(2, 2), Size(8, 8)));
68 mpVirtualDevice->SetFillColor(COL_LIGHTGREEN);
69 mpVirtualDevice->DrawRect(tools::Rectangle(Point(10, 2), Size(8, 8)));
70 mpVirtualDevice->SetFillColor(COL_LIGHTBLUE);
71 mpVirtualDevice->DrawRect(tools::Rectangle(Point(2, 10), Size(8, 8)));
73 drawInvertOffset(*mpVirtualDevice, maVDRectangle, 2, InvertFlags::NONE);
75 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
78 Bitmap OutputDeviceTestRect::setupInvert_N50()
80 initialSetup(20, 20, COL_WHITE);
82 mpVirtualDevice->SetLineColor();
83 mpVirtualDevice->SetFillColor(COL_LIGHTRED);
84 mpVirtualDevice->DrawRect(tools::Rectangle(Point(2, 2), Size(8, 8)));
85 mpVirtualDevice->SetFillColor(COL_LIGHTGREEN);
86 mpVirtualDevice->DrawRect(tools::Rectangle(Point(10, 2), Size(8, 8)));
87 mpVirtualDevice->SetFillColor(COL_LIGHTBLUE);
88 mpVirtualDevice->DrawRect(tools::Rectangle(Point(2, 10), Size(8, 8)));
90 drawInvertOffset(*mpVirtualDevice, maVDRectangle, 2, InvertFlags::N50);
92 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
95 Bitmap OutputDeviceTestRect::setupInvert_TrackFrame()
97 initialSetup(20, 20, COL_WHITE);
99 mpVirtualDevice->SetLineColor();
100 mpVirtualDevice->SetFillColor(COL_LIGHTRED);
101 mpVirtualDevice->DrawRect(tools::Rectangle(Point(2, 2), Size(8, 8)));
102 mpVirtualDevice->SetFillColor(COL_LIGHTGREEN);
103 mpVirtualDevice->DrawRect(tools::Rectangle(Point(10, 2), Size(8, 8)));
104 mpVirtualDevice->SetFillColor(COL_LIGHTBLUE);
105 mpVirtualDevice->DrawRect(tools::Rectangle(Point(2, 10), Size(8, 8)));
107 drawInvertOffset(*mpVirtualDevice, maVDRectangle, 2, InvertFlags::TrackFrame);
109 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
112 } // end namespace vcl::test
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */