src/opengl/qpixmapdata_gl.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 37 758a864f9613
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtOpenGL module of the Qt Toolkit.
     7 ** This file is part of the QtOpenGL module of the Qt Toolkit.
     8 **
     8 **
   230 }
   230 }
   231 
   231 
   232 QSize QGLPixmapGLPaintDevice::size() const
   232 QSize QGLPixmapGLPaintDevice::size() const
   233 {
   233 {
   234     return data->size();
   234     return data->size();
       
   235 }
       
   236 
       
   237 bool QGLPixmapGLPaintDevice::alphaRequested() const
       
   238 {
       
   239     return data->m_hasAlpha;
   235 }
   240 }
   236 
   241 
   237 void QGLPixmapGLPaintDevice::setPixmapData(QGLPixmapData* d)
   242 void QGLPixmapGLPaintDevice::setPixmapData(QGLPixmapData* d)
   238 {
   243 {
   239     data = d;
   244     data = d;
   339         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   344         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   340     }
   345     }
   341 
   346 
   342     if (!m_source.isNull()) {
   347     if (!m_source.isNull()) {
   343         if (external_format == GL_RGB) {
   348         if (external_format == GL_RGB) {
   344             const QImage tx = m_source.convertToFormat(QImage::Format_RGB888);
   349             const QImage tx = m_source.convertToFormat(QImage::Format_RGB888).mirrored(false, true);
   345 
   350 
   346             glBindTexture(target, m_texture.id);
   351             glBindTexture(target, m_texture.id);
   347             glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
   352             glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
   348                             GL_UNSIGNED_BYTE, tx.bits());
   353                             GL_UNSIGNED_BYTE, tx.bits());
   349         } else {
   354         } else {