QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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
18
20{
21 mPaintEngine = std::make_unique<QgsNullPaintEngine>();
22}
23
25{
26 return mPaintEngine.get();
27}
28
29int QgsNullPaintDevice::metric( PaintDeviceMetric metric ) const
30{
31 // NOLINTBEGIN(bugprone-branch-clone)
32 switch ( metric )
33 {
34 case QPaintDevice::PdmWidth:
35 return mSize.width();
36 case QPaintDevice::PdmHeight:
37 return mSize.height();
38 case QPaintDevice::PdmWidthMM:
39 return mSize.width();
40 case QPaintDevice::PdmHeightMM:
41 return mSize.height();
42 case QPaintDevice::PdmNumColors:
43 return std::numeric_limits<int>::max();
44 case QPaintDevice::PdmDepth:
45 return 32;
46 case QPaintDevice::PdmDpiX:
47 case QPaintDevice::PdmDpiY:
48 case QPaintDevice::PdmPhysicalDpiX:
49 case QPaintDevice::PdmPhysicalDpiY:
50 return mDpi;
51 case QPaintDevice::PdmDevicePixelRatio:
52 return 1;
53 case QPaintDevice::PdmDevicePixelRatioScaled:
54 return 1;
55#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
56 case PdmDevicePixelRatioF_EncodedA:
57 return 1;
58 case PdmDevicePixelRatioF_EncodedB:
59 return 1;
60#endif
61 }
62 // NOLINTEND(bugprone-branch-clone)
63 return 0;
64}
QPaintEngine * paintEngine() const override
int metric(PaintDeviceMetric metric) const override