Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/opengl/qglpaintdevice.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | QGLPaintDevice::QGLPaintDevice() | - | ||||||||||||
5 | : m_thisFBO(0) | - | ||||||||||||
6 | { | - | ||||||||||||
7 | } executed 12 times by 3 tests: end of block Executed by:
| 12 | ||||||||||||
8 | - | |||||||||||||
9 | QGLPaintDevice::~QGLPaintDevice() | - | ||||||||||||
10 | { | - | ||||||||||||
11 | } | - | ||||||||||||
12 | - | |||||||||||||
13 | int QGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const | - | ||||||||||||
14 | { | - | ||||||||||||
15 | switch(metric) { | - | ||||||||||||
16 | case never executed: PdmWidth:case PdmWidth: never executed: case PdmWidth: | 0 | ||||||||||||
17 | return never executed: size().width();return size().width(); never executed: return size().width(); | 0 | ||||||||||||
18 | case never executed: PdmHeight:case PdmHeight: never executed: case PdmHeight: | 0 | ||||||||||||
19 | return never executed: size().height();return size().height(); never executed: return size().height(); | 0 | ||||||||||||
20 | case never executed: PdmDepth:case PdmDepth: never executed: {case PdmDepth: | 0 | ||||||||||||
21 | const QGLFormat f = format(); | - | ||||||||||||
22 | return never executed: f.redBufferSize() + f.greenBufferSize() + f.blueBufferSize() + f.alphaBufferSize();return f.redBufferSize() + f.greenBufferSize() + f.blueBufferSize() + f.alphaBufferSize(); never executed: return f.redBufferSize() + f.greenBufferSize() + f.blueBufferSize() + f.alphaBufferSize(); | 0 | ||||||||||||
23 | } | - | ||||||||||||
24 | case never executed: PdmDevicePixelRatio:case PdmDevicePixelRatio: never executed: case PdmDevicePixelRatio: | 0 | ||||||||||||
25 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
26 | case never executed: PdmDevicePixelRatioScaled:case PdmDevicePixelRatioScaled: never executed: case PdmDevicePixelRatioScaled: | 0 | ||||||||||||
27 | return never executed: 1 * QPaintDevice::devicePixelRatioFScale();return 1 * QPaintDevice::devicePixelRatioFScale(); never executed: return 1 * QPaintDevice::devicePixelRatioFScale(); | 0 | ||||||||||||
28 | default never executed: :default: never executed: default: | 0 | ||||||||||||
29 | QMessageLogger(__FILE__, 74, __PRETTY_FUNCTION__).warning("QGLPaintDevice::metric() - metric %d not known", metric); | - | ||||||||||||
30 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
31 | } | - | ||||||||||||
32 | } | - | ||||||||||||
33 | - | |||||||||||||
34 | void QGLPaintDevice::beginPaint() | - | ||||||||||||
35 | { | - | ||||||||||||
36 | - | |||||||||||||
37 | QGLContext *ctx = context(); | - | ||||||||||||
38 | ctx->makeCurrent(); | - | ||||||||||||
39 | - | |||||||||||||
40 | ctx->d_func()->refreshCurrentFbo(); | - | ||||||||||||
41 | m_previousFBO = ctx->d_func()->current_fbo; | - | ||||||||||||
42 | - | |||||||||||||
43 | if (m_previousFBO != m_thisFBO
| 0-3 | ||||||||||||
44 | ctx->d_func()->setCurrentFbo(m_thisFBO); | - | ||||||||||||
45 | ctx->contextHandle()->functions()->glBindFramebuffer(0x8D40, m_thisFBO); | - | ||||||||||||
46 | } never executed: end of block | 0 | ||||||||||||
47 | - | |||||||||||||
48 | - | |||||||||||||
49 | - | |||||||||||||
50 | - | |||||||||||||
51 | - | |||||||||||||
52 | ctx->d_ptr->default_fbo = m_thisFBO; | - | ||||||||||||
53 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||
54 | - | |||||||||||||
55 | void QGLPaintDevice::ensureActiveTarget() | - | ||||||||||||
56 | { | - | ||||||||||||
57 | QGLContext* ctx = context(); | - | ||||||||||||
58 | if (ctx != QGLContext::currentContext()
| 0-42 | ||||||||||||
59 | ctx->makeCurrent(); never executed: ctx->makeCurrent(); | 0 | ||||||||||||
60 | - | |||||||||||||
61 | ctx->d_func()->refreshCurrentFbo(); | - | ||||||||||||
62 | - | |||||||||||||
63 | if (ctx->d_ptr->current_fbo != m_thisFBO
| 0-42 | ||||||||||||
64 | ctx->d_func()->setCurrentFbo(m_thisFBO); | - | ||||||||||||
65 | ctx->contextHandle()->functions()->glBindFramebuffer(0x8D40, m_thisFBO); | - | ||||||||||||
66 | } never executed: end of block | 0 | ||||||||||||
67 | - | |||||||||||||
68 | ctx->d_ptr->default_fbo = m_thisFBO; | - | ||||||||||||
69 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||
70 | - | |||||||||||||
71 | void QGLPaintDevice::endPaint() | - | ||||||||||||
72 | { | - | ||||||||||||
73 | - | |||||||||||||
74 | QGLContext *ctx = context(); | - | ||||||||||||
75 | - | |||||||||||||
76 | ctx->d_func()->refreshCurrentFbo(); | - | ||||||||||||
77 | - | |||||||||||||
78 | if (m_previousFBO != ctx->d_func()->current_fbo
| 0-3 | ||||||||||||
79 | ctx->d_func()->setCurrentFbo(m_previousFBO); | - | ||||||||||||
80 | ctx->contextHandle()->functions()->glBindFramebuffer(0x8D40, m_previousFBO); | - | ||||||||||||
81 | } never executed: end of block | 0 | ||||||||||||
82 | - | |||||||||||||
83 | ctx->d_ptr->default_fbo = 0; | - | ||||||||||||
84 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||
85 | - | |||||||||||||
86 | QGLFormat QGLPaintDevice::format() const | - | ||||||||||||
87 | { | - | ||||||||||||
88 | return never executed: context()->format();return context()->format(); never executed: return context()->format(); | 0 | ||||||||||||
89 | } | - | ||||||||||||
90 | - | |||||||||||||
91 | bool QGLPaintDevice::alphaRequested() const | - | ||||||||||||
92 | { | - | ||||||||||||
93 | return never executed: context()->d_func()->reqFormat.alpha();return context()->d_func()->reqFormat.alpha(); never executed: return context()->d_func()->reqFormat.alpha(); | 0 | ||||||||||||
94 | } | - | ||||||||||||
95 | - | |||||||||||||
96 | bool QGLPaintDevice::isFlipped() const | - | ||||||||||||
97 | { | - | ||||||||||||
98 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||
99 | } | - | ||||||||||||
100 | - | |||||||||||||
101 | - | |||||||||||||
102 | - | |||||||||||||
103 | QGLWidgetGLPaintDevice::QGLWidgetGLPaintDevice() | - | ||||||||||||
104 | { | - | ||||||||||||
105 | } | - | ||||||||||||
106 | - | |||||||||||||
107 | QPaintEngine* QGLWidgetGLPaintDevice::paintEngine() const | - | ||||||||||||
108 | { | - | ||||||||||||
109 | return never executed: glWidget->paintEngine();return glWidget->paintEngine(); never executed: return glWidget->paintEngine(); | 0 | ||||||||||||
110 | } | - | ||||||||||||
111 | - | |||||||||||||
112 | void QGLWidgetGLPaintDevice::setWidget(QGLWidget* w) | - | ||||||||||||
113 | { | - | ||||||||||||
114 | glWidget = w; | - | ||||||||||||
115 | } executed 12 times by 3 tests: end of block Executed by:
| 12 | ||||||||||||
116 | - | |||||||||||||
117 | void QGLWidgetGLPaintDevice::beginPaint() | - | ||||||||||||
118 | { | - | ||||||||||||
119 | QGLPaintDevice::beginPaint(); | - | ||||||||||||
120 | QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); | - | ||||||||||||
121 | if (!glWidget->d_func()->disable_clear_on_painter_begin
| 0-3 | ||||||||||||
122 | if (glWidget->testAttribute(Qt::WA_TranslucentBackground)
| 0-3 | ||||||||||||
123 | funcs->glClearColor(0.0, 0.0, 0.0, 0.0); never executed: funcs->glClearColor(0.0, 0.0, 0.0, 0.0); | 0 | ||||||||||||
124 | else { | - | ||||||||||||
125 | const QColor &c = glWidget->palette().brush(glWidget->backgroundRole()).color(); | - | ||||||||||||
126 | float alpha = c.alphaF(); | - | ||||||||||||
127 | funcs->glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); | - | ||||||||||||
128 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||
129 | if (context()->d_func()->workaround_needsFullClearOnEveryFrame
| 0-3 | ||||||||||||
130 | funcs->glClear(0x00004000 | 0x00000100 | 0x00000400); never executed: funcs->glClear(0x00004000 | 0x00000100 | 0x00000400); | 0 | ||||||||||||
131 | else | - | ||||||||||||
132 | funcs->glClear(0x00004000); executed 3 times by 1 test: funcs->glClear(0x00004000); Executed by:
| 3 | ||||||||||||
133 | } | - | ||||||||||||
134 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||
135 | - | |||||||||||||
136 | void QGLWidgetGLPaintDevice::endPaint() | - | ||||||||||||
137 | { | - | ||||||||||||
138 | if (glWidget->autoBufferSwap()
| 0-3 | ||||||||||||
139 | glWidget->swapBuffers(); executed 3 times by 1 test: glWidget->swapBuffers(); Executed by:
| 3 | ||||||||||||
140 | QGLPaintDevice::endPaint(); | - | ||||||||||||
141 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||
142 | - | |||||||||||||
143 | - | |||||||||||||
144 | QSize QGLWidgetGLPaintDevice::size() const | - | ||||||||||||
145 | { | - | ||||||||||||
146 | - | |||||||||||||
147 | - | |||||||||||||
148 | - | |||||||||||||
149 | - | |||||||||||||
150 | return executed 3 times by 1 test: glWidget->size();return glWidget->size(); Executed by:
executed 3 times by 1 test: return glWidget->size(); Executed by:
| 3 | ||||||||||||
151 | - | |||||||||||||
152 | } | - | ||||||||||||
153 | - | |||||||||||||
154 | QGLContext* QGLWidgetGLPaintDevice::context() const | - | ||||||||||||
155 | { | - | ||||||||||||
156 | return executed 54 times by 1 test: const_cast<QGLContext*>(glWidget->context());return const_cast<QGLContext*>(glWidget->context()); Executed by:
executed 54 times by 1 test: return const_cast<QGLContext*>(glWidget->context()); Executed by:
| 54 | ||||||||||||
157 | } | - | ||||||||||||
158 | - | |||||||||||||
159 | - | |||||||||||||
160 | QGLPaintDevice* QGLPaintDevice::getDevice(QPaintDevice* pd) | - | ||||||||||||
161 | { | - | ||||||||||||
162 | QGLPaintDevice* glpd = 0; | - | ||||||||||||
163 | - | |||||||||||||
164 | switch(pd->devType()) { | - | ||||||||||||
165 | case executed 3 times by 1 test: QInternal::Widget:case QInternal::Widget: Executed by:
executed 3 times by 1 test: case QInternal::Widget: Executed by:
| 3 | ||||||||||||
166 | - | |||||||||||||
167 | ((!(qobject_cast<QGLWidget*>(static_cast<QWidget*>(pd)))) ? qt_assert("qobject_cast<QGLWidget*>(static_cast<QWidget*>(pd))",__FILE__,221) : qt_noop()); | - | ||||||||||||
168 | glpd = &(static_cast<QGLWidget*>(pd)->d_func()->glDevice); | - | ||||||||||||
169 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||
170 | case never executed: QInternal::Pbuffer:case QInternal::Pbuffer: never executed: case QInternal::Pbuffer: | 0 | ||||||||||||
171 | glpd = &(static_cast<QGLPixelBuffer*>(pd)->d_func()->glDevice); | - | ||||||||||||
172 | break; never executed: break; | 0 | ||||||||||||
173 | case never executed: QInternal::FramebufferObject:case QInternal::FramebufferObject: never executed: case QInternal::FramebufferObject: | 0 | ||||||||||||
174 | glpd = &(static_cast<QGLFramebufferObject*>(pd)->d_func()->glDevice); | - | ||||||||||||
175 | break; never executed: break; | 0 | ||||||||||||
176 | case never executed: QInternal::Pixmap:case QInternal::Pixmap: never executed: {case QInternal::Pixmap: | 0 | ||||||||||||
177 | QMessageLogger(__FILE__, 231, __PRETTY_FUNCTION__).warning("Pixmap type not supported for GL rendering"); | - | ||||||||||||
178 | break; never executed: break; | 0 | ||||||||||||
179 | } | - | ||||||||||||
180 | default never executed: :default: never executed: default: | 0 | ||||||||||||
181 | QMessageLogger(__FILE__, 235, __PRETTY_FUNCTION__).warning("QGLPaintDevice::getDevice() - Unknown device type %d", pd->devType()); | - | ||||||||||||
182 | break; never executed: break; | 0 | ||||||||||||
183 | } | - | ||||||||||||
184 | - | |||||||||||||
185 | return executed 3 times by 1 test: glpd;return glpd; Executed by:
executed 3 times by 1 test: return glpd; Executed by:
| 3 | ||||||||||||
186 | } | - | ||||||||||||
187 | - | |||||||||||||
188 | - | |||||||||||||
Switch to Source code | Preprocessed file |