qopenglpaintdevice.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopenglpaintdevice.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7QOpenGLPaintDevice::QOpenGLPaintDevice()-
8 : d_ptr(new QOpenGLPaintDevicePrivate(QSize()))-
9{-
10}
never executed: end of block
0
11QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size)-
12 : d_ptr(new QOpenGLPaintDevicePrivate(size))-
13{-
14}
never executed: end of block
0
15QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)-
16 : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height)))-
17{-
18}
never executed: end of block
0
19-
20-
21-
22-
23QOpenGLPaintDevice::QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd)-
24 : d_ptr(&dd)-
25{-
26}
never executed: end of block
0
27-
28-
29-
30-
31-
32QOpenGLPaintDevice::~QOpenGLPaintDevice()-
33{-
34 delete d_ptr->engine;-
35}
never executed: end of block
0
36-
37-
38-
39-
40-
41-
42-
43QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz)-
44 : size(sz)-
45 , ctx(QOpenGLContext::currentContext())-
46 , dpmx(qt_defaultDpiX() * 100. / 2.54)-
47 , dpmy(qt_defaultDpiY() * 100. / 2.54)-
48 , devicePixelRatio(1.0)-
49 , flipped(false)-
50 , engine(0)-
51{-
52}
never executed: end of block
0
53-
54QOpenGLPaintDevicePrivate::~QOpenGLPaintDevicePrivate()-
55{-
56}-
57-
58class QOpenGLEngineThreadStorage-
59{-
60public:-
61 QPaintEngine *engine() {-
62 QPaintEngine *&localEngine = storage.localData();-
63 if (!localEngine
!localEngineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
64 localEngine = new QOpenGL2PaintEngineEx;
never executed: localEngine = new QOpenGL2PaintEngineEx;
0
65 return
never executed: return localEngine;
localEngine;
never executed: return localEngine;
0
66 }-
67-
68private:-
69 QThreadStorage<QPaintEngine *> storage;-
70};-
71-
72namespace { namespace Q_QGS_qt_opengl_engine { typedef QOpenGLEngineThreadStorage Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QOpenGLEngineThreadStorage, Q_QGS_qt_opengl_engine::innerFunction, Q_QGS_qt_opengl_engine::guard> qt_opengl_engine;
0
73-
74-
75-
76-
77-
78QPaintEngine *QOpenGLPaintDevice::paintEngine() const-
79{-
80 if (d_ptr->engine
d_ptr->engineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
81 return
never executed: return d_ptr->engine;
d_ptr->engine;
never executed: return d_ptr->engine;
0
82-
83 QPaintEngine *engine = qt_opengl_engine()->engine();-
84 if (engine->isActive()
engine->isActive()Description
TRUEnever evaluated
FALSEnever evaluated
&& engine->paintDevice() != this
engine->paintDevice() != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
85 d_ptr->engine = new QOpenGL2PaintEngineEx;-
86 return
never executed: return d_ptr->engine;
d_ptr->engine;
never executed: return d_ptr->engine;
0
87 }-
88-
89 return
never executed: return engine;
engine;
never executed: return engine;
0
90}-
91-
92-
93-
94-
95-
96QOpenGLContext *QOpenGLPaintDevice::context() const-
97{-
98 return
never executed: return d_ptr->ctx;
d_ptr->ctx;
never executed: return d_ptr->ctx;
0
99}-
100-
101-
102-
103-
104-
105-
106-
107QSize QOpenGLPaintDevice::size() const-
108{-
109 return
never executed: return d_ptr->size;
d_ptr->size;
never executed: return d_ptr->size;
0
110}-
111-
112-
113-
114-
115-
116-
117-
118void QOpenGLPaintDevice::setSize(const QSize &size)-
119{-
120 d_ptr->size = size;-
121}
never executed: end of block
0
122-
123-
124-
125-
126void QOpenGLPaintDevice::setDevicePixelRatio(qreal devicePixelRatio)-
127{-
128 d_ptr->devicePixelRatio = devicePixelRatio;-
129}
never executed: end of block
0
130-
131-
132-
133-
134-
135int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const-
136{-
137 switch (metric) {-
138 case
never executed: case PdmWidth:
PdmWidth:
never executed: case PdmWidth:
0
139 return
never executed: return d_ptr->size.width();
d_ptr->size.width();
never executed: return d_ptr->size.width();
0
140 case
never executed: case PdmHeight:
PdmHeight:
never executed: case PdmHeight:
0
141 return
never executed: return d_ptr->size.height();
d_ptr->size.height();
never executed: return d_ptr->size.height();
0
142 case
never executed: case PdmDepth:
PdmDepth:
never executed: case PdmDepth:
0
143 return
never executed: return 32;
32;
never executed: return 32;
0
144 case
never executed: case PdmWidthMM:
PdmWidthMM:
never executed: case PdmWidthMM:
0
145 return
never executed: return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx);
qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx);
never executed: return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx);
0
146 case
never executed: case PdmHeightMM:
PdmHeightMM:
never executed: case PdmHeightMM:
0
147 return
never executed: return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy);
qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy);
never executed: return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy);
0
148 case
never executed: case PdmNumColors:
PdmNumColors:
never executed: case PdmNumColors:
0
149 return
never executed: return 0;
0;
never executed: return 0;
0
150 case
never executed: case PdmDpiX:
PdmDpiX:
never executed: case PdmDpiX:
0
151 return
never executed: return qRound(d_ptr->dpmx * 0.0254);
qRound(d_ptr->dpmx * 0.0254);
never executed: return qRound(d_ptr->dpmx * 0.0254);
0
152 case
never executed: case PdmDpiY:
PdmDpiY:
never executed: case PdmDpiY:
0
153 return
never executed: return qRound(d_ptr->dpmy * 0.0254);
qRound(d_ptr->dpmy * 0.0254);
never executed: return qRound(d_ptr->dpmy * 0.0254);
0
154 case
never executed: case PdmPhysicalDpiX:
PdmPhysicalDpiX:
never executed: case PdmPhysicalDpiX:
0
155 return
never executed: return qRound(d_ptr->dpmx * 0.0254);
qRound(d_ptr->dpmx * 0.0254);
never executed: return qRound(d_ptr->dpmx * 0.0254);
0
156 case
never executed: case PdmPhysicalDpiY:
PdmPhysicalDpiY:
never executed: case PdmPhysicalDpiY:
0
157 return
never executed: return qRound(d_ptr->dpmy * 0.0254);
qRound(d_ptr->dpmy * 0.0254);
never executed: return qRound(d_ptr->dpmy * 0.0254);
0
158 case
never executed: case PdmDevicePixelRatio:
PdmDevicePixelRatio:
never executed: case PdmDevicePixelRatio:
0
159 return
never executed: return d_ptr->devicePixelRatio;
d_ptr->devicePixelRatio;
never executed: return d_ptr->devicePixelRatio;
0
160 case
never executed: case PdmDevicePixelRatioScaled:
PdmDevicePixelRatioScaled:
never executed: case PdmDevicePixelRatioScaled:
0
161 return
never executed: return d_ptr->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
d_ptr->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
never executed: return d_ptr->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
0
162-
163 default
never executed: default:
:
never executed: default:
0
164 QMessageLogger(__FILE__, 288, __PRETTY_FUNCTION__).warning("QOpenGLPaintDevice::metric() - metric %d not known", metric);-
165 return
never executed: return 0;
0;
never executed: return 0;
0
166 }-
167}-
168-
169-
170-
171-
172-
173-
174-
175qreal QOpenGLPaintDevice::dotsPerMeterX() const-
176{-
177 return
never executed: return d_ptr->dpmx;
d_ptr->dpmx;
never executed: return d_ptr->dpmx;
0
178}-
179-
180-
181-
182-
183-
184-
185-
186qreal QOpenGLPaintDevice::dotsPerMeterY() const-
187{-
188 return
never executed: return d_ptr->dpmy;
d_ptr->dpmy;
never executed: return d_ptr->dpmy;
0
189}-
190-
191-
192-
193-
194-
195-
196-
197void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx)-
198{-
199 d_ptr->dpmx = dpmx;-
200}
never executed: end of block
0
201-
202-
203-
204-
205-
206-
207-
208void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy)-
209{-
210 d_ptr->dpmx = dpmy;-
211}
never executed: end of block
0
212-
213-
214-
215-
216-
217-
218void QOpenGLPaintDevice::setPaintFlipped(bool flipped)-
219{-
220 d_ptr->flipped = flipped;-
221}
never executed: end of block
0
222-
223-
224-
225-
226-
227-
228-
229bool QOpenGLPaintDevice::paintFlipped() const-
230{-
231 return
never executed: return d_ptr->flipped;
d_ptr->flipped;
never executed: return d_ptr->flipped;
0
232}-
233void QOpenGLPaintDevice::ensureActiveTarget()-
234{-
235}-
236-
237-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9