1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
11 #include <test/outputdevice.hxx>
17 void drawPixelOffset(OutputDevice
& rDevice
, tools::Rectangle
const& rRect
, int nOffset
)
19 int nMidOffset
= rRect
.GetWidth() / 2;
20 for (tools::Long x
= 0 + nOffset
/ 2; x
< (rRect
.GetWidth() - nMidOffset
); ++x
)
22 tools::Long y1
= nOffset
- 1;
23 tools::Long y2
= rRect
.GetHeight() - nOffset
;
25 rDevice
.DrawPixel(Point(x
, y1
));
26 rDevice
.DrawPixel(Point(x
, y2
));
29 for (tools::Long y
= 0 + nOffset
; y
< (rRect
.GetHeight() - nOffset
); ++y
)
31 tools::Long x1
= nOffset
/ 2;
32 tools::Long x2
= rRect
.GetWidth() - nMidOffset
- nOffset
/ std::max((nOffset
- 3), 2);
34 rDevice
.DrawPixel(Point(x1
, y
));
35 rDevice
.DrawPixel(Point(x2
, y
));
39 } // end anonymous namespace
41 Bitmap
OutputDeviceTestPixel::setupRectangle(bool bEnableAA
)
43 initialSetup(13, 13, constBackgroundColor
, bEnableAA
);
45 mpVirtualDevice
->SetLineColor(constLineColor
);
46 mpVirtualDevice
->SetFillColor();
48 drawPixelOffset(*mpVirtualDevice
, maVDRectangle
, 2);
49 drawPixelOffset(*mpVirtualDevice
, maVDRectangle
, 5);
51 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
54 Bitmap
OutputDeviceTestPixel::setupRectangleOnSize1028()
56 initialSetup(1028, 1028, constBackgroundColor
);
58 mpVirtualDevice
->SetLineColor(constLineColor
);
59 mpVirtualDevice
->SetFillColor();
61 drawPixelOffset(*mpVirtualDevice
, maVDRectangle
, 2);
62 drawPixelOffset(*mpVirtualDevice
, maVDRectangle
, 5);
64 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
67 Bitmap
OutputDeviceTestPixel::setupRectangleOnSize4096()
69 initialSetup(4096, 4096, constBackgroundColor
);
71 mpVirtualDevice
->SetLineColor(constLineColor
);
72 mpVirtualDevice
->SetFillColor();
74 drawPixelOffset(*mpVirtualDevice
, maVDRectangle
, 2);
75 drawPixelOffset(*mpVirtualDevice
, maVDRectangle
, 5);
77 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
80 } // end namespace vcl::test
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */