equal
deleted
inserted
replaced
46 #include <private/qwindowsurface_gl_p.h> |
46 #include <private/qwindowsurface_gl_p.h> |
47 #ifdef Q_WS_X11 |
47 #ifdef Q_WS_X11 |
48 #include <private/qpixmapdata_x11gl_p.h> |
48 #include <private/qpixmapdata_x11gl_p.h> |
49 #endif |
49 #endif |
50 |
50 |
51 #if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) |
51 #if !defined(QT_OPENGL_ES_1) |
52 #include <private/qpixmapdata_gl_p.h> |
52 #include <private/qpixmapdata_gl_p.h> |
53 #endif |
|
54 |
|
55 #if defined(QT_OPENGL_ES_1_CL) |
|
56 #include "qgl_cl_p.h" |
|
57 #endif |
53 #endif |
58 |
54 |
59 QT_BEGIN_NAMESPACE |
55 QT_BEGIN_NAMESPACE |
60 |
56 |
61 QGLPaintDevice::QGLPaintDevice() |
57 QGLPaintDevice::QGLPaintDevice() |
65 |
61 |
66 QGLPaintDevice::~QGLPaintDevice() |
62 QGLPaintDevice::~QGLPaintDevice() |
67 { |
63 { |
68 } |
64 } |
69 |
65 |
|
66 int QGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const |
|
67 { |
|
68 switch(metric) { |
|
69 case PdmWidth: |
|
70 return size().width(); |
|
71 case PdmHeight: |
|
72 return size().height(); |
|
73 case PdmDepth: { |
|
74 const QGLFormat f = format(); |
|
75 return f.redBufferSize() + f.greenBufferSize() + f.blueBufferSize() + f.alphaBufferSize(); |
|
76 } |
|
77 default: |
|
78 qWarning("QGLPaintDevice::metric() - metric %d not known", metric); |
|
79 return 0; |
|
80 } |
|
81 } |
70 |
82 |
71 void QGLPaintDevice::beginPaint() |
83 void QGLPaintDevice::beginPaint() |
72 { |
84 { |
73 // Make sure our context is the current one: |
85 // Make sure our context is the current one: |
74 QGLContext *ctx = context(); |
86 QGLContext *ctx = context(); |
161 else { |
173 else { |
162 const QColor &c = glWidget->palette().brush(glWidget->backgroundRole()).color(); |
174 const QColor &c = glWidget->palette().brush(glWidget->backgroundRole()).color(); |
163 float alpha = c.alphaF(); |
175 float alpha = c.alphaF(); |
164 glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); |
176 glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); |
165 } |
177 } |
166 glClear(GL_COLOR_BUFFER_BIT); |
178 if (context()->d_func()->workaround_needsFullClearOnEveryFrame) |
|
179 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
|
180 else |
|
181 glClear(GL_COLOR_BUFFER_BIT); |
167 } |
182 } |
168 } |
183 } |
169 |
184 |
170 void QGLWidgetGLPaintDevice::endPaint() |
185 void QGLWidgetGLPaintDevice::endPaint() |
171 { |
186 { |
201 break; |
216 break; |
202 case QInternal::FramebufferObject: |
217 case QInternal::FramebufferObject: |
203 glpd = &(static_cast<QGLFramebufferObject*>(pd)->d_func()->glDevice); |
218 glpd = &(static_cast<QGLFramebufferObject*>(pd)->d_func()->glDevice); |
204 break; |
219 break; |
205 case QInternal::Pixmap: { |
220 case QInternal::Pixmap: { |
206 #if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) |
221 #if !defined(QT_OPENGL_ES_1) |
207 QPixmapData* pmd = static_cast<QPixmap*>(pd)->pixmapData(); |
222 QPixmapData* pmd = static_cast<QPixmap*>(pd)->pixmapData(); |
208 if (pmd->classId() == QPixmapData::OpenGLClass) |
223 if (pmd->classId() == QPixmapData::OpenGLClass) |
209 glpd = static_cast<QGLPixmapData*>(pmd)->glDevice(); |
224 glpd = static_cast<QGLPixmapData*>(pmd)->glDevice(); |
210 #ifdef Q_WS_X11 |
225 #ifdef Q_WS_X11 |
211 else if (pmd->classId() == QPixmapData::X11Class) |
226 else if (pmd->classId() == QPixmapData::X11Class) |