Qt 4.8
Public Functions | Properties | List of all members
QGLPixmapGLPaintDevice Class Reference

#include <qpixmapdata_gl_p.h>

Inheritance diagram for QGLPixmapGLPaintDevice:
QGLPaintDevice QPaintDevice

Public Functions

bool alphaRequested () const
 
void beginPaint ()
 
QGLContextcontext () const
 
void endPaint ()
 
QPaintEnginepaintEngine () const
 
void setPixmapData (QGLPixmapData *)
 
QSize size () const
 
- Public Functions inherited from QGLPaintDevice
int devType () const
 
virtual void ensureActiveTarget ()
 
virtual QGLFormat format () const
 
virtual bool isFlipped () const
 
 QGLPaintDevice ()
 
virtual ~QGLPaintDevice ()
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
virtual HDC getDC () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
virtual void releaseDC (HDC hdc) const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Properties

QGLPixmapDatadata
 

Additional Inherited Members

- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 
- Static Public Functions inherited from QGLPaintDevice
static QGLPaintDevicegetDevice (QPaintDevice *)
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 
- Protected Functions inherited from QGLPaintDevice
int metric (QPaintDevice::PaintDeviceMetric metric) const
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 
- Protected Variables inherited from QGLPaintDevice
GLuint m_previousFBO
 
GLuint m_thisFBO
 
- Protected Variables inherited from QPaintDevice
ushort painters
 

Detailed Description

Definition at line 92 of file qpixmapdata_gl_p.h.

Functions

◆ alphaRequested()

bool QGLPixmapGLPaintDevice::alphaRequested ( ) const
virtual

Reimplemented from QGLPaintDevice.

Definition at line 242 of file qpixmapdata_gl.cpp.

243 {
244  return data->m_hasAlpha;
245 }

◆ beginPaint()

void QGLPixmapGLPaintDevice::beginPaint ( )
virtual

Reimplemented from QGLPaintDevice.

Definition at line 172 of file qpixmapdata_gl.cpp.

173 {
174  if (!data->isValid())
175  return;
176 
177  // QGLPaintDevice::beginPaint will store the current binding and replace
178  // it with m_thisFBO:
181 
183 
184  // QPixmap::fill() is deferred until now, where we actually need to do the fill:
185  if (data->needsFill()) {
186  const QColor &c = data->fillColor();
187  float alpha = c.alphaF();
188  glDisable(GL_SCISSOR_TEST);
189  glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
190  glClear(GL_COLOR_BUFFER_BIT);
191  }
192  else if (!data->isUninitialized()) {
193  // If the pixmap (GL Texture) has valid content (it has been
194  // uploaded from an image or rendered into before), we need to
195  // copy it from the texture to the render FBO.
196 
197  glDisable(GL_DEPTH_TEST);
198  glDisable(GL_SCISSOR_TEST);
199  glDisable(GL_BLEND);
200 
201 #if !defined(QT_OPENGL_ES_2)
202  glMatrixMode(GL_MODELVIEW);
203  glLoadIdentity();
204 
205  glMatrixMode(GL_PROJECTION);
206  glLoadIdentity();
207  glOrtho(0, data->width(), data->height(), 0, -999999, 999999);
208 #endif
209 
210  glViewport(0, 0, data->width(), data->height());
211 
212  // Pass false to bind so it doesn't copy the FBO into the texture!
213  context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false));
214  }
215 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
unsigned char c[8]
Definition: qnumeric_p.h:62
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
#define GL_DEPTH_TEST
GLuint bind(bool copyBack=true) const
QGLContext * context() const
int width() const
void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget=GL_TEXTURE_2D)
This function supports the following use cases:
Definition: qgl.cpp:3067
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define GL_SCISSOR_TEST
bool isValid() const
virtual Type type() const =0
Reimplement this function to return the paint engine Type.
#define GL_COLOR_BUFFER_BIT
bool needsFill() const
GLuint handle() const
Returns the GL framebuffer object handle for this framebuffer object (returned by the glGenFrameBuffe...
#define GL_BLEND
virtual void beginPaint()
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
QColor fillColor() const
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QGLFramebufferObject * m_renderFbo
int height() const
QPaintEngine * paintEngine() const
bool isUninitialized() const

◆ context()

QGLContext * QGLPixmapGLPaintDevice::context ( ) const
virtual

Implements QGLPaintDevice.

Definition at line 231 of file qpixmapdata_gl.cpp.

232 {
233  data->ensureCreated();
234  return data->m_ctx;
235 }
QGLContext * m_ctx
void ensureCreated() const

◆ endPaint()

void QGLPixmapGLPaintDevice::endPaint ( )
virtual

Reimplemented from QGLPaintDevice.

Definition at line 217 of file qpixmapdata_gl.cpp.

218 {
219  if (!data->isValid())
220  return;
221 
222  data->copyBackFromRenderFbo(false);
223 
224  // Base's endPaint will restore the previous FBO binding
226 
228  data->m_renderFbo = 0;
229 }
QGLFramebufferObjectPool * qgl_fbo_pool()
void copyBackFromRenderFbo(bool keepCurrentFboBound) const
bool isValid() const
void release(QGLFramebufferObject *fbo)
QGLFramebufferObject * m_renderFbo
virtual void endPaint()

◆ paintEngine()

QPaintEngine * QGLPixmapGLPaintDevice::paintEngine ( ) const
virtual

Implements QPaintDevice.

Definition at line 167 of file qpixmapdata_gl.cpp.

168 {
169  return data->paintEngine();
170 }
QPaintEngine * paintEngine() const

◆ setPixmapData()

void QGLPixmapGLPaintDevice::setPixmapData ( QGLPixmapData d)

Definition at line 247 of file qpixmapdata_gl.cpp.

Referenced by QGLPixmapData::QGLPixmapData().

248 {
249  data = d;
250 }
double d
Definition: qnumeric_p.h:62

◆ size()

QSize QGLPixmapGLPaintDevice::size ( ) const
virtual

Implements QGLPaintDevice.

Definition at line 237 of file qpixmapdata_gl.cpp.

238 {
239  return data->size();
240 }
QSize size() const

Properties

◆ data

QGLPixmapData* QGLPixmapGLPaintDevice::data
private

Definition at line 105 of file qpixmapdata_gl_p.h.


The documentation for this class was generated from the following files: