summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 3ddc15a..4a64f39 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1464,6 +1464,7 @@ namespace {
QSize cacheSize;
QGL2PEXVertexArray vertexCoordinateArray;
QGL2PEXVertexArray textureCoordinateArray;
+ QFontEngineGlyphCache::Type glyphType;
};
}
@@ -1477,22 +1478,29 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QOpenGL2PaintEngineState *s = q->state();
+ bool recreateVertexArrays = false;
+
QGLTextureGlyphCache *cache =
(QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(ctx, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType) {
cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
staticTextItem->fontEngine()->setGlyphCache(ctx, cache);
+ recreateVertexArrays = true;
} else if (cache->context() == 0) { // Old context has been destroyed, new context has same ptr value
cache->setContext(ctx);
}
- bool recreateVertexArrays = false;
- if (staticTextItem->userDataNeedsUpdate)
+ if (staticTextItem->userDataNeedsUpdate) {
recreateVertexArrays = true;
- else if (staticTextItem->userData() == 0)
+ } else if (staticTextItem->userData() == 0) {
recreateVertexArrays = true;
- else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData)
+ } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
recreateVertexArrays = true;
+ } else {
+ QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData());
+ if (userData->glyphType != glyphType)
+ recreateVertexArrays = true;
+ }
// We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays.
// If the cache size has changed, we do need to regenerate the vertices, but we don't need to repopulate the
@@ -1504,8 +1512,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// No space in cache. We need to clear the cache and try again
cache->clear();
cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
- staticTextItem->glyphs, staticTextItem->glyphPositions);
- }
+ staticTextItem->glyphs, staticTextItem->glyphPositions);
+ }
}
if (cache->width() == 0 || cache->height() == 0)
@@ -1535,6 +1543,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
}
+ userData->glyphType = glyphType;
+
// Use cache if backend optimizations is turned on
vertexCoordinates = &userData->vertexCoordinateArray;
textureCoordinates = &userData->textureCoordinateArray;
@@ -2139,7 +2149,11 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
QRectF rect(points[0], points[2]);
- if (state()->matrix.type() <= QTransform::TxScale) {
+ if (state()->matrix.type() <= QTransform::TxScale
+ || (state()->matrix.type() == QTransform::TxRotate
+ && qFuzzyIsNull(state()->matrix.m11())
+ && qFuzzyIsNull(state()->matrix.m22())))
+ {
state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect());
d->updateClipScissorTest();
return;