QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsnullpainterdevice.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsnullpainterdevice.cpp
3 --------------------------------------
4 Date : December 2021
5 Copyright : (C) 2013 by Mathieu Pellerin
6 Email : nirvn dot asia at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
19{
20 mPaintEngine = std::make_unique<QgsNullPaintEngine>();
21}
22
24{
25 return mPaintEngine.get();
26}
27
28int QgsNullPaintDevice::metric( PaintDeviceMetric metric ) const
29{
30 // NOLINTBEGIN(bugprone-branch-clone)
31 switch ( metric )
32 {
33 case QPaintDevice::PdmWidth:
34 return mSize.width();
35 case QPaintDevice::PdmHeight:
36 return mSize.height();
37 case QPaintDevice::PdmWidthMM:
38 return mSize.width();
39 case QPaintDevice::PdmHeightMM:
40 return mSize.height();
41 case QPaintDevice::PdmNumColors:
42 return std::numeric_limits<int>::max();
43 case QPaintDevice::PdmDepth:
44 return 32;
45 case QPaintDevice::PdmDpiX:
46 case QPaintDevice::PdmDpiY:
47 case QPaintDevice::PdmPhysicalDpiX:
48 case QPaintDevice::PdmPhysicalDpiY:
49 return mDpi;
50 case QPaintDevice::PdmDevicePixelRatio:
51 return 1;
52 case QPaintDevice::PdmDevicePixelRatioScaled:
53 return 1;
54#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
55 case PdmDevicePixelRatioF_EncodedA:
56 return 1;
57 case PdmDevicePixelRatioF_EncodedB:
58 return 1;
59#endif
60 }
61 // NOLINTEND(bugprone-branch-clone)
62 return 0;
63}
QPaintEngine * paintEngine() const override
int metric(PaintDeviceMetric metric) const override