summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp33
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h1
-rw-r--r--src/opengl/qgl_qpa.cpp2
-rw-r--r--src/opengl/qpaintengine_opengl_p.h1
-rw-r--r--src/opengl/qwindowsurface_gl.cpp18
5 files changed, 39 insertions, 16 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index e62af62..3ac759c 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1436,19 +1436,30 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
ensureActive();
- QFontEngineGlyphCache::Type glyphType = textItem->fontEngine()->glyphFormat >= 0
- ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
- : d->glyphCacheType;
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
- if (d->device->alphaRequested() || state()->matrix.type() > QTransform::TxTranslate
- || (state()->composition_mode != QPainter::CompositionMode_Source
- && state()->composition_mode != QPainter::CompositionMode_SourceOver))
- {
- glyphType = QFontEngineGlyphCache::Raster_A8;
+ QPainterState *s = state();
+ float det = s->matrix.determinant();
+
+ // don't try to cache huge fonts or vastly transformed fonts
+ QFontEngine *fontEngine = textItem->fontEngine();
+ const qreal pixelSize = fontEngine->fontDef.pixelSize;
+ if (pixelSize * pixelSize * qAbs(det) < QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE ||
+ det < 0.25f || det > 4.f) {
+ QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0
+ ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
+ : d->glyphCacheType;
+ if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (d->device->alphaRequested() || s->matrix.type() > QTransform::TxTranslate
+ || (s->composition_mode != QPainter::CompositionMode_Source
+ && s->composition_mode != QPainter::CompositionMode_SourceOver))
+ {
+ glyphType = QFontEngineGlyphCache::Raster_A8;
+ }
}
- }
- d->drawCachedGlyphs(glyphType, textItem);
+ d->drawCachedGlyphs(glyphType, textItem);
+ } else {
+ QPaintEngineEx::drawStaticTextItem(textItem);
+ }
}
bool QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 7ba92e4..2895d5a 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -158,6 +158,7 @@ public:
void setRenderTextActive(bool);
bool isNativePaintingActive() const;
+ bool supportsTransformations(qreal, const QTransform &) const { return true; }
private:
Q_DISABLE_COPY(QGL2PaintEngineEx)
};
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index e7fc560..f8f3974 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -150,6 +150,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (shareContext) {
winFormat.setSharedContext(shareContext->d_func()->platformContext);
}
+ if (widget->testAttribute(Qt::WA_TranslucentBackground))
+ winFormat.setAlpha(true);
winFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
winFormat.setWindowSurface(false);
widget->setPlatformWindowFormat(winFormat);
diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h
index 5d5f5ce..8d0ea83 100644
--- a/src/opengl/qpaintengine_opengl_p.h
+++ b/src/opengl/qpaintengine_opengl_p.h
@@ -143,6 +143,7 @@ public:
Qt::HANDLE handle() const;
#endif
inline Type type() const { return QPaintEngine::OpenGL; }
+ bool supportsTransformations(qreal, const QTransform &) const { return true; }
private:
void drawPolyInternal(const QPolygonF &pa, bool close = true);
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 7f63aea..ff55142 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -542,19 +542,27 @@ void QGLWindowSurface::beginPaint(const QRegion &)
d_ptr->did_paint = true;
updateGeometry();
- if (!context())
- return;
-
int clearFlags = 0;
- if (context()->d_func()->workaround_needsFullClearOnEveryFrame)
+ QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext);
+
+ if (!ctx)
+ return;
+
+ if (ctx->d_func()->workaround_needsFullClearOnEveryFrame)
clearFlags = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
- else if (context()->format().alpha())
+ else if (ctx->format().alpha())
clearFlags = GL_COLOR_BUFFER_BIT;
if (clearFlags) {
+ if (d_ptr->fbo)
+ d_ptr->fbo->bind();
+
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(clearFlags);
+
+ if (d_ptr->fbo)
+ d_ptr->fbo->release();
}
}