summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-06-08 15:38:15 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-06-08 15:38:15 (GMT)
commit457d178fae492c81276ded4be9f861375eecb23b (patch)
treea0e19fd57f9a7d5a4f1f5668f5bdda570f33c64f /src/opengl
parentf6909d47b981720cb87cb96454cdf9ea493383ee (diff)
parent5fe85b9d0e133734c7789fa9d1565684e15c5e2f (diff)
downloadQt-457d178fae492c81276ded4be9f861375eecb23b.zip
Qt-457d178fae492c81276ded4be9f861375eecb23b.tar.gz
Qt-457d178fae492c81276ded4be9f861375eecb23b.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: (56 commits) Fix compile when configure with no fontconfig support Fix warning in qtextengine compilation Reorder member varibles in QGlyphRunPrivate to eliminate warning Revert 36e01e69 Fixed compile of tst_qscriptextensionplugin on some Windows configurations Add function QGlyphRun::setRawData() Correct antialias disabling logic for Core Text Correct QStaticText tests after recent changes Add missing license header. Add basic static text drawing capability to lance Fix Windows build Refactor glyph pretransform check Add the new 'glhypnotizer' demo. Fix problem with cosmetic stroking of cubic beziers Fix autotest to not depend on rasterization details Still use midpoint rendering of aliased ellipses Symbian build failure for Armv5 Fix the wayland windowsurface so that we have stencil and depth buffer We need to let the currentContext be in the same state after Track Wayland changes ...
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();
}
}