summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h4
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp59
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h17
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h22
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache_p.h4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp152
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h40
-rw-r--r--src/opengl/opengl.pro17
-rw-r--r--src/opengl/qegl.cpp842
-rw-r--r--src/opengl/qegl_p.h188
-rw-r--r--src/opengl/qegl_qws.cpp125
-rw-r--r--src/opengl/qegl_wince.cpp105
-rw-r--r--src/opengl/qegl_x11egl.cpp133
-rw-r--r--src/opengl/qgl.cpp4
-rw-r--r--src/opengl/qgl.h4
-rw-r--r--src/opengl/qgl_cl_p.h4
-rw-r--r--src/opengl/qgl_egl.cpp4
-rw-r--r--src/opengl/qgl_egl_p.h6
-rw-r--r--src/opengl/qgl_mac.mm4
-rw-r--r--src/opengl/qgl_p.h4
-rw-r--r--src/opengl/qgl_qws.cpp65
-rw-r--r--src/opengl/qgl_win.cpp4
-rw-r--r--src/opengl/qgl_wince.cpp8
-rw-r--r--src/opengl/qgl_x11.cpp16
-rw-r--r--src/opengl/qgl_x11egl.cpp10
-rw-r--r--src/opengl/qglcolormap.cpp4
-rw-r--r--src/opengl/qglcolormap.h4
-rw-r--r--src/opengl/qglextensions.cpp4
-rw-r--r--src/opengl/qglextensions_p.h4
-rw-r--r--src/opengl/qglframebufferobject.cpp10
-rw-r--r--src/opengl/qglframebufferobject.h4
-rw-r--r--src/opengl/qglpaintdevice_qws.cpp4
-rw-r--r--src/opengl/qglpaintdevice_qws_p.h4
-rw-r--r--src/opengl/qglpixelbuffer.cpp4
-rw-r--r--src/opengl/qglpixelbuffer.h4
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp14
-rw-r--r--src/opengl/qglpixelbuffer_mac.mm4
-rw-r--r--src/opengl/qglpixelbuffer_p.h4
-rw-r--r--src/opengl/qglpixelbuffer_win.cpp4
-rw-r--r--src/opengl/qglpixelbuffer_x11.cpp4
-rw-r--r--src/opengl/qglpixmapfilter.cpp4
-rw-r--r--src/opengl/qglpixmapfilter_p.h4
-rw-r--r--src/opengl/qglscreen_qws.cpp4
-rw-r--r--src/opengl/qglscreen_qws.h4
-rw-r--r--src/opengl/qglshaderprogram.cpp4
-rw-r--r--src/opengl/qglshaderprogram.h4
-rw-r--r--src/opengl/qglwindowsurface_qws.cpp4
-rw-r--r--src/opengl/qglwindowsurface_qws_p.h4
-rw-r--r--src/opengl/qgraphicssystem_gl.cpp5
-rw-r--r--src/opengl/qgraphicssystem_gl_p.h4
-rw-r--r--src/opengl/qpaintengine_opengl.cpp64
-rw-r--r--src/opengl/qpaintengine_opengl_p.h5
-rw-r--r--src/opengl/qpixmapdata_gl.cpp83
-rw-r--r--src/opengl/qpixmapdata_gl_p.h11
-rw-r--r--src/opengl/qwindowsurface_gl.cpp23
-rw-r--r--src/opengl/qwindowsurface_gl_p.h4
-rw-r--r--src/opengl/util/fragmentprograms_p.h4
-rw-r--r--src/opengl/util/generator.cpp4
60 files changed, 501 insertions, 1663 deletions
diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
index 560ad3a..fc4d8b5 100644
--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
+++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
index d7a9f73..c2af1a4 100644
--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
+++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index b71c4c1..4b73ca9 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -191,7 +191,29 @@ QGLEngineShaderManager::~QGLEngineShaderManager()
}
+uint QGLEngineShaderManager::getUniformIdentifier(const char *uniformName)
+{
+ uniformIdentifiers << uniformName;
+ return uniformIdentifiers.size() - 1;
+}
+
+uint QGLEngineShaderManager::getUniformLocation(uint id)
+{
+ QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
+ uint oldSize = uniformLocations.size();
+ if (oldSize <= id) {
+ uint newSize = id + 1;
+ uniformLocations.resize(newSize);
+
+ for (uint i = oldSize; i < newSize; ++i)
+ uniformLocations[i] = GLuint(-1);
+ }
+ if (uniformLocations.at(id) == GLuint(-1))
+ uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformIdentifiers.at(id));
+
+ return uniformLocations.at(id);
+}
void QGLEngineShaderManager::optimiseForBrushTransform(const QTransform &transform)
@@ -206,43 +228,61 @@ void QGLEngineShaderManager::setDirty()
void QGLEngineShaderManager::setSrcPixelType(Qt::BrushStyle style)
{
+ if (srcPixelType == PixelSrcType(style))
+ return;
+
srcPixelType = style;
shaderProgNeedsChanging = true; //###
}
void QGLEngineShaderManager::setSrcPixelType(PixelSrcType type)
{
+ if (srcPixelType == type)
+ return;
+
srcPixelType = type;
shaderProgNeedsChanging = true; //###
}
void QGLEngineShaderManager::setTextureCoordsEnabled(bool enabled)
{
+ if (useTextureCoords == enabled)
+ return;
+
useTextureCoords = enabled;
shaderProgNeedsChanging = true; //###
}
void QGLEngineShaderManager::setUseGlobalOpacity(bool useOpacity)
{
+ if (useGlobalOpacity == useOpacity)
+ return;
+
useGlobalOpacity = useOpacity;
shaderProgNeedsChanging = true; //###
}
void QGLEngineShaderManager::setMaskType(MaskType type)
{
+ if (maskType == type)
+ return;
+
maskType = type;
shaderProgNeedsChanging = true; //###
}
void QGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode)
{
+ if (compositionMode == mode)
+ return;
+
compositionMode = mode;
shaderProgNeedsChanging = true; //###
}
QGLShaderProgram* QGLEngineShaderManager::currentProgram()
{
- return currentShaderProg;
+ return currentShaderProg->program;
}
QGLShaderProgram* QGLEngineShaderManager::simpleProgram()
@@ -432,15 +472,16 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
// At this point, requiredProgram is fully populated so try to find the program in the cache
- foreach (const QGLEngineShaderProg &prog, cachedPrograms) {
+ for (int i = 0; i < cachedPrograms.size(); ++i) {
+ QGLEngineShaderProg &prog = cachedPrograms[i];
if ( (prog.mainVertexShader == requiredProgram.mainVertexShader)
&& (prog.positionVertexShader == requiredProgram.positionVertexShader)
&& (prog.mainFragShader == requiredProgram.mainFragShader)
&& (prog.srcPixelFragShader == requiredProgram.srcPixelFragShader)
&& (prog.compositionFragShader == requiredProgram.compositionFragShader) )
{
- currentShaderProg = prog.program;
- currentShaderProg->enable();
+ currentShaderProg = &prog;
+ currentShaderProg->program->enable();
shaderProgNeedsChanging = false;
return true;
}
@@ -480,8 +521,10 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
}
else {
cachedPrograms.append(requiredProgram);
- currentShaderProg = requiredProgram.program;
- currentShaderProg->enable();
+ // taking the address here is safe since
+ // cachePrograms isn't resized anywhere else
+ currentShaderProg = &cachedPrograms.last();
+ currentShaderProg->program->enable();
}
shaderProgNeedsChanging = false;
return true;
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 4a55eca..34f0768 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -237,6 +237,8 @@ struct QGLEngineShaderProg
QGLShader* maskFragShader; // Can be null for no mask
QGLShader* compositionFragShader; // Can be null for GL-handled mode
QGLShaderProgram* program;
+
+ QVector<uint> uniformLocations;
};
/*
@@ -283,6 +285,9 @@ public:
void setMaskType(MaskType);
void setCompositionMode(QPainter::CompositionMode);
+ uint getUniformIdentifier(const char *uniformName);
+ uint getUniformLocation(uint id);
+
void setDirty(); // someone has manually changed the current shader program
bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
@@ -374,9 +379,9 @@ private:
bool useTextureCoords;
QPainter::CompositionMode compositionMode;
- QGLShaderProgram* blitShaderProg;
- QGLShaderProgram* simpleShaderProg;
- QGLShaderProgram* currentShaderProg;
+ QGLShaderProgram* blitShaderProg;
+ QGLShaderProgram* simpleShaderProg;
+ QGLEngineShaderProg* currentShaderProg;
// TODO: Possibly convert to a LUT
QList<QGLEngineShaderProg> cachedPrograms;
@@ -386,6 +391,8 @@ private:
void compileNamedShader(QGLEngineShaderManager::ShaderName name, QGLShader::ShaderType type);
static const char* qglEngineShaderSourceCode[TotalShaderCount];
+
+ QVector<const char *> uniformIdentifiers;
};
QT_END_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index 61cc63e..4e32f91 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,19 +64,23 @@ QT_MODULE(OpenGL)
static const char* const qglslMainVertexShader = "\
+ uniform highp float depth;\
void setPosition();\
void main(void)\
{\
setPosition();\
+ gl_Position.z = depth * gl_Position.w;\
}";
static const char* const qglslMainWithTexCoordsVertexShader = "\
attribute lowp vec2 textureCoordArray; \
varying lowp vec2 textureCoords; \
+ uniform highp float depth;\
void setPosition();\
void main(void) \
{\
setPosition();\
+ gl_Position.z = depth * gl_Position.w;\
textureCoords = textureCoordArray; \
}";
@@ -84,20 +88,16 @@ static const char* const qglslMainWithTexCoordsVertexShader = "\
static const char* const qglslPositionOnlyVertexShader = "\
attribute highp vec4 vertexCoordsArray;\
uniform highp mat4 pmvMatrix;\
- uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
- gl_Position.z = depth;\
}";
static const char* const qglslUntransformedPositionVertexShader = "\
attribute highp vec4 vertexCoordsArray;\
- uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = vertexCoordsArray;\
- gl_Position.z = depth;\
}";
// Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125
@@ -108,11 +108,9 @@ static const char* const qglslPositionWithPatternBrushVertexShader = "\
uniform mediump vec2 invertedTextureSize; \
uniform mediump mat3 brushTransform; \
varying mediump vec2 patternTexCoords; \
- uniform highp float depth;\
void setPosition(void) { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth;\
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -142,11 +140,9 @@ static const char* const qglslPositionWithLinearGradientBrushVertexShader = "\
uniform highp vec3 linearData; \
uniform highp mat3 brushTransform; \
varying mediump float index ; \
- uniform highp float depth;\
void setPosition() { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth;\
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -174,12 +170,10 @@ static const char* const qglslPositionWithConicalGradientBrushVertexShader = "\
uniform mediump vec2 halfViewportSize; \
uniform highp mat3 brushTransform; \
varying highp vec2 A; \
- uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -215,12 +209,10 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\
uniform highp vec2 fmp; \
varying highp float b; \
varying highp vec2 A; \
- uniform highp float depth;\
void setPosition(void) \
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -254,11 +246,9 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\
uniform mediump vec2 invertedTextureSize; \
uniform mediump mat3 brushTransform; \
varying mediump vec2 brushTextureCoords; \
- uniform highp float depth;\
void setPosition(void) { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp
index f1a8850..8c6b4f0 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache.cpp
+++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h
index f088359..55c7b65 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache_p.h
+++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 19cb02a..4bf5d4c 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -248,9 +248,13 @@ QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate()
}
}
-void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform)
+void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id)
{
// glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit?
+ if (id != -1 && id == lastTexture)
+ return;
+
+ lastTexture = id;
if (smoothPixmapTransform) {
glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -368,7 +372,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
if (style == Qt::SolidPattern) {
QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue("fragmentColor", col);
+ shaderManager->currentProgram()->setUniformValue(location(FragmentColor), col);
}
else {
// All other brushes have a transform and thus need the translation point:
@@ -379,10 +383,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue("patternColor", col);
+ shaderManager->currentProgram()->setUniformValue(location(PatternColor), col);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue("halfViewportSize", halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
}
else if (style == Qt::LinearGradientPattern) {
const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush->gradient());
@@ -399,10 +403,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
1.0f / (l.x() * l.x() + l.y() * l.y())
);
- shaderManager->currentProgram()->setUniformValue("linearData", linearData);
+ shaderManager->currentProgram()->setUniformValue(location(LinearData), linearData);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue("halfViewportSize", halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
}
else if (style == Qt::ConicalGradientPattern) {
const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush->gradient());
@@ -410,10 +414,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0;
- shaderManager->currentProgram()->setUniformValue("angle", angle);
+ shaderManager->currentProgram()->setUniformValue(location(Angle), angle);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue("halfViewportSize", halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
}
else if (style == Qt::RadialGradientPattern) {
const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush->gradient());
@@ -423,15 +427,15 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
translationPoint = realFocal;
QPointF fmp = realCenter - realFocal;
- shaderManager->currentProgram()->setUniformValue("fmp", fmp);
+ shaderManager->currentProgram()->setUniformValue(location(Fmp), fmp);
GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius;
- shaderManager->currentProgram()->setUniformValue("fmp2_m_radius2", fmp2_m_radius2);
- shaderManager->currentProgram()->setUniformValue("inverse_2_fmp2_m_radius2",
+ shaderManager->currentProgram()->setUniformValue(location(Fmp2MRadius2), fmp2_m_radius2);
+ shaderManager->currentProgram()->setUniformValue(location(Inverse2Fmp2MRadius2),
GLfloat(1.0 / (2.0*fmp2_m_radius2)));
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue("halfViewportSize", halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
}
else if (style == Qt::TexturePattern) {
translationPoint = q->state()->brushOrigin;
@@ -440,14 +444,14 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
if (qHasPixmapTexture(*currentBrush) && currentBrush->texture().isQBitmap()) {
QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue("patternColor", col);
+ shaderManager->currentProgram()->setUniformValue(location(PatternColor), col);
}
QSizeF invertedTextureSize( 1.0 / texPixmap.width(), 1.0 / texPixmap.height() );
- shaderManager->currentProgram()->setUniformValue("invertedTextureSize", invertedTextureSize);
+ shaderManager->currentProgram()->setUniformValue(location(InvertedTextureSize), invertedTextureSize);
QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue("halfViewportSize", halfViewportSize);
+ shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize);
}
else
qWarning("QGL2PaintEngineEx: Unimplemented fill style");
@@ -456,8 +460,8 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
QTransform gl_to_qt(1, 0, 0, -1, 0, height);
QTransform inv_matrix = gl_to_qt * (brushQTransform * q->state()->matrix).inverted() * translate;
- shaderManager->currentProgram()->setUniformValue("brushTransform", inv_matrix);
- shaderManager->currentProgram()->setUniformValue("brushTexture", QT_BRUSH_TEXTURE_UNIT);
+ shaderManager->currentProgram()->setUniformValue(location(BrushTransform), inv_matrix);
+ shaderManager->currentProgram()->setUniformValue(location(BrushTexture), QT_BRUSH_TEXTURE_UNIT);
}
brushUniformsDirty = false;
}
@@ -591,22 +595,17 @@ static inline void setCoords(GLfloat *coords, const QGLRect &rect)
void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern)
{
- transferMode(ImageDrawingMode);
-
- updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
-
// Setup for texture drawing
shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
shaderManager->setTextureCoordsEnabled(true);
- prepareForDraw(opaque);
+ if (prepareForDraw(opaque))
+ shaderManager->currentProgram()->setUniformValue(location(ImageTexture), QT_IMAGE_TEXTURE_UNIT);
if (pattern) {
QColor col = premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue("patternColor", col);
+ shaderManager->currentProgram()->setUniformValue(location(PatternColor), col);
}
- shaderManager->currentProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT);
-
GLfloat dx = 1.0 / textureSize.width();
GLfloat dy = 1.0 / textureSize.height();
@@ -651,8 +650,12 @@ void QGL2PaintEngineEx::sync()
glLoadMatrixf(&mv_matrix[0][0]);
#endif
+ d->lastTexture = GLuint(-1);
+
glDisable(GL_BLEND);
glActiveTexture(GL_TEXTURE0);
+
+ d->needsSync = true;
}
void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
@@ -663,6 +666,8 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
if (mode == TextDrawingMode || mode == ImageDrawingMode) {
glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
+
+ lastTexture = GLuint(-1);
}
if (mode == TextDrawingMode)
@@ -796,7 +801,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
-void QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
+bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
{
if (brushTextureDirty && mode != ImageDrawingMode)
updateBrushTexture();
@@ -808,12 +813,14 @@ void QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
updateMatrix();
const bool stateHasOpacity = q->state()->opacity < 0.99f;
- if (q->state()->compositionMode() == QPainter::CompositionMode_Source
- || (q->state()->compositionMode() == QPainter::CompositionMode_SourceOver
+ if (q->state()->composition_mode == QPainter::CompositionMode_Source
+ || (q->state()->composition_mode == QPainter::CompositionMode_SourceOver
&& srcPixelsAreOpaque && !stateHasOpacity))
+ {
glDisable(GL_BLEND);
- else
+ } else {
glEnable(GL_BLEND);
+ }
bool useGlobalOpacityUniform = stateHasOpacity;
if (stateHasOpacity && (mode != ImageDrawingMode)) {
@@ -826,30 +833,35 @@ void QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
}
shaderManager->setUseGlobalOpacity(useGlobalOpacityUniform);
-
+ bool changed = shaderManager->useCorrectShaderProg();
// If the shader program needs changing, we change it and mark all uniforms as dirty
- if (shaderManager->useCorrectShaderProg()) {
+ if (changed) {
// The shader program has changed so mark all uniforms as dirty:
brushUniformsDirty = true;
shaderMatrixUniformDirty = true;
depthUniformDirty = true;
+ opacityUniformDirty = true;
}
if (brushUniformsDirty && mode != ImageDrawingMode)
updateBrushUniforms();
if (shaderMatrixUniformDirty) {
- shaderManager->currentProgram()->setUniformValue("pmvMatrix", pmvMatrix);
+ shaderManager->currentProgram()->setUniformValue(location(PmvMatrix), pmvMatrix);
shaderMatrixUniformDirty = false;
}
if (depthUniformDirty) {
- shaderManager->currentProgram()->setUniformValue("depth", (GLfloat)q->state()->currentDepth);
+ shaderManager->currentProgram()->setUniformValue(location(Depth), (GLfloat)q->state()->currentDepth);
depthUniformDirty = false;
}
- if (useGlobalOpacityUniform)
- shaderManager->currentProgram()->setUniformValue("globalOpacity", (GLfloat)q->state()->opacity);
+ if (useGlobalOpacityUniform && opacityUniformDirty) {
+ shaderManager->currentProgram()->setUniformValue(location(GlobalOpacity), (GLfloat)q->state()->opacity);
+ opacityUniformDirty = false;
+ }
+
+ return changed;
}
void QGL2PaintEngineExPrivate::composite(const QGLRect& boundingRect)
@@ -971,6 +983,7 @@ void QGL2PaintEngineEx::opacityChanged()
Q_ASSERT(d->shaderManager);
d->brushUniformsDirty = true;
+ d->opacityUniformDirty = true;
}
void QGL2PaintEngineEx::compositionModeChanged()
@@ -982,6 +995,16 @@ void QGL2PaintEngineEx::compositionModeChanged()
void QGL2PaintEngineEx::renderHintsChanged()
{
+#if !defined(QT_OPENGL_ES_2)
+ if ((state()->renderHints & QPainter::Antialiasing)
+ || (state()->renderHints & QPainter::HighQualityAntialiasing))
+ glEnable(GL_MULTISAMPLE);
+ else
+ glDisable(GL_MULTISAMPLE);
+#endif
+
+ Q_D(QGL2PaintEngineEx);
+ d->lastTexture = GLuint(-1);
// qDebug("QGL2PaintEngineEx::renderHintsChanged() not implemented!");
}
@@ -1000,11 +1023,13 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c
QGLContext *ctx = d->ctx;
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, true);
+ GLuint id = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, true);
bool isBitmap = pixmap.isQBitmap();
bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel();
+ d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT,
+ state()->renderHints & QPainter::SmoothPixmapTransform, id);
d->drawTexture(dest, src, pixmap.size(), isOpaque, isBitmap);
}
@@ -1017,8 +1042,10 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const
QGLContext *ctx = d->ctx;
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true);
+ GLuint id = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true);
+ d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT,
+ state()->renderHints & QPainter::SmoothPixmapTransform, id);
d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel());
}
@@ -1055,8 +1082,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
- QTransform matrix;
- matrix.translate(p.x(), p.y());
+ QTransform matrix = QTransform::fromTranslate(p.x(), p.y());
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
@@ -1114,7 +1140,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte
prepareForDraw(false); // Text always causes src pixels to be transparent
- shaderManager->currentProgram()->setUniformValue("maskTexture", QT_MASK_TEXTURE_UNIT);
+ shaderManager->currentProgram()->setUniformValue(location(MaskTexture), QT_MASK_TEXTURE_UNIT);
if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr)
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data());
@@ -1154,9 +1180,29 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
qt_resolve_version_2_0_functions(d->ctx);
#endif
- if (!d->shaderManager)
+ if (d->shaderManager) {
+ d->shaderManager->setDirty();
+ } else {
d->shaderManager = new QGLEngineShaderManager(d->ctx);
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::ImageTexture] = d->shaderManager->getUniformIdentifier("imageTexture");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::PatternColor] = d->shaderManager->getUniformIdentifier("patternColor");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::GlobalOpacity] = d->shaderManager->getUniformIdentifier("globalOpacity");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::Depth] = d->shaderManager->getUniformIdentifier("depth");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::PmvMatrix] = d->shaderManager->getUniformIdentifier("pmvMatrix");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::MaskTexture] = d->shaderManager->getUniformIdentifier("maskTexture");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::FragmentColor] = d->shaderManager->getUniformIdentifier("fragmentColor");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::LinearData] = d->shaderManager->getUniformIdentifier("linearData");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::Angle] = d->shaderManager->getUniformIdentifier("angle");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::HalfViewportSize] = d->shaderManager->getUniformIdentifier("halfViewportSize");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::Fmp] = d->shaderManager->getUniformIdentifier("fmp");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::Fmp2MRadius2] = d->shaderManager->getUniformIdentifier("fmp2_m_radius2");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::Inverse2Fmp2MRadius2] = d->shaderManager->getUniformIdentifier("inverse_2_fmp2_m_radius2");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::InvertedTextureSize] = d->shaderManager->getUniformIdentifier("invertedTextureSize");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::BrushTransform] = d->shaderManager->getUniformIdentifier("brushTransform");
+ d->uniformIdentifiers[QGL2PaintEngineExPrivate::BrushTexture] = d->shaderManager->getUniformIdentifier("brushTexture");
+ }
+
glViewport(0, 0, d->width, d->height);
// glClearColor(0.0, 1.0, 0.0, 1.0);
@@ -1172,6 +1218,8 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->stencilBufferDirty = true;
d->simpleShaderDepthUniformDirty = true;
d->depthUniformDirty = true;
+ d->opacityUniformDirty = true;
+ d->needsSync = false;
d->use_system_clip = !systemClip().isEmpty();
@@ -1180,6 +1228,10 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
glDepthFunc(GL_LEQUAL);
glDepthMask(false);
+#if !defined(QT_OPENGL_ES_2)
+ glDisable(GL_MULTISAMPLE);
+#endif
+
QGLPixmapData *source = d->drawable.copyOnBegin();
if (d->drawable.context()->d_func()->clear_on_painter_begin && d->drawable.autoFillBackground()) {
if (d->drawable.hasTransparentBackground())
@@ -1199,6 +1251,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
source->bind(false);
QRect rect(0, 0, source->width(), source->height());
+ d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false);
d->drawTexture(QRectF(rect), QRectF(rect), rect.size(), true);
}
@@ -1245,11 +1298,15 @@ void QGL2PaintEngineEx::ensureActive()
ctx->d_ptr->active_engine = this;
- glDisable(GL_DEPTH_TEST);
+ d->needsSync = true;
+ }
+ if (d->needsSync) {
glViewport(0, 0, d->width, d->height);
-
+ glDepthMask(false);
+ glDepthFunc(GL_LEQUAL);
setState(state());
+ d->needsSync = false;
}
}
@@ -1485,6 +1542,8 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state)
return;
}
+ renderHintsChanged();
+
d->matrixDirty = true;
d->compositionModeDirty = true;
d->brushTextureDirty = true;
@@ -1493,6 +1552,9 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state)
d->depthUniformDirty = true;
d->simpleShaderMatrixUniformDirty = true;
d->shaderMatrixUniformDirty = true;
+ d->opacityUniformDirty = true;
+
+ d->shaderManager->setDirty();
if (old_state && old_state != s && old_state->canRestoreClip) {
d->updateDepthScissorTest();
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 8a50096..0d28a49 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -156,7 +156,7 @@ public:
void updateBrushUniforms();
void updateMatrix();
void updateCompositionMode();
- void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform);
+ void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id = -1);
void setBrush(const QBrush* brush);
@@ -175,7 +175,8 @@ public:
void fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill);
// ^ Calls drawVertexArrays to render into stencil buffer
- void prepareForDraw(bool srcPixelsAreOpaque);
+ bool prepareForDraw(bool srcPixelsAreOpaque);
+ // ^ returns whether the current program changed or not
inline void useSimpleShader();
inline QColor premultiplyColor(QColor c, GLfloat opacity);
@@ -198,6 +199,7 @@ public:
bool stencilBufferDirty;
bool depthUniformDirty;
bool simpleShaderDepthUniformDirty;
+ bool opacityUniformDirty;
const QBrush* currentBrush; // May not be the state's brush!
@@ -218,6 +220,36 @@ public:
void regenerateDepthClip();
void systemStateChanged();
uint use_system_clip : 1;
+
+ enum Uniform {
+ ImageTexture,
+ PatternColor,
+ GlobalOpacity,
+ Depth,
+ PmvMatrix,
+ MaskTexture,
+ FragmentColor,
+ LinearData,
+ Angle,
+ HalfViewportSize,
+ Fmp,
+ Fmp2MRadius2,
+ Inverse2Fmp2MRadius2,
+ InvertedTextureSize,
+ BrushTransform,
+ BrushTexture,
+ NumUniforms
+ };
+
+ uint location(Uniform uniform)
+ {
+ return shaderManager->getUniformLocation(uniformIdentifiers[uniform]);
+ }
+
+ uint uniformIdentifiers[NumUniforms];
+ GLuint lastTexture;
+
+ bool needsSync;
};
QT_END_NAMESPACE
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 73af174..c92b8cf 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -62,12 +62,9 @@ x11 {
contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles1cl)|contains(QT_CONFIG, opengles2) {
SOURCES += qgl_x11egl.cpp \
qglpixelbuffer_egl.cpp \
- qgl_egl.cpp \
- qegl.cpp \
- qegl_x11egl.cpp
+ qgl_egl.cpp
- HEADERS += qegl_p.h \
- qgl_egl_p.h
+ HEADERS += qgl_egl_p.h
} else {
SOURCES += qgl_x11.cpp \
@@ -93,13 +90,10 @@ win32:!wince*: {
wince*: {
SOURCES += qgl_wince.cpp \
qglpixelbuffer_egl.cpp \
- qgl_egl.cpp \
- qegl.cpp \
- qegl_wince.cpp
+ qgl_egl.cpp
HEADERS += qgl_cl_p.h \
qgl_egl_p.h \
- qegl_p.h
}
embedded {
@@ -108,15 +102,12 @@ embedded {
qglpixelbuffer_egl.cpp \
qglscreen_qws.cpp \
qglwindowsurface_qws.cpp \
- qegl.cpp \
- qegl_qws.cpp \
qgl_egl.cpp
HEADERS += qglpaintdevice_qws_p.h \
qglscreen_qws.h \
qglwindowsurface_qws_p.h \
- qgl_egl_p.h \
- qegl_p.h
+ qgl_egl_p.h
contains(QT_CONFIG, fontconfig) {
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
diff --git a/src/opengl/qegl.cpp b/src/opengl/qegl.cpp
deleted file mode 100644
index 290f77c..0000000
--- a/src/opengl/qegl.cpp
+++ /dev/null
@@ -1,842 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qwidget.h>
-#include <QtCore/qdebug.h>
-#include "qegl_p.h"
-
-#if defined(QT_OPENGL_ES) || defined(QT_OPENVG)
-
-QT_BEGIN_NAMESPACE
-
-QEglContext::QEglContext()
-{
- apiType = OpenGL;
- dpy = EGL_NO_DISPLAY;
- ctx = EGL_NO_CONTEXT;
- surf = EGL_NO_SURFACE;
- cfg = 0;
- share = false;
- reserved = 0;
-}
-
-QEglContext::~QEglContext()
-{
- destroy();
-}
-
-bool QEglContext::isValid() const
-{
- return (ctx != EGL_NO_CONTEXT);
-}
-
-bool QEglContext::isSharing() const
-{
- return share;
-}
-
-// Open the EGL display associated with "device".
-bool QEglContext::openDisplay(QPaintDevice *device)
-{
- if (dpy == EGL_NO_DISPLAY)
- dpy = defaultDisplay(device);
- return (dpy != EGL_NO_DISPLAY);
-}
-
-// Choose a configuration that matches "properties".
-bool QEglContext::chooseConfig
- (const QEglProperties& properties, PixelFormatMatch match)
-{
- QEglProperties props(properties);
- EGLConfig *configs;
- EGLint matching, size;
- do {
- // Get the number of matching configurations for this set of properties.
- matching = 0;
- if (!eglChooseConfig(dpy, props.properties(), 0, 256, &matching) || !matching)
- continue;
-
- // If we want the best pixel format, then return the first
- // matching configuration.
- if (match == BestPixelFormat) {
- eglChooseConfig(dpy, props.properties(), &cfg, 1, &matching);
- if (matching < 1)
- continue;
- return true;
- }
-
- // Fetch all of the matching configurations and find the
- // first that matches the pixel format we wanted.
- size = matching;
- configs = new EGLConfig [size];
- eglChooseConfig(dpy, props.properties(), configs, size, &matching);
- for (EGLint index = 0; index < size; ++index) {
- EGLint red, green, blue, alpha;
- eglGetConfigAttrib(dpy, configs[index], EGL_RED_SIZE, &red);
- eglGetConfigAttrib(dpy, configs[index], EGL_GREEN_SIZE, &green);
- eglGetConfigAttrib(dpy, configs[index], EGL_BLUE_SIZE, &blue);
- eglGetConfigAttrib(dpy, configs[index], EGL_ALPHA_SIZE, &alpha);
- if (red == props.value(EGL_RED_SIZE) &&
- green == props.value(EGL_GREEN_SIZE) &&
- blue == props.value(EGL_BLUE_SIZE) &&
- (props.value(EGL_ALPHA_SIZE) == 0 ||
- alpha == props.value(EGL_ALPHA_SIZE))) {
- cfg = configs[index];
- delete [] configs;
- return true;
- }
- }
- delete [] configs;
- } while (props.reduceConfiguration());
-
-#ifdef EGL_BIND_TO_TEXTURE_RGBA
- // Don't report an error just yet if we failed to get a pbuffer
- // configuration with texture rendering. Only report failure if
- // we cannot get any pbuffer configurations at all.
- if (props.value(EGL_BIND_TO_TEXTURE_RGBA) == EGL_DONT_CARE &&
- props.value(EGL_BIND_TO_TEXTURE_RGB) == EGL_DONT_CARE)
-#endif
- {
- qWarning() << "QEglContext::chooseConfig(): Could not find a suitable EGL configuration";
- qWarning() << "Requested:" << props.toString();
- qWarning() << "Available:";
- dumpAllConfigs();
- }
- return false;
-}
-
-// Create the EGLContext.
-bool QEglContext::createContext(QEglContext *shareContext)
-{
- // We need to select the correct API before calling eglCreateContext().
-#ifdef EGL_OPENGL_ES_API
- if (apiType == OpenGL)
- eglBindAPI(EGL_OPENGL_ES_API);
-#endif
-#ifdef EGL_OPENVG_API
- if (apiType == OpenVG)
- eglBindAPI(EGL_OPENVG_API);
-#endif
-
- // Create a new context for the configuration.
- QEglProperties contextProps;
-#if defined(QT_OPENGL_ES_2)
- if (apiType == OpenGL)
- contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2);
-#endif
- if (shareContext && shareContext->ctx == EGL_NO_CONTEXT)
- shareContext = 0;
- if (shareContext) {
- ctx = eglCreateContext(dpy, cfg, shareContext->ctx, contextProps.properties());
- if (ctx == EGL_NO_CONTEXT) {
- qWarning() << "QEglContext::createContext(): Could not share context:" << errorString(eglGetError());
- shareContext = 0;
- }
- }
- if (ctx == EGL_NO_CONTEXT) {
- ctx = eglCreateContext(dpy, cfg, 0, contextProps.properties());
- if (ctx == EGL_NO_CONTEXT) {
- qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << errorString(eglGetError());
- return false;
- }
- }
- share = (shareContext != 0);
- return true;
-}
-
-// Recreate the surface for a paint device because the native id has changed.
-bool QEglContext::recreateSurface(QPaintDevice *device)
-{
- // Bail out if the surface has not been created for the first time yet.
- if (surf == EGL_NO_SURFACE)
- return true;
-
- // Destroy the old surface.
- eglDestroySurface(dpy, surf);
-
- // Create a new one.
- return createSurface(device);
-}
-
-void QEglContext::destroy()
-{
- if (ctx != EGL_NO_CONTEXT)
- eglDestroyContext(dpy, ctx);
- dpy = EGL_NO_DISPLAY;
- ctx = EGL_NO_CONTEXT;
- surf = EGL_NO_SURFACE;
- cfg = 0;
- share = false;
-}
-
-bool QEglContext::makeCurrent()
-{
- if(ctx == EGL_NO_CONTEXT) {
- qWarning() << "QEglContext::makeCurrent(): Cannot make invalid context current";
- return false;
- }
-
- bool ok = eglMakeCurrent(dpy, surf, surf, ctx);
- if (!ok) {
- EGLint err = eglGetError();
- qWarning() << "QEglContext::makeCurrent():" << errorString(err);
- }
- return ok;
-}
-
-bool QEglContext::doneCurrent()
-{
- // If the context is invalid, we assume that an error was reported
- // when makeCurrent() was called.
- if (ctx == EGL_NO_CONTEXT)
- return false;
-
- // We need to select the correct API before calling eglMakeCurrent()
- // with EGL_NO_CONTEXT because threads can have both OpenGL and OpenVG
- // contexts active at the same time.
-#ifdef EGL_OPENGL_ES_API
- if (apiType == OpenGL)
- eglBindAPI(EGL_OPENGL_ES_API);
-#endif
-#ifdef EGL_OPENVG_API
- if (apiType == OpenVG)
- eglBindAPI(EGL_OPENVG_API);
-#endif
-
- bool ok = eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- if (!ok) {
- EGLint err = eglGetError();
- qWarning() << "QEglContext::doneCurrent():" << errorString(err);
- }
- return ok;
-}
-
-bool QEglContext::swapBuffers()
-{
- if(ctx == EGL_NO_CONTEXT)
- return false;
-
- bool ok = eglSwapBuffers(dpy, surf);
- if (!ok) {
- EGLint err = eglGetError();
- qWarning() << "QEglContext::swapBuffers():" << errorString(err);
- }
- return ok;
-}
-
-// Wait for native rendering operations to complete before starting
-// to use OpenGL/OpenVG operations.
-void QEglContext::waitNative()
-{
-#ifdef EGL_CORE_NATIVE_ENGINE
- eglWaitNative(EGL_CORE_NATIVE_ENGINE);
-#endif
-}
-
-// Wait for client OpenGL/OpenVG operations to complete before
-// using native rendering operations.
-void QEglContext::waitClient()
-{
-#ifdef EGL_OPENGL_ES_API
- if (apiType == OpenGL) {
- eglBindAPI(EGL_OPENGL_ES_API);
- eglWaitClient();
- }
-#else
- if (apiType == OpenGL)
- eglWaitGL();
-#endif
-#ifdef EGL_OPENVG_API
- if (apiType == OpenVG) {
- eglBindAPI(EGL_OPENVG_API);
- eglWaitClient();
- }
-#endif
-}
-
-// Query the actual size of the EGL surface.
-QSize QEglContext::surfaceSize() const
-{
- int w, h;
- eglQuerySurface(dpy, surf, EGL_WIDTH, &w);
- eglQuerySurface(dpy, surf, EGL_HEIGHT, &h);
- return QSize(w, h);
-}
-
-// Query the value of a configuration attribute.
-bool QEglContext::configAttrib(int name, EGLint *value) const
-{
- return eglGetConfigAttrib(dpy, cfg, name, value);
-}
-
-// Retrieve all of the properties on "cfg". If zero, return
-// the context's configuration.
-QEglProperties QEglContext::configProperties(EGLConfig cfg) const
-{
- if (!cfg)
- cfg = config();
- QEglProperties props;
- for (int name = 0x3020; name <= 0x304F; ++name) {
- EGLint value;
- if (name != EGL_NONE && eglGetConfigAttrib(dpy, cfg, name, &value))
- props.setValue(name, value);
- }
- eglGetError(); // Clear the error state.
- return props;
-}
-
-// Initialize and return the default display.
-EGLDisplay QEglContext::defaultDisplay(QPaintDevice *device)
-{
- static EGLDisplay dpy = EGL_NO_DISPLAY;
- if (dpy == EGL_NO_DISPLAY) {
- dpy = getDisplay(device);
- if (dpy == EGL_NO_DISPLAY) {
- qWarning() << "QEglContext::defaultDisplay(): Cannot open EGL display";
- return EGL_NO_DISPLAY;
- }
- if (!eglInitialize(dpy, NULL, NULL)) {
- EGLint err = eglGetError();
- qWarning() << "QEglContext::defaultDisplay(): Cannot initialize EGL display:" << errorString(err);
- return EGL_NO_DISPLAY;
- }
-#ifdef EGL_OPENGL_ES_API
- eglBindAPI(EGL_OPENGL_ES_API);
-#endif
- }
- return dpy;
-}
-
-// Return the error string associated with a specific code.
-QString QEglContext::errorString(int code)
-{
- static const char * const errors[] = {
- "Success (0x3000)", // No tr
- "Not initialized (0x3001)", // No tr
- "Bad access (0x3002)", // No tr
- "Bad alloc (0x3003)", // No tr
- "Bad attribute (0x3004)", // No tr
- "Bad config (0x3005)", // No tr
- "Bad context (0x3006)", // No tr
- "Bad current surface (0x3007)", // No tr
- "Bad display (0x3008)", // No tr
- "Bad match (0x3009)", // No tr
- "Bad native pixmap (0x300A)", // No tr
- "Bad native window (0x300B)", // No tr
- "Bad parameter (0x300C)", // No tr
- "Bad surface (0x300D)", // No tr
- "Context lost (0x300E)" // No tr
- };
- if (code >= 0x3000 && code <= 0x300E) {
- return QString::fromLatin1(errors[code - 0x3000]);
- } else {
- return QLatin1String("0x") + QString::number(code, 16);
- }
-}
-
-// Dump all of the EGL configurations supported by the system.
-void QEglContext::dumpAllConfigs()
-{
- QEglProperties props;
- EGLint count = 0;
- if (!eglGetConfigs(dpy, 0, 0, &count))
- return;
- if (count < 1)
- return;
- EGLConfig *configs = new EGLConfig [count];
- eglGetConfigs(dpy, configs, count, &count);
- for (EGLint index = 0; index < count; ++index) {
- props = configProperties(configs[index]);
- qWarning() << props.toString();
- }
- delete [] configs;
-}
-
-// Initialize a property block.
-QEglProperties::QEglProperties()
-{
- props.append(EGL_NONE);
-}
-
-// Fetch the current value associated with a property.
-int QEglProperties::value(int name) const
-{
- for (int index = 0; index < (props.size() - 1); index += 2) {
- if (props[index] == name)
- return props[index + 1];
- }
-
- // If the attribute has not been explicitly set, return the EGL default
- // The following defaults were taken from the EGL 1.4 spec:
- switch(name) {
- case EGL_BUFFER_SIZE: return 0;
- case EGL_RED_SIZE: return 0;
- case EGL_GREEN_SIZE: return 0;
- case EGL_BLUE_SIZE: return 0;
- case EGL_ALPHA_SIZE: return 0;
-#if defined(EGL_LUMINANCE_SIZE)
- case EGL_LUMINANCE_SIZE: return 0;
-#endif
-#if defined(EGL_ALPHA_MASK_SIZE)
- case EGL_ALPHA_MASK_SIZE: return 0;
-#endif
- case EGL_BIND_TO_TEXTURE_RGB: return EGL_DONT_CARE;
- case EGL_BIND_TO_TEXTURE_RGBA: return EGL_DONT_CARE;
-#if defined(EGL_COLOR_BUFFER_TYPE)
- case EGL_COLOR_BUFFER_TYPE: return EGL_RGB_BUFFER;
-#endif
- case EGL_CONFIG_CAVEAT: return EGL_DONT_CARE;
- case EGL_CONFIG_ID: return EGL_DONT_CARE;
- case EGL_DEPTH_SIZE: return 0;
- case EGL_LEVEL: return 0;
- case EGL_NATIVE_RENDERABLE: return EGL_DONT_CARE;
- case EGL_NATIVE_VISUAL_TYPE: return EGL_DONT_CARE;
- case EGL_MAX_SWAP_INTERVAL: return EGL_DONT_CARE;
- case EGL_MIN_SWAP_INTERVAL: return EGL_DONT_CARE;
-#if defined(EGL_RENDERABLE_TYPE)
- case EGL_RENDERABLE_TYPE: return EGL_OPENGL_ES_BIT;
-#endif
- case EGL_SAMPLE_BUFFERS: return 0;
- case EGL_SAMPLES: return 0;
- case EGL_STENCIL_SIZE: return 0;
- case EGL_SURFACE_TYPE: return EGL_WINDOW_BIT;
- case EGL_TRANSPARENT_TYPE: return EGL_NONE;
- case EGL_TRANSPARENT_RED_VALUE: return EGL_DONT_CARE;
- case EGL_TRANSPARENT_GREEN_VALUE: return EGL_DONT_CARE;
- case EGL_TRANSPARENT_BLUE_VALUE: return EGL_DONT_CARE;
-
-#if defined(EGL_VERSION_1_3)
- case EGL_CONFORMANT: return 0;
- case EGL_MATCH_NATIVE_PIXMAP: return EGL_NONE;
-#endif
-
- case EGL_MAX_PBUFFER_HEIGHT:
- case EGL_MAX_PBUFFER_WIDTH:
- case EGL_MAX_PBUFFER_PIXELS:
- case EGL_NATIVE_VISUAL_ID:
- case EGL_NONE:
- qWarning("QEglProperties::value() - Attibute %d does not affect config selection", name);
- return EGL_DONT_CARE;
- default:
- qWarning("QEglProperties::value() - Attibute %d is unknown in EGL <=1.4", name);
- return EGL_DONT_CARE;
- }
-}
-
-// Set the value associated with a property, replacing an existing
-// value if there is one.
-void QEglProperties::setValue(int name, int value)
-{
- for (int index = 0; index < (props.size() - 1); index += 2) {
- if (props[index] == name) {
- props[index + 1] = value;
- return;
- }
- }
- props[props.size() - 1] = name;
- props.append(value);
- props.append(EGL_NONE);
-}
-
-// Remove a property value. Returns false if the property is not present.
-bool QEglProperties::removeValue(int name)
-{
- for (int index = 0; index < (props.size() - 1); index += 2) {
- if (props[index] == name) {
- while ((index + 2) < props.size()) {
- props[index] = props[index + 2];
- ++index;
- }
- props.resize(props.size() - 2);
- return true;
- }
- }
- return false;
-}
-
-// Sets the red, green, blue, and alpha sizes based on a pixel format.
-// Normally used to match a configuration request to the screen format.
-void QEglProperties::setPixelFormat(QImage::Format pixelFormat)
-{
- int red, green, blue, alpha;
- switch (pixelFormat) {
- case QImage::Format_RGB32:
- case QImage::Format_RGB888:
- red = green = blue = 8; alpha = 0; break;
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- red = green = blue = alpha = 8; break;
- case QImage::Format_RGB16:
- red = 5; green = 6; blue = 5; alpha = 0; break;
- case QImage::Format_ARGB8565_Premultiplied:
- red = 5; green = 6; blue = 5; alpha = 8; break;
- case QImage::Format_RGB666:
- red = green = blue = 6; alpha = 0; break;
- case QImage::Format_ARGB6666_Premultiplied:
- red = green = blue = alpha = 6; break;
- case QImage::Format_RGB555:
- red = green = blue = 5; alpha = 0; break;
- case QImage::Format_ARGB8555_Premultiplied:
- red = green = blue = 5; alpha = 8; break;
- case QImage::Format_RGB444:
- red = green = blue = 4; alpha = 0; break;
- case QImage::Format_ARGB4444_Premultiplied:
- red = green = blue = alpha = 4; break;
- default:
- qWarning() << "QEglProperties::setPixelFormat(): Unsupported pixel format";
- red = green = blue = alpha = 1; break;
- }
- setValue(EGL_RED_SIZE, red);
- setValue(EGL_GREEN_SIZE, green);
- setValue(EGL_BLUE_SIZE, blue);
- setValue(EGL_ALPHA_SIZE, alpha);
-}
-
-void QEglProperties::setRenderableType(int api)
-{
-#if defined(EGL_RENDERABLE_TYPE)
-#if defined(QT_OPENGL_ES_2)
- if (api == QEglContext::OpenGL)
- setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT);
-#elif defined(QT_OPENGL_ES)
- if (api == QEglContext::OpenGL)
- setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
-#endif
-#if defined(EGL_OPENVG_BIT)
- if (api == QEglContext::OpenVG)
- setValue(EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT);
-#endif
-#else
- Q_UNUSED(api);
-#endif
-}
-
-// Reduce the complexity of a configuration request to ask for less
-// because the previous request did not result in success. Returns
-// true if the complexity was reduced, or false if no further
-// reductions in complexity are possible.
-bool QEglProperties::reduceConfiguration()
-{
- if (removeValue(EGL_SAMPLE_BUFFERS)) {
- removeValue(EGL_SAMPLES);
- return true;
- }
- if (removeValue(EGL_ALPHA_SIZE))
- return true;
- if (removeValue(EGL_STENCIL_SIZE))
- return true;
- if (removeValue(EGL_DEPTH_SIZE))
- return true;
- return false;
-}
-
-static void addTag(QString& str, const QString& tag)
-{
- int lastnl = str.lastIndexOf(QLatin1String("\n"));
- if (lastnl == -1)
- lastnl = 0;
- if ((str.length() - lastnl) >= 50)
- str += QLatin1String("\n ");
- str += tag;
-}
-
-// Convert a property list to a string suitable for debug output.
-QString QEglProperties::toString() const
-{
- QString str;
- int val;
-
- val = value(EGL_CONFIG_ID);
- if (val != EGL_DONT_CARE) {
- str += QLatin1String("id=");
- str += QString::number(val);
- str += QLatin1Char(' ');
- }
-
-#ifdef EGL_RENDERABLE_TYPE
- val = value(EGL_RENDERABLE_TYPE);
- if (val != EGL_DONT_CARE) {
- str += QLatin1String("type=");
- QStringList types;
- if ((val & EGL_OPENGL_ES_BIT) != 0)
- types += QLatin1String("es1");
-#ifdef EGL_OPENGL_ES2_BIT
- if ((val & EGL_OPENGL_ES2_BIT) != 0)
- types += QLatin1String("es2");
-#endif
- if ((val & EGL_OPENVG_BIT) != 0)
- types += QLatin1String("vg");
- if ((val & ~7) != 0)
- types += QString::number(val);
- str += types.join(QLatin1String(","));
- } else {
- str += QLatin1String("type=any");
- }
-#else
- str += QLatin1String("type=es1");
-#endif
-
- int red = value(EGL_RED_SIZE);
- int green = value(EGL_GREEN_SIZE);
- int blue = value(EGL_BLUE_SIZE);
- int alpha = value(EGL_ALPHA_SIZE);
- int bufferSize = value(EGL_BUFFER_SIZE);
- if (bufferSize == (red + green + blue + alpha))
- bufferSize = EGL_DONT_CARE;
- str += QLatin1String(" rgba=");
- str += QString::number(red);
- str += QLatin1Char(',');
- str += QString::number(green);
- str += QLatin1Char(',');
- str += QString::number(blue);
- str += QLatin1Char(',');
- str += QString::number(alpha);
- if (bufferSize != EGL_DONT_CARE) {
- // Only report buffer size if different than r+g+b+a.
- str += QLatin1String(" buffer-size=");
- str += QString::number(bufferSize);
- }
-
-#ifdef EGL_COLOR_BUFFER_TYPE
- val = value(EGL_COLOR_BUFFER_TYPE);
- if (val == EGL_LUMINANCE_BUFFER) {
- addTag(str, QLatin1String(" color-buffer-type=luminance"));
- } else if (val != EGL_DONT_CARE && val != EGL_RGB_BUFFER) {
- addTag(str, QLatin1String(" color-buffer-type="));
- str += QString::number(val, 16);
- }
-#endif
-
- val = value(EGL_DEPTH_SIZE);
- if (val != 0) {
- addTag(str, QLatin1String(" depth="));
- str += QString::number(val);
- }
-
- val = value(EGL_STENCIL_SIZE);
- if (val != 0) {
- addTag(str, QLatin1String(" stencil="));
- str += QString::number(val);
- }
-
- val = value(EGL_SURFACE_TYPE);
- if (val != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" surface-type="));
- QStringList types;
- if ((val & EGL_WINDOW_BIT) != 0)
- types += QLatin1String("window");
- if ((val & EGL_PIXMAP_BIT) != 0)
- types += QLatin1String("pixmap");
- if ((val & EGL_PBUFFER_BIT) != 0)
- types += QLatin1String("pbuffer");
-#ifdef EGL_VG_COLORSPACE_LINEAR_BIT
- if ((val & EGL_VG_COLORSPACE_LINEAR_BIT) != 0)
- types += QLatin1String("vg-colorspace-linear");
-#endif
-#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
- if ((val & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
- types += QLatin1String("vg-alpha-format-pre");
-#endif
- if ((val & ~(EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT
-#ifdef EGL_VG_COLORSPACE_LINEAR_BIT
- | EGL_VG_COLORSPACE_LINEAR_BIT
-#endif
-#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
- | EGL_VG_ALPHA_FORMAT_PRE_BIT
-#endif
- )) != 0) {
- types += QString::number(val);
- }
- str += types.join(QLatin1String(","));
- }
-
- val = value(EGL_CONFIG_CAVEAT);
- if (val != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" caveat="));
- if (val == EGL_NONE)
- str += QLatin1String("none");
- else if (val == EGL_SLOW_CONFIG)
- str += QLatin1String("slow");
- else if (val == EGL_NON_CONFORMANT_CONFIG)
- str += QLatin1String("non-conformant");
- else
- str += QString::number(val, 16);
- }
-
- val = value(EGL_LEVEL);
- if (val != 0) {
- addTag(str, QLatin1String(" level="));
- str += QString::number(val);
- }
-
- int width, height, pixels;
- width = value(EGL_MAX_PBUFFER_WIDTH);
- height = value(EGL_MAX_PBUFFER_HEIGHT);
- pixels = value(EGL_MAX_PBUFFER_PIXELS);
- if (height != EGL_DONT_CARE || width != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" max-pbuffer-size="));
- str += QString::number(width);
- str += QLatin1Char('x');
- str += QString::number(height);
- if (pixels != (width * height)) {
- addTag(str, QLatin1String(" max-pbuffer-pixels="));
- str += QString::number(pixels);
- }
- }
-
- val = value(EGL_NATIVE_RENDERABLE);
- if (val != EGL_DONT_CARE) {
- if (val)
- addTag(str, QLatin1String(" native-renderable=true"));
- else
- addTag(str, QLatin1String(" native-renderable=false"));
- }
-
- val = value(EGL_NATIVE_VISUAL_ID);
- if (val != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" visual-id="));
- str += QString::number(val);
- }
-
- val = value(EGL_NATIVE_VISUAL_TYPE);
- if (val != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" visual-type="));
- str += QString::number(val);
- }
-
-#ifdef EGL_PRESERVED_RESOURCES
- val = value(EGL_PRESERVED_RESOURCES);
- if (val != EGL_DONT_CARE) {
- if (val)
- addTag(str, QLatin1String(" preserved-resources=true"));
- else
- addTag(str, QLatin1String(" preserved-resources=false"));
- }
-#endif
-
- val = value(EGL_SAMPLES);
- if (val != 0) {
- addTag(str, QLatin1String(" samples="));
- str += QString::number(val);
- }
-
- val = value(EGL_SAMPLE_BUFFERS);
- if (val != 0) {
- addTag(str, QLatin1String(" sample-buffers="));
- str += QString::number(val);
- }
-
- val = value(EGL_TRANSPARENT_TYPE);
- if (val == EGL_TRANSPARENT_RGB) {
- addTag(str, QLatin1String(" transparent-rgb="));
- str += QString::number(value(EGL_TRANSPARENT_RED_VALUE));
- str += QLatin1Char(',');
- str += QString::number(value(EGL_TRANSPARENT_GREEN_VALUE));
- str += QLatin1Char(',');
- str += QString::number(value(EGL_TRANSPARENT_BLUE_VALUE));
- }
-
-#if defined(EGL_BIND_TO_TEXTURE_RGB) && defined(EGL_BIND_TO_TEXTURE_RGBA)
- val = value(EGL_BIND_TO_TEXTURE_RGB);
- int val2 = value(EGL_BIND_TO_TEXTURE_RGBA);
- if (val != EGL_DONT_CARE || val2 != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" bind-texture="));
- if (val == EGL_TRUE)
- str += QLatin1String("rgb");
- else
- str += QLatin1String("no-rgb");
- if (val2 == EGL_TRUE)
- str += QLatin1String(",rgba");
- else
- str += QLatin1String(",no-rgba");
- }
-#endif
-
-#ifdef EGL_MIN_SWAP_INTERVAL
- val = value(EGL_MIN_SWAP_INTERVAL);
- if (val != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" min-swap-interval="));
- str += QString::number(val);
- }
-#endif
-
-#ifdef EGL_MIN_SWAP_INTERVAL
- val = value(EGL_MAX_SWAP_INTERVAL);
- if (val != EGL_DONT_CARE) {
- addTag(str, QLatin1String(" max-swap-interval="));
- str += QString::number(val);
- }
-#endif
-
-#ifdef EGL_LUMINANCE_SIZE
- val = value(EGL_LUMINANCE_SIZE);
- if (val != 0) {
- addTag(str, QLatin1String(" luminance="));
- str += QString::number(val);
- }
-#endif
-
-#ifdef EGL_ALPHA_MASK_SIZE
- val = value(EGL_ALPHA_MASK_SIZE);
- if (val != 0) {
- addTag(str, QLatin1String(" alpha-mask="));
- str += QString::number(val);
- }
-#endif
-
-#ifdef EGL_CONFORMANT
- val = value(EGL_CONFORMANT);
- if (val != 0) {
- if (val)
- addTag(str, QLatin1String(" conformant=true"));
- else
- addTag(str, QLatin1String(" conformant=false"));
- }
-#endif
-
- return str;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_OPENGL_ES || QT_OPENVG
diff --git a/src/opengl/qegl_p.h b/src/opengl/qegl_p.h
deleted file mode 100644
index 76cb573..0000000
--- a/src/opengl/qegl_p.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEGL_P_H
-#define QEGL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QGLWidget class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtCore/qvarlengtharray.h"
-#include "QtCore/qsize.h"
-#include "QtGui/qimage.h"
-
-#if defined(QT_OPENGL_ES) || defined(QT_OPENVG)
-
-QT_BEGIN_INCLUDE_NAMESPACE
-#if defined(QT_OPENGL_ES_2) || defined(QT_OPENVG)
-#include <EGL/egl.h>
-#else
-#include <GLES/egl.h>
-#endif
-#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED)
-#undef EGLNativeWindowType
-#undef EGLNativePixmapType
-#undef EGLNativeDisplayType
-typedef NativeWindowType EGLNativeWindowType;
-typedef NativePixmapType EGLNativePixmapType;
-typedef NativeDisplayType EGLNativeDisplayType;
-#define QEGL_NATIVE_TYPES_DEFINED 1
-#endif
-QT_END_INCLUDE_NAMESPACE
-
-class QX11Info;
-class QPaintDevice;
-class QImage;
-class QPixmap;
-class QWidget;
-
-QT_BEGIN_NAMESPACE
-
-class Q_OPENGL_EXPORT QEglProperties
-{
-public:
- QEglProperties();
- QEglProperties(const QEglProperties& other) : props(other.props) {}
- ~QEglProperties() {}
-
- int value(int name) const;
- void setValue(int name, int value);
- bool removeValue(int name);
-
- const int *properties() const { return props.constData(); }
-
- void setPixelFormat(QImage::Format pixelFormat);
-#ifdef Q_WS_X11
- void setVisualFormat(const QX11Info *xinfo);
-#endif
- void setRenderableType(int api);
-
- bool reduceConfiguration();
-
- QString toString() const;
-
-private:
- QVarLengthArray<int> props;
-};
-
-class Q_OPENGL_EXPORT QEglContext
-{
-public:
- QEglContext();
- ~QEglContext();
-
- enum API
- {
- OpenGL,
- OpenVG
- };
-
- enum PixelFormatMatch
- {
- ExactPixelFormat,
- BestPixelFormat
- };
-
- bool isValid() const;
- bool isSharing() const;
-
- void setApi(QEglContext::API api) { apiType = api; }
- bool openDisplay(QPaintDevice *device);
- bool chooseConfig(const QEglProperties& properties, PixelFormatMatch match = ExactPixelFormat);
- bool createContext(QEglContext *shareContext = 0);
- bool createSurface(QPaintDevice *device);
- bool recreateSurface(QPaintDevice *device);
- void setSurface(EGLSurface surface) { surf = surface; }
-
- void destroy();
-
- bool makeCurrent();
- bool doneCurrent();
- bool swapBuffers();
-
- void waitNative();
- void waitClient();
-
- QSize surfaceSize() const;
-
- bool configAttrib(int name, EGLint *value) const;
-
- void clearError() const { eglGetError(); }
-
- QEglContext::API api() const { return apiType; }
-
- EGLDisplay display() const { return dpy; }
- EGLContext context() const { return ctx; }
- EGLSurface surface() const { return surf; }
- EGLConfig config() const { return cfg; }
-
- QEglProperties configProperties(EGLConfig cfg = 0) const;
-
- static EGLDisplay defaultDisplay(QPaintDevice *device);
- static QString errorString(int code);
-
- void dumpAllConfigs();
-
-private:
- QEglContext::API apiType;
- EGLDisplay dpy;
- EGLContext ctx;
- EGLSurface surf;
- EGLConfig cfg;
- bool share;
- void *reserved; // For extension data in future versions.
-
- static EGLDisplay getDisplay(QPaintDevice *device);
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_OPENGL_ES || QT_OPENVG
-
-#endif // QEGL_P_H
diff --git a/src/opengl/qegl_qws.cpp b/src/opengl/qegl_qws.cpp
deleted file mode 100644
index 9135c53..0000000
--- a/src/opengl/qegl_qws.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qwidget.h>
-#include "qegl_p.h"
-
-#if defined(QT_OPENGL_ES) || defined(QT_OPENVG)
-
-#include <qglscreen_qws.h>
-#include <qscreenproxy_qws.h>
-#include <private/qglwindowsurface_qws_p.h>
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-
-QT_BEGIN_NAMESPACE
-
-static QGLScreen *glScreenForDevice(QPaintDevice *device)
-{
- QScreen *screen = qt_screen;
- if (screen->classId() == QScreen::MultiClass) {
- int screenNumber;
- if (device && device->devType() == QInternal::Widget)
- screenNumber = qApp->desktop()->screenNumber(static_cast<QWidget *>(device));
- else
- screenNumber = 0;
- screen = screen->subScreens()[screenNumber];
- }
- while (screen->classId() == QScreen::ProxyClass) {
- screen = static_cast<QProxyScreen *>(screen)->screen();
- }
- if (screen->classId() == QScreen::GLClass)
- return static_cast<QGLScreen *>(screen);
- else
- return 0;
-}
-
-// Create the surface for a QPixmap, QImage, or QWidget.
-bool QEglContext::createSurface(QPaintDevice *device)
-{
- // Get the screen surface functions, which are used to create native ids.
- QGLScreen *glScreen = glScreenForDevice(device);
- if (!glScreen)
- return false;
- QGLScreenSurfaceFunctions *funcs = glScreen->surfaceFunctions();
- if (!funcs)
- return false;
-
- // Create the native drawable for the paint device.
- int devType = device->devType();
- EGLNativePixmapType pixmapDrawable = 0;
- EGLNativeWindowType windowDrawable = 0;
- bool ok;
- if (devType == QInternal::Pixmap) {
- ok = funcs->createNativePixmap(static_cast<QPixmap *>(device), &pixmapDrawable);
- } else if (devType == QInternal::Image) {
- ok = funcs->createNativeImage(static_cast<QImage *>(device), &pixmapDrawable);
- } else {
- ok = funcs->createNativeWindow(static_cast<QWidget *>(device), &windowDrawable);
- }
- if (!ok) {
- qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable");
- return false;
- }
-
- // Create the EGL surface to draw into, based on the native drawable.
- if (devType == QInternal::Widget)
- surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, 0);
- else
- surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, 0);
- if (surf == EGL_NO_SURFACE) {
- qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
- return false;
- }
- return true;
-}
-
-EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
-{
- Q_UNUSED(device);
- return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY));
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_OPENGL_ES || QT_OPENVG
diff --git a/src/opengl/qegl_wince.cpp b/src/opengl/qegl_wince.cpp
deleted file mode 100644
index dbec385..0000000
--- a/src/opengl/qegl_wince.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qwidget.h>
-#include "qegl_p.h"
-
-#if defined(QT_OPENGL_ES) || defined(QT_OPENVG)
-
-#include <windows.h>
-
-
-QT_BEGIN_NAMESPACE
-
-bool QEglContext::createSurface(QPaintDevice *device)
-{
- // Create the native drawable for the paint device.
- int devType = device->devType();
- EGLNativePixmapType pixmapDrawable = 0;
- EGLNativeWindowType windowDrawable = 0;
- bool ok;
- if (devType == QInternal::Pixmap) {
- pixmapDrawable = 0;
- ok = (pixmapDrawable != 0);
- } else if (devType == QInternal::Widget) {
- windowDrawable = (EGLNativeWindowType)(static_cast<QWidget *>(device))->winId();
- ok = (windowDrawable != 0);
- } else {
- ok = false;
- }
- if (!ok) {
- qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable");
- return false;
- }
-
- // Create the EGL surface to draw into, based on the native drawable.
- if (devType == QInternal::Widget)
- surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, 0);
- else
- surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, 0);
- if (surf == EGL_NO_SURFACE) {
- qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
- return false;
- }
- return true;
-}
-
-EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
-{
- EGLDisplay dpy = 0;
- HWND win = ((QWidget*)device)->winId();
- HDC myDc = GetDC(win);
- if (!myDc) {
- qWarning("QEglContext::defaultDisplay(): WinCE display is not open");
- }
- dpy = eglGetDisplay(EGLNativeDisplayType(myDc));
- if (dpy == EGL_NO_DISPLAY) {
- qWarning("QEglContext::defaultDisplay(): Falling back to EGL_DEFAULT_DISPLAY");
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- }
- return dpy;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_OPENGL_ES || QT_OPENVG
diff --git a/src/opengl/qegl_x11egl.cpp b/src/opengl/qegl_x11egl.cpp
deleted file mode 100644
index c703900..0000000
--- a/src/opengl/qegl_x11egl.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qwidget.h>
-#include <QtCore/qdebug.h>
-#include "qegl_p.h"
-
-#if defined(QT_OPENGL_ES) || defined(QT_OPENVG)
-
-#if defined(Q_WS_X11)
-#include <QtGui/qx11info_x11.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-bool QEglContext::createSurface(QPaintDevice *device)
-{
- // Create the native drawable for the paint device.
- int devType = device->devType();
- EGLNativePixmapType pixmapDrawable = 0;
- EGLNativeWindowType windowDrawable = 0;
- bool ok;
- if (devType == QInternal::Pixmap) {
- pixmapDrawable = (EGLNativePixmapType)(static_cast<QPixmap *>(device))->handle();
- ok = (pixmapDrawable != 0);
- } else if (devType == QInternal::Widget) {
- windowDrawable = (EGLNativeWindowType)(static_cast<QWidget *>(device))->winId();
- ok = (windowDrawable != 0);
- } else {
- ok = false;
- }
- if (!ok) {
- qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable");
- return false;
- }
-
- // Create the EGL surface to draw into, based on the native drawable.
- if (devType == QInternal::Widget)
- surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, 0);
- else
- surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, 0);
-
- if (surf == EGL_NO_SURFACE) {
- qWarning() << "QEglContext::createSurface(): Unable to create EGL surface:"
- << errorString(eglGetError());
- return false;
- }
- return true;
-}
-
-EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
-{
- Q_UNUSED(device);
- Display *xdpy = QX11Info::display();
- if (!xdpy) {
- qWarning("QEglContext::getDisplay(): X11 display is not open");
- return EGL_NO_DISPLAY;
- }
- return eglGetDisplay(EGLNativeDisplayType(xdpy));
-}
-
-static int countBits(unsigned long mask)
-{
- int count = 0;
- while (mask != 0) {
- if (mask & 1)
- ++count;
- mask >>= 1;
- }
- return count;
-}
-
-// Set the pixel format parameters from the visual in "xinfo".
-void QEglProperties::setVisualFormat(const QX11Info *xinfo)
-{
- if (!xinfo)
- return;
- Visual *visual = (Visual*)xinfo->visual();
- if (!visual)
- return;
- if (visual->c_class != TrueColor && visual->c_class != DirectColor)
- return;
- setValue(EGL_RED_SIZE, countBits(visual->red_mask));
- setValue(EGL_GREEN_SIZE, countBits(visual->green_mask));
- setValue(EGL_BLUE_SIZE, countBits(visual->blue_mask));
- setValue(EGL_ALPHA_SIZE, 0); // XXX
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_OPENGL_ES || QT_OPENVG
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index c0c7781..2e99fc7 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 2d987fe..24a4bbb 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgl_cl_p.h b/src/opengl/qgl_cl_p.h
index c05a7d7..9ead8bb 100644
--- a/src/opengl/qgl_cl_p.h
+++ b/src/opengl/qgl_cl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 287c537..e447770 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgl_egl_p.h b/src/opengl/qgl_egl_p.h
index 39f25e2..d54036d 100644
--- a/src/opengl/qgl_egl_p.h
+++ b/src/opengl/qgl_egl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,7 @@
// We mean it.
//
-#include "qegl_p.h"
+#include <QtGui/private/qegl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm
index 1319396..7930d8e 100644
--- a/src/opengl/qgl_mac.mm
+++ b/src/opengl/qgl_mac.mm
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 4af8598..85e9bd7 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index cb9aa89..a71a734 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -116,6 +116,57 @@ void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device)
props.setPixelFormat(glScreen->pixelFormat());
}
+static bool qt_egl_create_surface
+ (QEglContext *context, QPaintDevice *device,
+ const QEglProperties *properties = 0)
+{
+ // Get the screen surface functions, which are used to create native ids.
+ QGLScreen *glScreen = glScreenForDevice(device);
+ if (!glScreen)
+ return false;
+ QGLScreenSurfaceFunctions *funcs = glScreen->surfaceFunctions();
+ if (!funcs)
+ return false;
+
+ // Create the native drawable for the paint device.
+ int devType = device->devType();
+ EGLNativePixmapType pixmapDrawable = 0;
+ EGLNativeWindowType windowDrawable = 0;
+ bool ok;
+ if (devType == QInternal::Pixmap) {
+ ok = funcs->createNativePixmap(static_cast<QPixmap *>(device), &pixmapDrawable);
+ } else if (devType == QInternal::Image) {
+ ok = funcs->createNativeImage(static_cast<QImage *>(device), &pixmapDrawable);
+ } else {
+ ok = funcs->createNativeWindow(static_cast<QWidget *>(device), &windowDrawable);
+ }
+ if (!ok) {
+ qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable");
+ return false;
+ }
+
+ // Create the EGL surface to draw into, based on the native drawable.
+ const int *props;
+ if (properties)
+ props = properties->properties();
+ else
+ props = 0;
+ EGLSurface surf;
+ if (devType == QInternal::Widget) {
+ surf = eglCreateWindowSurface
+ (context->display(), context->config(), windowDrawable, props);
+ } else {
+ surf = eglCreatePixmapSurface
+ (context->display(), context->config(), pixmapDrawable, props);
+ }
+ if (surf == EGL_NO_SURFACE) {
+ qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
+ return false;
+ }
+ context->setSurface(surf);
+ return true;
+}
+
bool QGLContext::chooseContext(const QGLContext* shareContext)
{
Q_D(QGLContext);
@@ -131,7 +182,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Get the display and initialize it.
d->eglContext = new QEglContext();
- d->eglContext->setApi(QEglContext::OpenGL);
+ d->eglContext->setApi(QEgl::OpenGL);
if (!d->eglContext->openDisplay(device())) {
delete d->eglContext;
d->eglContext = 0;
@@ -142,7 +193,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
QEglProperties configProps;
qt_egl_add_platform_config(configProps, device());
qt_egl_set_format(configProps, devType, d->glFormat);
- configProps.setRenderableType(QEglContext::OpenGL);
+ configProps.setRenderableType(QEgl::OpenGL);
// Search for a matching configuration, reducing the complexity
// each time until we get something that matches.
@@ -168,8 +219,10 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval());
#endif
- // Create the EGL surface to draw into.
- if (!d->eglContext->createSurface(device())) {
+ // Create the EGL surface to draw into. We cannot use
+ // QEglContext::createSurface() because it does not have
+ // access to the QGLScreen.
+ if (!qt_egl_create_surface(d->eglContext, device())) {
delete d->eglContext;
d->eglContext = 0;
return false;
diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp
index 217b0fc..40b0ce7 100644
--- a/src/opengl/qgl_win.cpp
+++ b/src/opengl/qgl_win.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp
index 7429071..afe26ab 100644
--- a/src/opengl/qgl_wince.cpp
+++ b/src/opengl/qgl_wince.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -140,7 +140,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Get the display and initialize it.
d->eglContext = new QEglContext();
- d->eglContext->setApi(QEglContext::OpenGL);
+ d->eglContext->setApi(QEgl::OpenGL);
if (!d->eglContext->openDisplay(device())) {
delete d->eglContext;
d->eglContext = 0;
@@ -151,7 +151,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
QEglProperties configProps;
qt_egl_add_platform_config(configProps, device());
qt_egl_set_format(configProps, devType, d->glFormat);
- configProps.setRenderableType(QEglContext::OpenGL);
+ configProps.setRenderableType(QEgl::OpenGL);
// Search for a matching configuration, reducing the complexity
// each time until we get something that matches.
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index da61634..631625b 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -522,7 +522,11 @@ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
const QX11Info *xinfo = qt_x11Info(d->paintDevice);
bool useFBConfig = false;
-#if defined(GLX_VERSION_1_3) && !defined(QT_NO_XRENDER)
+#if defined(GLX_VERSION_1_3) && !defined(QT_NO_XRENDER) && !defined(Q_OS_HPUX)
+ /*
+ HPUX defines GLX_VERSION_1_3 but does not implement the corresponding functions.
+ Specifically glXChooseFBConfig and glXGetVisualFromFBConfig are not implemented.
+ */
QWidget* widget = 0;
if (d->paintDevice->devType() == QInternal::Widget)
widget = static_cast<QWidget*>(d->paintDevice);
@@ -565,7 +569,7 @@ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
}
#endif
-#if defined(GLX_VERSION_1_3)
+#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX)
// GLX_RENDER_TYPE is only in glx >=1.3
if (useFBConfig) {
spec[i++] = GLX_RENDER_TYPE;
@@ -627,7 +631,7 @@ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
spec[i++] = f.samples() == -1 ? 4 : f.samples();
}
-#if defined(GLX_VERSION_1_3)
+#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX)
if (useFBConfig) {
spec[i++] = GLX_DRAWABLE_TYPE;
switch(d->paintDevice->devType()) {
@@ -652,7 +656,7 @@ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
XVisualInfo* chosenVisualInfo = 0;
-#if defined(GLX_VERSION_1_3)
+#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX)
while (useFBConfig) {
GLXFBConfig *configs;
int configCount = 0;
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 3c745b8..9db3a30 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -77,7 +77,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Get the display and initialize it.
d->eglContext = new QEglContext();
- d->eglContext->setApi(QEglContext::OpenGL);
+ d->eglContext->setApi(QEgl::OpenGL);
if (!d->eglContext->openDisplay(device())) {
delete d->eglContext;
d->eglContext = 0;
@@ -88,11 +88,11 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
QEglProperties configProps;
qt_egl_set_format(configProps, devType, d->glFormat);
qt_egl_add_platform_config(configProps, device());
- configProps.setRenderableType(QEglContext::OpenGL);
+ configProps.setRenderableType(QEgl::OpenGL);
// Search for a matching configuration, reducing the complexity
// each time until we get something that matches.
- if (!d->eglContext->chooseConfig(configProps, QEglContext::BestPixelFormat)) {
+ if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) {
delete d->eglContext;
d->eglContext = 0;
return false;
diff --git a/src/opengl/qglcolormap.cpp b/src/opengl/qglcolormap.cpp
index 02a2c13..426e090 100644
--- a/src/opengl/qglcolormap.cpp
+++ b/src/opengl/qglcolormap.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglcolormap.h b/src/opengl/qglcolormap.h
index 6bdb0c4..04e50be 100644
--- a/src/opengl/qglcolormap.h
+++ b/src/opengl/qglcolormap.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index 10ca613..2dc4663 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index d6edfb6..3bb42c8 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 159a00a..e033076 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -934,8 +934,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const
*/
bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
{
- if (!QGLContext::currentContext())
- QGLWidget dmy; // needed to detect and init the QGLExtensions object
+ QGLExtensions::init();
return (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
}
@@ -1097,8 +1096,7 @@ bool QGLFramebufferObject::isBound() const
*/
bool QGLFramebufferObject::hasOpenGLFramebufferBlit()
{
- if (!QGLContext::currentContext())
- QGLWidget dmy; // needed to detect and init the QGLExtensions object
+ QGLExtensions::init();
return (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit);
}
diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h
index 935f4ee..108bbb4 100644
--- a/src/opengl/qglframebufferobject.h
+++ b/src/opengl/qglframebufferobject.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp
index 60a1238..60816de 100644
--- a/src/opengl/qglpaintdevice_qws.cpp
+++ b/src/opengl/qglpaintdevice_qws.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpaintdevice_qws_p.h b/src/opengl/qglpaintdevice_qws_p.h
index a471b1b..ec7d6c8 100644
--- a/src/opengl/qglpaintdevice_qws_p.h
+++ b/src/opengl/qglpaintdevice_qws_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index dbd76a2..2669cb3 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h
index 8264c22..06894c0 100644
--- a/src/opengl/qglpixelbuffer.h
+++ b/src/opengl/qglpixelbuffer.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index 5390fd1..38e4f74 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,7 +63,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
{
// Create the EGL context.
ctx = new QEglContext();
- ctx->setApi(QEglContext::OpenGL);
+ ctx->setApi(QEgl::OpenGL);
// Open the EGL display.
if (!ctx->openDisplay(0)) {
@@ -82,13 +82,13 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
#if QGL_RENDER_TEXTURE
textureFormat = EGL_TEXTURE_RGBA;
configProps.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE);
- ok = ctx->chooseConfig(configProps, QEglContext::BestPixelFormat);
+ ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat);
if (!ok) {
// Try again with RGB texture rendering.
textureFormat = EGL_TEXTURE_RGB;
configProps.removeValue(EGL_BIND_TO_TEXTURE_RGBA);
configProps.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE);
- ok = ctx->chooseConfig(configProps, QEglContext::BestPixelFormat);
+ ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat);
if (!ok) {
// One last try for a pbuffer with no texture rendering.
configProps.removeValue(EGL_BIND_TO_TEXTURE_RGB);
@@ -99,7 +99,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
textureFormat = EGL_NONE;
#endif
if (!ok) {
- if (!ctx->chooseConfig(configProps, QEglContext::BestPixelFormat)) {
+ if (!ctx->chooseConfig(configProps, QEgl::BestPixelFormat)) {
delete ctx;
ctx = 0;
return false;
@@ -208,7 +208,7 @@ bool QGLPixelBuffer::hasOpenGLPbuffers()
return false;
QEglProperties configProps;
qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat());
- configProps.setRenderableType(QEglContext::OpenGL);
+ configProps.setRenderableType(QEgl::OpenGL);
return ctx.chooseConfig(configProps);
}
diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm
index e95e36b..b358be0 100644
--- a/src/opengl/qglpixelbuffer_mac.mm
+++ b/src/opengl/qglpixelbuffer_mac.mm
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h
index abdf838..4361fd2 100644
--- a/src/opengl/qglpixelbuffer_p.h
+++ b/src/opengl/qglpixelbuffer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp
index e3228cc..a6f849d 100644
--- a/src/opengl/qglpixelbuffer_win.cpp
+++ b/src/opengl/qglpixelbuffer_win.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixelbuffer_x11.cpp b/src/opengl/qglpixelbuffer_x11.cpp
index 0804503..9e1f85d 100644
--- a/src/opengl/qglpixelbuffer_x11.cpp
+++ b/src/opengl/qglpixelbuffer_x11.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 275bbed..7514743 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglpixmapfilter_p.h b/src/opengl/qglpixmapfilter_p.h
index d6742fc..6bdda50 100644
--- a/src/opengl/qglpixmapfilter_p.h
+++ b/src/opengl/qglpixmapfilter_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglscreen_qws.cpp b/src/opengl/qglscreen_qws.cpp
index a488b97..fd401b6 100644
--- a/src/opengl/qglscreen_qws.cpp
+++ b/src/opengl/qglscreen_qws.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglscreen_qws.h b/src/opengl/qglscreen_qws.h
index d045bea..8f2ccb7 100644
--- a/src/opengl/qglscreen_qws.h
+++ b/src/opengl/qglscreen_qws.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 37732dd..7d5af0d 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index 06bff42..9a789df 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglwindowsurface_qws.cpp b/src/opengl/qglwindowsurface_qws.cpp
index 40e549b..ff6caf3 100644
--- a/src/opengl/qglwindowsurface_qws.cpp
+++ b/src/opengl/qglwindowsurface_qws.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qglwindowsurface_qws_p.h b/src/opengl/qglwindowsurface_qws_p.h
index 740f879..1def568 100644
--- a/src/opengl/qglwindowsurface_qws_p.h
+++ b/src/opengl/qglwindowsurface_qws_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qgraphicssystem_gl.cpp b/src/opengl/qgraphicssystem_gl.cpp
index ce8ad7a..7a97a57 100644
--- a/src/opengl/qgraphicssystem_gl.cpp
+++ b/src/opengl/qgraphicssystem_gl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,6 +44,7 @@
#include "private/qpixmap_raster_p.h"
#include "private/qpixmapdata_gl_p.h"
#include "private/qwindowsurface_gl_p.h"
+#include "private/qgl_p.h"
#include <private/qwindowsurface_raster_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/opengl/qgraphicssystem_gl_p.h b/src/opengl/qgraphicssystem_gl_p.h
index 9e36cdf..9a3e33e 100644
--- a/src/opengl/qgraphicssystem_gl_p.h
+++ b/src/opengl/qgraphicssystem_gl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 5690c6b..cd04379 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -662,6 +662,7 @@ public:
, txop(QTransform::TxNone)
, inverseScale(1)
, moveToCount(0)
+ , last_created_state(0)
, shader_ctx(0)
, grad_palette(0)
, drawable_texture(0)
@@ -767,7 +768,7 @@ public:
bool isFastRect(const QRectF &r);
void drawImageAsPath(const QRectF &r, const QImage &img, const QRectF &sr);
- void drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy);
+ void drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy, const QPointF &offset);
void drawOffscreenPath(const QPainterPath &path);
@@ -788,6 +789,8 @@ public:
void updateGLMatrix() const;
+ mutable QPainterState *last_created_state;
+
QGLContext *shader_ctx;
GLuint grad_palette;
@@ -2219,6 +2222,8 @@ void QOpenGLPaintEnginePrivate::updateDepthClip()
{
Q_Q(QOpenGLPaintEngine);
+ ++q->state()->depthClipId;
+
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
@@ -3685,10 +3690,10 @@ void QOpenGLPaintEngine::drawLines(const QLineF *lines, int lineCount)
bool useRects = false;
// scale or 90 degree rotation?
if (d->matrix.type() <= QTransform::TxTranslate
- || !d->cpen.isCosmetic()
- && (d->matrix.type() <= QTransform::TxScale
- || (d->matrix.type() == QTransform::TxRotate
- && d->matrix.m11() == 0 && d->matrix.m22() == 0))) {
+ || (!d->cpen.isCosmetic()
+ && (d->matrix.type() <= QTransform::TxScale
+ || (d->matrix.type() == QTransform::TxRotate
+ && d->matrix.m11() == 0 && d->matrix.m22() == 0)))) {
useRects = true;
for (int i = 0; i < lineCount; ++i) {
if (lines[i].p1().x() != lines[i].p2().x()
@@ -4201,8 +4206,7 @@ void QOpenGLPaintEnginePrivate::drawImageAsPath(const QRectF &r, const QImage &i
qreal scaleX = r.width() / sr.width();
qreal scaleY = r.height() / sr.height();
- QTransform brush_matrix;
- brush_matrix.translate(r.left(), r.top());
+ QTransform brush_matrix = QTransform::fromTranslate(r.left(), r.top());
brush_matrix.scale(scaleX, scaleY);
brush_matrix.translate(-sr.left(), -sr.top());
@@ -4218,14 +4222,15 @@ void QOpenGLPaintEnginePrivate::drawImageAsPath(const QRectF &r, const QImage &i
brush_origin = old_brush_origin;
}
-void QOpenGLPaintEnginePrivate::drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy)
+void QOpenGLPaintEnginePrivate::drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy,
+ const QPointF &offset)
{
QBrush old_brush = cbrush;
QPointF old_brush_origin = brush_origin;
- QTransform brush_matrix;
- brush_matrix.translate(r.left(), r.top());
+ QTransform brush_matrix = QTransform::fromTranslate(r.left(), r.top());
brush_matrix.scale(sx, sy);
+ brush_matrix.translate(-offset.x(), -offset.y());
cbrush = QBrush(img);
cbrush.setTransform(brush_matrix);
@@ -4302,7 +4307,7 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR
}
}
-void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &)
+void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &offset)
{
Q_D(QOpenGLPaintEngine);
@@ -4312,7 +4317,7 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
int rw = qCeil(r.width());
int rh = qCeil(r.height());
if (rw < pm.width() && rh < pm.height()) {
- drawTiledPixmap(r, pm.copy(0, 0, rw, rh), QPointF());
+ drawTiledPixmap(r, pm.copy(0, 0, rw, rh), offset);
return;
}
@@ -4321,11 +4326,11 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
if (d->composition_mode > QPainter::CompositionMode_Plus || (d->high_quality_antialiasing && !d->isFastRect(r))) {
if (scaled.isNull())
- d->drawTiledImageAsPath(r, pm.toImage(), 1, 1);
+ d->drawTiledImageAsPath(r, pm.toImage(), 1, 1, offset);
else {
const qreal sx = pm.width() / qreal(scaled.width());
const qreal sy = pm.height() / qreal(scaled.height());
- d->drawTiledImageAsPath(r, scaled, sx, sy);
+ d->drawTiledImageAsPath(r, scaled, sx, sy, offset);
}
} else {
d->flushDrawQueue();
@@ -4356,8 +4361,12 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
q_vertexType vertexArray[4*2];
q_vertexType texCoordArray[4*2];
+ double offset_x = offset.x() / pm.width();
+ double offset_y = offset.y() / pm.height();
+
qt_add_rect_to_array(r, vertexArray);
- qt_add_texcoords_to_array(0, 0, tc_w, tc_h, texCoordArray);
+ qt_add_texcoords_to_array(offset_x, offset_y,
+ tc_w + offset_x, tc_h + offset_y, texCoordArray);
glVertexPointer(2, q_vertexTypeEnum, 0, vertexArray);
glTexCoordPointer(2, q_vertexTypeEnum, 0, texCoordArray);
@@ -4866,8 +4875,7 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
// add the glyphs used to the glyph texture cache
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
- QTransform matrix;
- matrix.translate(qRound(p.x()), qRound(p.y()));
+ QTransform matrix = QTransform::fromTranslate(qRound(p.x()), qRound(p.y()));
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
// make sure the glyphs we want to draw are in the cache
@@ -5501,9 +5509,20 @@ void QOpenGLPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
void QOpenGLPaintEngine::setState(QPainterState *s)
{
Q_D(QOpenGLPaintEngine);
+ QOpenGLPaintEngineState *new_state = static_cast<QOpenGLPaintEngineState *>(s);
+ QOpenGLPaintEngineState *old_state = state();
+
QPaintEngineEx::setState(s);
+
+ // are we in a save() ?
+ if (s == d->last_created_state) {
+ d->last_created_state = 0;
+ return;
+ }
+
if (isActive()) {
- d->updateDepthClip();
+ if (old_state->depthClipId != new_state->depthClipId)
+ d->updateDepthClip();
penChanged();
brushChanged();
opacityChanged();
@@ -5515,12 +5534,15 @@ void QOpenGLPaintEngine::setState(QPainterState *s)
QPainterState *QOpenGLPaintEngine::createState(QPainterState *orig) const
{
+ const Q_D(QOpenGLPaintEngine);
+
QOpenGLPaintEngineState *s;
if (!orig)
s = new QOpenGLPaintEngineState();
else
s = new QOpenGLPaintEngineState(*static_cast<QOpenGLPaintEngineState *>(orig));
+ d->last_created_state = s;
return s;
}
@@ -5534,11 +5556,13 @@ QOpenGLPaintEngineState::QOpenGLPaintEngineState(QOpenGLPaintEngineState &other)
clipRegion = other.clipRegion;
hasClipping = other.hasClipping;
fastClip = other.fastClip;
+ depthClipId = other.depthClipId;
}
QOpenGLPaintEngineState::QOpenGLPaintEngineState()
{
hasClipping = false;
+ depthClipId = 0;
}
QOpenGLPaintEngineState::~QOpenGLPaintEngineState()
diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h
index ad5d56b..439782b 100644
--- a/src/opengl/qpaintengine_opengl_p.h
+++ b/src/opengl/qpaintengine_opengl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,6 +69,7 @@ public:
QRegion clipRegion;
bool hasClipping;
QRect fastClip;
+ uint depthClipId;
};
class QOpenGLPaintEngine : public QPaintEngineEx
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 48feb82..f0c7e20 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -96,8 +96,6 @@ static int qt_gl_pixmap_serial = 0;
QGLPixmapData::QGLPixmapData(PixelType type)
: QPixmapData(type, OpenGLClass)
- , m_width(0)
- , m_height(0)
, m_renderFbo(0)
, m_textureId(0)
, m_engine(0)
@@ -114,13 +112,16 @@ QGLPixmapData::~QGLPixmapData()
QGLWidget *shareWidget = qt_gl_share_widget();
if (!shareWidget)
return;
- QGLShareContextScope ctx(shareWidget->context());
- glDeleteTextures(1, &m_textureId);
+
+ if (m_textureId) {
+ QGLShareContextScope ctx(shareWidget->context());
+ glDeleteTextures(1, &m_textureId);
+ }
}
bool QGLPixmapData::isValid() const
{
- return m_width > 0 && m_height > 0;
+ return w > 0 && h > 0;
}
bool QGLPixmapData::isValidContext(const QGLContext *ctx) const
@@ -134,7 +135,7 @@ bool QGLPixmapData::isValidContext(const QGLContext *ctx) const
void QGLPixmapData::resize(int width, int height)
{
- if (width == m_width && height == m_height)
+ if (width == w && height == h)
return;
if (width <= 0 || height <= 0) {
@@ -142,8 +143,10 @@ void QGLPixmapData::resize(int width, int height)
height = 0;
}
- m_width = width;
- m_height = height;
+ w = width;
+ h = height;
+ is_null = (w <= 0 || h <= 0);
+ d = pixelType() == QPixmapData::PixmapType ? 32 : 1;
if (m_textureId) {
QGLShareContextScope ctx(qt_gl_share_widget()->context());
@@ -173,7 +176,7 @@ void QGLPixmapData::ensureCreated() const
glGenTextures(1, &m_textureId);
glBindTexture(target, m_textureId);
GLenum format = m_hasAlpha ? GL_RGBA : GL_RGB;
- glTexImage2D(target, 0, format, m_width, m_height, 0,
+ glTexImage2D(target, 0, format, w, h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, 0);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -183,7 +186,7 @@ void QGLPixmapData::ensureCreated() const
const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, format);
glBindTexture(target, m_textureId);
- glTexSubImage2D(target, 0, 0, 0, m_width, m_height, format,
+ glTexSubImage2D(target, 0, 0, 0, w, h, format,
GL_UNSIGNED_BYTE, tx.bits());
if (useFramebufferObjects())
@@ -199,7 +202,7 @@ QGLFramebufferObject *QGLPixmapData::fbo() const
void QGLPixmapData::fromImage(const QImage &image,
Qt::ImageConversionFlags)
{
- if (image.size() == QSize(m_width, m_height))
+ if (image.size() == QSize(w, h))
setSerialNumber(++qt_gl_pixmap_serial);
resize(image.width(), image.height());
@@ -215,6 +218,10 @@ void QGLPixmapData::fromImage(const QImage &image,
m_hasFillColor = false;
m_hasAlpha = image.hasAlphaChannel();
+ w = image.width();
+ h = image.height();
+ is_null = (w <= 0 || h <= 0);
+ d = pixelType() == QPixmapData::PixmapType ? 32 : 1;
if (m_textureId) {
QGLShareContextScope ctx(qt_gl_share_widget()->context());
@@ -247,8 +254,15 @@ void QGLPixmapData::fill(const QColor &color)
if (!isValid())
return;
- if (!m_textureId)
+ bool hasAlpha = color.alpha() != 255;
+ if (hasAlpha && !m_hasAlpha) {
+ if (m_textureId) {
+ glDeleteTextures(1, &m_textureId);
+ m_textureId = 0;
+ m_dirty = true;
+ }
m_hasAlpha = color.alpha() != 255;
+ }
if (useFramebufferObjects()) {
m_source = QImage();
@@ -269,7 +283,7 @@ QImage QGLPixmapData::fillImage(const QColor &color) const
{
QImage img;
if (pixelType() == BitmapType) {
- img = QImage(m_width, m_height, QImage::Format_MonoLSB);
+ img = QImage(w, h, QImage::Format_MonoLSB);
img.setNumColors(2);
img.setColor(0, QColor(Qt::color0).rgba());
img.setColor(1, QColor(Qt::color1).rgba());
@@ -280,7 +294,7 @@ QImage QGLPixmapData::fillImage(const QColor &color) const
else
img.fill(1);
} else {
- img = QImage(m_width, m_height,
+ img = QImage(w, h,
m_hasAlpha
? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32);
@@ -307,7 +321,7 @@ QImage QGLPixmapData::toImage() const
QGLShareContextScope ctx(qt_gl_share_widget()->context());
extern QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha);
glBindTexture(GL_TEXTURE_2D, m_textureId);
- return qt_gl_read_texture(QSize(m_width, m_height), true, true);
+ return qt_gl_read_texture(QSize(w, h), true, true);
}
struct TextureBuffer
@@ -339,9 +353,9 @@ void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const
GL_TEXTURE_2D, m_textureId, 0);
const int x0 = 0;
- const int x1 = m_width;
+ const int x1 = w;
const int y0 = 0;
- const int y1 = m_height;
+ const int y1 = h;
glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_renderFbo->handle());
@@ -398,7 +412,8 @@ static TextureBuffer createTextureBuffer(const QSize &size, QGL2PaintEngineEx *e
bool QGLPixmapData::useFramebufferObjects()
{
return QGLFramebufferObject::hasOpenGLFramebufferObjects()
- && QGLFramebufferObject::hasOpenGLFramebufferBlit();
+ && QGLFramebufferObject::hasOpenGLFramebufferBlit()
+ && qt_gl_preferGL2Engine();
}
QPaintEngine* QGLPixmapData::paintEngine() const
@@ -420,15 +435,15 @@ QPaintEngine* QGLPixmapData::paintEngine() const
textureBufferStack << createTextureBuffer(size());
} else {
QSize sz = textureBufferStack.at(currentTextureBuffer).fbo->size();
- if (sz.width() < m_width || sz.height() < m_height) {
- if (sz.width() < m_width)
- sz.setWidth(qMax(m_width, qRound(sz.width() * 1.5)));
- if (sz.height() < m_height)
- sz.setHeight(qMax(m_height, qRound(sz.height() * 1.5)));
+ if (sz.width() < w || sz.height() < h) {
+ if (sz.width() < w)
+ sz.setWidth(qMax(w, qRound(sz.width() * 1.5)));
+ if (sz.height() < h)
+ sz.setHeight(qMax(h, qRound(sz.height() * 1.5)));
// wasting too much space?
- if (sz.width() * sz.height() > m_width * m_height * 2.5)
- sz = QSize(m_width, m_height);
+ if (sz.width() * sz.height() > w * h * 2.5)
+ sz = QSize(w, h);
delete textureBufferStack.at(currentTextureBuffer).fbo;
textureBufferStack[currentTextureBuffer] =
@@ -466,7 +481,7 @@ GLuint QGLPixmapData::bind(bool copyBack) const
} else {
if (m_hasFillColor) {
m_dirty = true;
- m_source = QImage(m_width, m_height, QImage::Format_ARGB32_Premultiplied);
+ m_source = QImage(w, h, QImage::Format_ARGB32_Premultiplied);
m_source.fill(PREMUL(m_fillColor.rgba()));
m_hasFillColor = false;
}
@@ -489,22 +504,22 @@ extern int qt_defaultDpiY();
int QGLPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
{
- if (m_width == 0)
+ if (w == 0)
return 0;
switch (metric) {
case QPaintDevice::PdmWidth:
- return m_width;
+ return w;
case QPaintDevice::PdmHeight:
- return m_height;
+ return h;
case QPaintDevice::PdmNumColors:
return 0;
case QPaintDevice::PdmDepth:
- return pixelType() == QPixmapData::PixmapType ? 32 : 1;
+ return d;
case QPaintDevice::PdmWidthMM:
- return qRound(m_width * 25.4 / qt_defaultDpiX());
+ return qRound(w * 25.4 / qt_defaultDpiX());
case QPaintDevice::PdmHeightMM:
- return qRound(m_height * 25.4 / qt_defaultDpiY());
+ return qRound(h * 25.4 / qt_defaultDpiY());
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return qt_defaultDpiX();
diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h
index af10f2c..a6aa22d 100644
--- a/src/opengl/qpixmapdata_gl_p.h
+++ b/src/opengl/qpixmapdata_gl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -94,9 +94,7 @@ public:
bool needsFill() const { return m_hasFillColor; }
QColor fillColor() const { return m_fillColor; }
- QSize size() const { return QSize(m_width, m_height); }
- int width() const { return m_width; }
- int height() const { return m_height; }
+ QSize size() const { return QSize(w, h); }
QGLFramebufferObject *fbo() const;
@@ -117,9 +115,6 @@ private:
QImage fillImage(const QColor &color) const;
- int m_width;
- int m_height;
-
mutable QGLFramebufferObject *m_renderFbo;
mutable GLuint m_textureId;
mutable QPaintEngine *m_engine;
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 01974a2..3a7a07e 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -72,6 +72,10 @@
#include <private/qpaintengineex_opengl2_p.h>
+#ifndef QT_OPENGL_ES_2
+#include <private/qpaintengine_opengl_p.h>
+#endif
+
#ifndef GLX_ARB_multisample
#define GLX_SAMPLE_BUFFERS_ARB 100000
#define GLX_SAMPLES_ARB 100001
@@ -180,11 +184,13 @@ QGLGraphicsSystem::QGLGraphicsSystem()
class QGLGlobalShareWidget
{
public:
- QGLGlobalShareWidget() : widget(0) {}
+ QGLGlobalShareWidget() : widget(0), initializing(false) {}
QGLWidget *shareWidget() {
- if (!widget && !cleanedUp) {
+ if (!initializing && !widget && !cleanedUp) {
+ initializing = true;
widget = new QGLWidget;
+ initializing = false;
}
return widget;
}
@@ -200,6 +206,7 @@ public:
private:
QGLWidget *widget;
+ bool initializing;
};
bool QGLGlobalShareWidget::cleanedUp = false;
@@ -315,9 +322,17 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_window_surface_2_engine)
+#if !defined (QT_OPENGL_ES_2)
+Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_window_surface_engine)
+#endif
+
/*! \reimp */
QPaintEngine *QGLWindowSurface::paintEngine() const
{
+#if !defined(QT_OPENGL_ES_2)
+ if (!qt_gl_preferGL2Engine())
+ return qt_gl_window_surface_engine();
+#endif
return qt_gl_window_surface_2_engine();
}
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index 9efd1ae..847fe12 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h
index d4b54d4..8c5577f 100644
--- a/src/opengl/util/fragmentprograms_p.h
+++ b/src/opengl/util/fragmentprograms_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/opengl/util/generator.cpp b/src/opengl/util/generator.cpp
index 430ced1..45c9165 100644
--- a/src/opengl/util/generator.cpp
+++ b/src/opengl/util/generator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/