Fix GNU C++ version check
[LibreOffice.git] / vcl / backendtest / outputdevice / outputdevice.cxx
blobca58e006fd4930ce56634e254b27140e17d8949e
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 OutputDeviceTestAnotherOutDev::setupDrawOutDev()
17 ScopedVclPtrInstance<VirtualDevice> pSourceDev;
18 Size aSourceSize(9, 9);
19 pSourceDev->SetOutputSizePixel(aSourceSize);
20 pSourceDev->SetBackground(Wallpaper(constFillColor));
21 pSourceDev->Erase();
23 initialSetup(13, 13, constBackgroundColor);
25 mpVirtualDevice->DrawOutDev(Point(2, 2), aSourceSize, Point(), aSourceSize, *pSourceDev);
27 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
31 Bitmap OutputDeviceTestAnotherOutDev::setupDrawOutDevScaledClipped()
33 ScopedVclPtrInstance<VirtualDevice> pSourceDev;
34 Size aSourceSize(18, 18);
35 pSourceDev->SetOutputSizePixel(aSourceSize);
36 pSourceDev->SetBackground(Wallpaper(constFillColor));
37 pSourceDev->Erase();
39 initialSetup(13, 13, constBackgroundColor);
41 tools::Rectangle rectangle = maVDRectangle;
42 rectangle.SetLeft(rectangle.GetWidth() / 2);
43 mpVirtualDevice->SetClipRegion(vcl::Region(rectangle));
45 mpVirtualDevice->DrawOutDev(Point(2, 2), aSourceSize / 2, Point(), aSourceSize, *pSourceDev);
47 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
50 Bitmap OutputDeviceTestAnotherOutDev::setupDrawOutDevSelf()
52 initialSetup(13, 13, constBackgroundColor);
54 mpVirtualDevice->SetLineColor();
55 mpVirtualDevice->SetFillColor(constFillColor);
57 tools::Rectangle aDrawRectangle(maVDRectangle);
58 aDrawRectangle.shrink(3);
59 aDrawRectangle.Move( 2, -2 );
60 mpVirtualDevice->DrawRect(aDrawRectangle);
61 mpVirtualDevice->SetLineColor(COL_YELLOW);
62 mpVirtualDevice->DrawPixel(aDrawRectangle.TopLeft() + Point(aDrawRectangle.GetWidth() - 1, 0));
63 mpVirtualDevice->DrawPixel(aDrawRectangle.TopLeft() + Point(0,aDrawRectangle.GetHeight() - 1));
65 // Intentionally overlap a bit.
66 mpVirtualDevice->DrawOutDev(Point(1, 5), aDrawRectangle.GetSize(),
67 Point(5,1), aDrawRectangle.GetSize(), *mpVirtualDevice);
69 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
72 Bitmap OutputDeviceTestAnotherOutDev::setupXOR()
74 initialSetup(13, 13, constBackgroundColor);
76 tools::Rectangle aDrawRectangle(maVDRectangle);
77 aDrawRectangle.shrink(2);
79 tools::Rectangle aScissorRectangle(maVDRectangle);
80 aScissorRectangle.shrink(4);
82 mpVirtualDevice->SetRasterOp(RasterOp::Xor);
83 mpVirtualDevice->SetFillColor(constFillColor);
84 mpVirtualDevice->DrawRect(aDrawRectangle);
86 mpVirtualDevice->SetRasterOp(RasterOp::N0);
87 mpVirtualDevice->SetFillColor(COL_BLACK);
88 mpVirtualDevice->DrawRect(aScissorRectangle);
90 mpVirtualDevice->SetRasterOp(RasterOp::Xor);
91 mpVirtualDevice->SetFillColor(constFillColor);
92 mpVirtualDevice->DrawRect(aDrawRectangle);
94 mpVirtualDevice->SetRasterOp(RasterOp::Xor);
95 mpVirtualDevice->SetLineColor(constFillColor);
96 mpVirtualDevice->SetFillColor();
97 // Rectangle drawn twice is a no-op.
98 aDrawRectangle = maVDRectangle;
99 mpVirtualDevice->DrawRect(aDrawRectangle);
100 mpVirtualDevice->DrawRect(aDrawRectangle);
101 // Rectangle drawn three times is like drawing once.
102 aDrawRectangle.shrink(1);
103 mpVirtualDevice->DrawRect(aDrawRectangle);
104 mpVirtualDevice->DrawRect(aDrawRectangle);
105 mpVirtualDevice->DrawRect(aDrawRectangle);
107 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
110 } // end namespace vcl::test
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */