qglpaintdevice.cpp

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

Generated by Squish Coco Non-Commercial