src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
branchRCL_3
changeset 8 3f74d0d4af4c
parent 5 d3bac044e0f0
child 14 c0432d11811c
equal deleted inserted replaced
6:dee5afe5301f 8:3f74d0d4af4c
    87 #include <QDebug>
    87 #include <QDebug>
    88 
    88 
    89 QT_BEGIN_NAMESPACE
    89 QT_BEGIN_NAMESPACE
    90 
    90 
    91 //#define QT_GL_NO_SCISSOR_TEST
    91 //#define QT_GL_NO_SCISSOR_TEST
       
    92 #if defined(Q_WS_WIN)
       
    93 extern Q_GUI_EXPORT bool qt_cleartype_enabled;
       
    94 #endif
    92 
    95 
    93 extern QImage qt_imageForBrush(int brushStyle, bool invert);
    96 extern QImage qt_imageForBrush(int brushStyle, bool invert);
    94 
    97 
    95 ////////////////////////////////// Private Methods //////////////////////////////////////////
    98 ////////////////////////////////// Private Methods //////////////////////////////////////////
    96 
    99 
   556     glDepthFunc(GL_LESS);
   559     glDepthFunc(GL_LESS);
   557     glClearDepth(1);
   560     glClearDepth(1);
   558     glStencilMask(0xff);
   561     glStencilMask(0xff);
   559     glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
   562     glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
   560     glStencilFunc(GL_ALWAYS, 0, 0xff);
   563     glStencilFunc(GL_ALWAYS, 0, 0xff);
       
   564     glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
       
   565     glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
       
   566     glDisableVertexAttribArray(QT_OPACITY_ATTR);
       
   567 #ifndef QT_OPENGL_ES_2
       
   568     glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // color may have been changed by glVertexAttrib()
       
   569 #endif
   561 }
   570 }
   562 
   571 
   563 void QGL2PaintEngineEx::endNativePainting()
   572 void QGL2PaintEngineEx::endNativePainting()
   564 {
   573 {
   565     Q_D(QGL2PaintEngineEx);
   574     Q_D(QGL2PaintEngineEx);
  1223 
  1232 
  1224     QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
  1233     QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
  1225                                             ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
  1234                                             ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
  1226                                             : d->glyphCacheType;
  1235                                             : d->glyphCacheType;
  1227 
  1236 
  1228     if (txtype > QTransform::TxTranslate)
  1237 
  1229         glyphType = QFontEngineGlyphCache::Raster_A8;
  1238     if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
  1230 
  1239         if (d->device->alphaRequested() || txtype > QTransform::TxTranslate
  1231     if (glyphType == QFontEngineGlyphCache::Raster_RGBMask
  1240             || (state()->composition_mode != QPainter::CompositionMode_Source
  1232         && state()->composition_mode != QPainter::CompositionMode_Source
  1241             && state()->composition_mode != QPainter::CompositionMode_SourceOver))
  1233         && state()->composition_mode != QPainter::CompositionMode_SourceOver)
  1242         {
  1234     {
  1243             glyphType = QFontEngineGlyphCache::Raster_A8;
  1235         drawCached = false;
  1244         }
  1236     }
  1245     }
  1237 
  1246 
  1238     if (drawCached) {
  1247     if (drawCached) {
  1239         d->drawCachedGlyphs(p, glyphType, ti);
  1248         d->drawCachedGlyphs(p, glyphType, ti);
  1240         return;
  1249         return;
  1547 
  1556 
  1548     d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
  1557     d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
  1549 
  1558 
  1550 #if !defined(QT_OPENGL_ES_2)
  1559 #if !defined(QT_OPENGL_ES_2)
  1551 #if defined(Q_WS_WIN)
  1560 #if defined(Q_WS_WIN)
  1552     extern Q_GUI_EXPORT bool qt_cleartype_enabled;
       
  1553     if (qt_cleartype_enabled)
  1561     if (qt_cleartype_enabled)
  1554 #endif
  1562 #endif
  1555         d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
  1563         d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
  1556 #endif
  1564 #endif
  1557 
  1565 
  1587 
  1595 
  1588     d->resetGLState();
  1596     d->resetGLState();
  1589 
  1597 
  1590     delete d->shaderManager;
  1598     delete d->shaderManager;
  1591     d->shaderManager = 0;
  1599     d->shaderManager = 0;
       
  1600     d->currentBrush = QBrush();
  1592 
  1601 
  1593 #ifdef QT_OPENGL_CACHE_AS_VBOS
  1602 #ifdef QT_OPENGL_CACHE_AS_VBOS
  1594     if (!d->unusedVBOSToClean.isEmpty()) {
  1603     if (!d->unusedVBOSToClean.isEmpty()) {
  1595         glDeleteBuffers(d->unusedVBOSToClean.size(), d->unusedVBOSToClean.constData());
  1604         glDeleteBuffers(d->unusedVBOSToClean.size(), d->unusedVBOSToClean.constData());
  1596         d->unusedVBOSToClean.clear();
  1605         d->unusedVBOSToClean.clear();