summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp27
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h3
2 files changed, 22 insertions, 8 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 17b3317..544d327 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1204,9 +1204,8 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
? QFontEngineGlyphCache::Type(textItem->fontEngine->glyphFormat)
: d->glyphCacheType;
- // ### What about transformations and huge fonts? These are not passed through cache
- // in drawTextItem().
- d->drawCachedGlyphs(glyphType, textItem);
+ // ### What about huge fonts? These are not passed through cache in drawTextItem().
+ d->drawCachedGlyphs(glyphType, textItem, true);
}
void QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src)
@@ -1276,7 +1275,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
staticTextItem.numGlyphs = glyphs.size();
staticTextItem.glyphPositions = positions.data();
- d->drawCachedGlyphs(glyphType, &staticTextItem);
+ d->drawCachedGlyphs(glyphType, &staticTextItem, false);
}
return;
}
@@ -1307,14 +1306,22 @@ namespace {
};
}
-void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem)
+void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType,
+ QStaticTextItem *staticTextItem,
+ bool includeMatrixInCache)
{
Q_Q(QGL2PaintEngineEx);
+ QOpenGL2PaintEngineState *s = q->state();
+
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(ctx, glyphType, QTransform());
+ (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(ctx, glyphType,
+ includeMatrixInCache
+ ? s->matrix
+ : QTransform());
if (!cache || cache->cacheType() != glyphType) {
- cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
+ cache = new QGLTextureGlyphCache(ctx, glyphType,
+ includeMatrixInCache ? s->matrix : QTransform());
staticTextItem->fontEngine->setGlyphCache(ctx, cache);
}
@@ -1405,6 +1412,9 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QBrush pensBrush = q->state()->pen.brush();
setBrush(pensBrush);
+ QTransform old = s->matrix;
+ if (includeMatrixInCache)
+ s->matrix = QTransform();
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
// Subpixel antialiasing without gamma correction
@@ -1492,6 +1502,9 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// Reset bindings
glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ if (includeMatrixInCache)
+ s->matrix = old;
}
void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index a7a40a8..4ef1bb9 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -195,7 +195,8 @@ public:
void stroke(const QVectorPath &path, const QPen &pen);
void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints);
- void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem);
+ void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem,
+ bool includeMatrixInCache);
// Calls glVertexAttributePointer if the pointer has changed
inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer);