nss: upgrade to release 3.73
[LibreOffice.git] / vcl / backendtest / outputdevice / clip.cxx
blob86064b583610ec0a22e644f78411d60c695b3022
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 Bitmap OutputDeviceTestClip::setupClipRectangle()
17 initialSetup(13, 13, constBackgroundColor);
19 tools::Rectangle rectangle = maVDRectangle;
20 rectangle.shrink(2);
21 mpVirtualDevice->SetClipRegion(vcl::Region(rectangle));
22 mpVirtualDevice->SetBackground(constFillColor);
23 mpVirtualDevice->Erase(maVDRectangle);
25 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
28 Bitmap OutputDeviceTestClip::setupClipPolygon()
30 initialSetup(13, 13, constBackgroundColor);
32 tools::Rectangle rectangle = maVDRectangle;
33 rectangle.shrink(2);
34 mpVirtualDevice->SetClipRegion(vcl::Region(tools::Polygon(rectangle)));
35 mpVirtualDevice->SetBackground(constFillColor);
36 mpVirtualDevice->Erase(maVDRectangle);
38 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
41 Bitmap OutputDeviceTestClip::setupClipPolyPolygon()
43 initialSetup(13, 13, constBackgroundColor);
45 tools::Rectangle rectangle = maVDRectangle;
46 rectangle.shrink(2);
47 mpVirtualDevice->SetClipRegion(vcl::Region(tools::PolyPolygon(rectangle)));
48 mpVirtualDevice->SetBackground(constFillColor);
49 mpVirtualDevice->Erase(maVDRectangle);
51 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
54 Bitmap OutputDeviceTestClip::setupClipB2DPolyPolygon()
56 initialSetup(13, 13, constBackgroundColor);
58 tools::Rectangle rectangle = maVDRectangle;
59 rectangle.shrink(2);
60 mpVirtualDevice->SetClipRegion(vcl::Region(basegfx::B2DPolyPolygon(basegfx::B2DPolygon{
61 basegfx::B2DPoint(rectangle.getX(), rectangle.getY()),
62 basegfx::B2DPoint(rectangle.getX(), rectangle.getY() + rectangle.getHeight()),
63 basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(),
64 rectangle.getY() + rectangle.getHeight()),
65 basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(), rectangle.getY()),
66 })));
67 mpVirtualDevice->SetBackground(constFillColor);
68 mpVirtualDevice->Erase(maVDRectangle);
70 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
73 TestResult OutputDeviceTestClip::checkClip(Bitmap& aBitmap)
75 std::vector<Color> aExpected{ constBackgroundColor, constBackgroundColor, constFillColor,
76 constFillColor, constFillColor, constFillColor,
77 constFillColor };
78 return checkRectangles(aBitmap, aExpected);
81 } // end namespace vcl::test
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */