summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-12-09 08:13:44 (GMT)
committeraxis <qt-info@nokia.com>2009-12-09 08:13:44 (GMT)
commit5a700d89a2263bcfc91d785c1ed444b1ecdacf83 (patch)
tree34ba6c67ad65c083148a80a00c4232e522b03d0a
parenta63810db89ad295df0a2371d4f671af1be75b7a0 (diff)
parent9c32e6f919704a50fbb5f46541b16fb712c24c4c (diff)
downloadQt-5a700d89a2263bcfc91d785c1ed444b1ecdacf83.zip
Qt-5a700d89a2263bcfc91d785c1ed444b1ecdacf83.tar.gz
Qt-5a700d89a2263bcfc91d785c1ed444b1ecdacf83.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-staging2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp95
-rw-r--r--src/opengl/qgl.cpp7
-rw-r--r--src/opengl/qgl_p.h2
-rw-r--r--src/opengl/qpixmapdata_gl.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp65
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp4
6 files changed, 78 insertions, 97 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 3fce384..17af9cb 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -589,53 +589,31 @@ void QGL2PaintEngineExPrivate::updateMatrix()
// matrix multiplication as most of the components are trivial.
const QTransform& transform = q->state()->matrix;
- if (mode == TextDrawingMode) {
- // Text drawing mode is only used for non-scaling transforms
- pmvMatrix[0][0] = 2.0 / width;
- pmvMatrix[0][1] = 0.0;
- pmvMatrix[0][2] = 0.0;
- pmvMatrix[0][3] = 0.0;
- pmvMatrix[1][0] = 0.0;
- pmvMatrix[1][1] = -2.0 / height;
- pmvMatrix[1][2] = 0.0;
- pmvMatrix[1][3] = 0.0;
- pmvMatrix[2][0] = 0.0;
- pmvMatrix[2][1] = 0.0;
- pmvMatrix[2][2] = -1.0;
- pmvMatrix[2][3] = 0.0;
- pmvMatrix[3][0] = pmvMatrix[0][0] * qRound(transform.dx()) - 1.0;
- pmvMatrix[3][1] = pmvMatrix[1][1] * qRound(transform.dy()) + 1.0;
- pmvMatrix[3][2] = 0.0;
- pmvMatrix[3][3] = 1.0;
-
- inverseScale = 1;
- } else {
- qreal wfactor = 2.0 / width;
- qreal hfactor = -2.0 / height;
-
- pmvMatrix[0][0] = wfactor * transform.m11() - transform.m13();
- pmvMatrix[0][1] = hfactor * transform.m12() + transform.m13();
- pmvMatrix[0][2] = 0.0;
- pmvMatrix[0][3] = transform.m13();
- pmvMatrix[1][0] = wfactor * transform.m21() - transform.m23();
- pmvMatrix[1][1] = hfactor * transform.m22() + transform.m23();
- pmvMatrix[1][2] = 0.0;
- pmvMatrix[1][3] = transform.m23();
- pmvMatrix[2][0] = 0.0;
- pmvMatrix[2][1] = 0.0;
- pmvMatrix[2][2] = -1.0;
- pmvMatrix[2][3] = 0.0;
- pmvMatrix[3][0] = wfactor * transform.dx() - transform.m33();
- pmvMatrix[3][1] = hfactor * transform.dy() + transform.m33();
- pmvMatrix[3][2] = 0.0;
- pmvMatrix[3][3] = transform.m33();
-
- // 1/10000 == 0.0001, so we have good enough res to cover curves
- // that span the entire widget...
- inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
- qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
- qreal(0.0001));
- }
+ qreal wfactor = 2.0 / width;
+ qreal hfactor = -2.0 / height;
+
+ pmvMatrix[0][0] = wfactor * transform.m11() - transform.m13();
+ pmvMatrix[0][1] = hfactor * transform.m12() + transform.m13();
+ pmvMatrix[0][2] = 0.0;
+ pmvMatrix[0][3] = transform.m13();
+ pmvMatrix[1][0] = wfactor * transform.m21() - transform.m23();
+ pmvMatrix[1][1] = hfactor * transform.m22() + transform.m23();
+ pmvMatrix[1][2] = 0.0;
+ pmvMatrix[1][3] = transform.m23();
+ pmvMatrix[2][0] = 0.0;
+ pmvMatrix[2][1] = 0.0;
+ pmvMatrix[2][2] = -1.0;
+ pmvMatrix[2][3] = 0.0;
+ pmvMatrix[3][0] = wfactor * transform.dx() - transform.m33();
+ pmvMatrix[3][1] = hfactor * transform.dy() + transform.m33();
+ pmvMatrix[3][2] = 0.0;
+ pmvMatrix[3][3] = transform.m33();
+
+ // 1/10000 == 0.0001, so we have good enough res to cover curves
+ // that span the entire widget...
+ inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
+ qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
+ qreal(0.0001));
matrixDirty = false;
@@ -817,17 +795,12 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
lastTexture = GLuint(-1);
}
- if (mode == TextDrawingMode)
- matrixDirty = true;
-
if (newMode == TextDrawingMode) {
glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data());
glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data());
-
- matrixDirty = true;
}
if (newMode == ImageDrawingMode) {
@@ -930,7 +903,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
int floatSizeInBytes = vertexCount * 2 * sizeof(float);
cache->vertexCount = vertexCount;
cache->primitiveType = GL_TRIANGLE_FAN;
- cache->iscale = inverseScale;
+ cache->iscale = inverseScale;
#ifdef QT_OPENGL_CACHE_AS_VBOS
glGenBuffers(1, &cache->vbo);
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
@@ -1545,21 +1518,21 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
- bool drawCached = true;
+ QTransform::TransformationType txtype = s->matrix.type();
- if (s->matrix.type() > QTransform::TxTranslate)
- drawCached = false;
+ float det = s->matrix.determinant();
+ bool drawCached = txtype < QTransform::TxProject;
- // don't try to cache huge fonts
+ // don't try to cache huge fonts or vastly transformed fonts
const qreal pixelSize = ti.fontEngine->fontDef.pixelSize;
- if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64)
+ if (pixelSize * pixelSize * qAbs(det) >= 64 * 64 || det < 0.25f || det > 4.f)
drawCached = false;
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
: d->glyphCacheType;
- if (d->inRenderText)
+ if (d->inRenderText || txtype > QTransform::TxTranslate)
glyphType = QFontEngineGlyphCache::Raster_A8;
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask
@@ -1589,10 +1562,10 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, s->matrix);
+ (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, QTransform());
if (!cache || cache->cacheType() != glyphType) {
- cache = new QGLTextureGlyphCache(ctx, glyphType, s->matrix);
+ cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
ti.fontEngine->setGlyphCache(ctx, cache);
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 967ba48..8003a29 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -5363,11 +5363,12 @@ QSize QGLTexture::bindCompressedTexturePVR(const char *buf, int len)
// Restore the default pixel alignment for later texture uploads.
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
- // Set the invert flag for the texture.
+ // Set the invert flag for the texture. The "vertical flip"
+ // flag in PVR is the opposite sense to our sense of inversion.
if ((pvrHeader->flags & PVR_VERTICAL_FLIP) != 0)
- options |= QGLContext::InvertedYBindOption;
- else
options &= ~QGLContext::InvertedYBindOption;
+ else
+ options |= QGLContext::InvertedYBindOption;
return QSize(pvrHeader->width, pvrHeader->height);
}
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 179d69a..615fb60 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -397,7 +397,7 @@ public:
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions)
-class Q_AUTOTEST_EXPORT QGLShareRegister
+class Q_OPENGL_EXPORT QGLShareRegister
{
public:
QGLShareRegister() {}
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 0299cea..4e1d50d 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -424,6 +424,7 @@ bool QGLPixmapData::fromFile(const QString &filename, const char *format,
resize(0, 0);
data = file.readAll();
file.close();
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
QSize size = m_texture.bindCompressedTexture
(data.constData(), data.size(), format);
if (!size.isEmpty()) {
@@ -449,6 +450,7 @@ bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format,
const char *buf = reinterpret_cast<const char *>(buffer);
if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) {
resize(0, 0);
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
QSize size = m_texture.bindCompressedTexture(buf, int(len), format);
if (!size.isEmpty()) {
w = size.width();
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 4cb0184..4744eb6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -958,47 +958,47 @@ struct FlagDescription {
};
static const FlagDescription accelerationDescriptions[] = {
- { " DFXL_NONE ", DFXL_NONE },
- { " DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE },
- { " DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE },
- { " DFXL_DRAWLINE", DFXL_DRAWLINE },
- { " DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE },
- { " DFXL_BLIT", DFXL_BLIT },
- { " DFXL_STRETCHBLIT", DFXL_STRETCHBLIT },
- { " DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES },
- { " DFXL_DRAWSTRING", DFXL_DRAWSTRING },
+ { "DFXL_NONE", DFXL_NONE },
+ { "DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE },
+ { "DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE },
+ { "DFXL_DRAWLINE", DFXL_DRAWLINE },
+ { "DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE },
+ { "DFXL_BLIT", DFXL_BLIT },
+ { "DFXL_STRETCHBLIT", DFXL_STRETCHBLIT },
+ { "DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES },
+ { "DFXL_DRAWSTRING", DFXL_DRAWSTRING },
{ 0, 0 }
};
static const FlagDescription blitDescriptions[] = {
- { " DSBLIT_NOFX", DSBLIT_NOFX },
- { " DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL },
- { " DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA },
- { " DSBLIT_COLORIZE", DSBLIT_COLORIZE },
- { " DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY },
- { " DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY },
- { " DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY },
- { " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
- { " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
- { " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
+ { "DSBLIT_NOFX", DSBLIT_NOFX },
+ { "DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL },
+ { "DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA },
+ { "DSBLIT_COLORIZE", DSBLIT_COLORIZE },
+ { "DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY },
+ { "DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY },
+ { "DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY },
+ { "DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
+ { "DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
+ { "DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
#if (Q_DIRECTFB_VERSION >= 0x000923)
- { " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
- { " DSBLIT_XOR", DSBLIT_XOR },
+ { "DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
+ { "DSBLIT_XOR", DSBLIT_XOR },
#endif
#if (Q_DIRECTFB_VERSION >= 0x010000)
- { " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
+ { "DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
#endif
{ 0, 0 }
};
static const FlagDescription drawDescriptions[] = {
- { " DSDRAW_NOFX", DSDRAW_NOFX },
- { " DSDRAW_BLEND", DSDRAW_BLEND },
- { " DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY },
- { " DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY },
- { " DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY },
- { " DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY },
- { " DSDRAW_XOR", DSDRAW_XOR },
+ { "DSDRAW_NOFX", DSDRAW_NOFX },
+ { "DSDRAW_BLEND", DSDRAW_BLEND },
+ { "DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY },
+ { "DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY },
+ { "DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY },
+ { "DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY },
+ { "DSDRAW_XOR", DSDRAW_XOR },
{ 0, 0 }
};
#endif
@@ -1259,11 +1259,14 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
setIntOption(displayArgs, QLatin1String("height"), &h);
#ifndef QT_NO_DIRECTFB_LAYER
- result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY,
+ int layerId = DLID_PRIMARY;
+ setIntOption(displayArgs, QLatin1String("layerid"), &layerId);
+
+ result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, static_cast<DFBDisplayLayerID>(layerId),
&d_ptr->dfbLayer);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreen::connect: "
- "Unable to get primary display layer!", result);
+ "Unable to get display layer!", result);
return false;
}
result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 021d52e..b79418a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -128,7 +128,6 @@ IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const
return (dfbWindow ? dfbWindow : (sibling ? sibling->dfbWindow : 0));
}
-
void QDirectFBWindowSurface::createWindow(const QRect &rect)
{
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
@@ -169,6 +168,9 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect)
DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result);
if (window()) {
+ if (window()->windowFlags() & Qt::WindowStaysOnTopHint) {
+ dfbWindow->SetStackingClass(dfbWindow, DWSC_UPPER);
+ }
DFBWindowID winid;
result = dfbWindow->GetID(dfbWindow, &winid);
if (result != DFB_OK) {