summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.pro3
-rw-r--r--src/gui/image/qgifhandler.cpp7
-rw-r--r--src/gui/kernel/qguiapplication.cpp12
-rw-r--r--src/gui/kernel/qopenglcontext.cpp26
-rw-r--r--src/gui/kernel/qopenglcontext.h12
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qplatformintegration.cpp4
-rw-r--r--src/gui/kernel/qplatformmenu.h5
-rw-r--r--src/gui/kernel/qwindow.cpp4
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp14
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h2
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp39
-rw-r--r--src/gui/opengl/qopenglfunctions.h24
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp8
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp58
-rw-r--r--src/gui/opengl/qopengltexture.cpp36
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp6
-rw-r--r--src/gui/opengl/qopengltexturehelper.cpp6
-rw-r--r--src/gui/opengl/qopengltimerquery.cpp2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp4
-rw-r--r--src/gui/painting/qblittable_p.h2
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp33
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp2
-rw-r--r--src/gui/painting/qvectorpath_p.h28
-rw-r--r--src/gui/text/qtextengine.cpp19
27 files changed, 197 insertions, 165 deletions
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 6af692984a..af84eb7342 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -1,8 +1,7 @@
TARGET = QtGui
QT = core-private
-MODULE_CONFIG = needs_qpa_plugin
-contains(QT_CONFIG, opengl.*):MODULE_CONFIG += opengl
+contains(QT_CONFIG, opengl.*): MODULE_CONFIG = opengl
DEFINES += QT_NO_USING_NAMESPACE
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
index eeb62af4e5..19b838240f 100644
--- a/src/gui/image/qgifhandler.cpp
+++ b/src/gui/image/qgifhandler.cpp
@@ -359,6 +359,13 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
memset(bits, 0, image->byteCount());
}
+ // Check if the previous attempt to create the image failed. If it
+ // did then the image is broken and we should give up.
+ if (image->isNull()) {
+ state = Error;
+ return -1;
+ }
+
disposePrevious(image);
disposed = false;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a49f0ce496..827bf0164b 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1880,7 +1880,11 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
return;
if (previous) {
- QFocusEvent focusOut(QEvent::FocusOut, e->reason);
+ Qt::FocusReason r = e->reason;
+ if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) &&
+ newFocus && (newFocus->flags() & Qt::Popup) == Qt::Popup)
+ r = Qt::PopupFocusReason;
+ QFocusEvent focusOut(QEvent::FocusOut, r);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)),
qApp, SLOT(_q_updateFocusObject(QObject*)));
@@ -1889,7 +1893,11 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
}
if (QGuiApplicationPrivate::focus_window) {
- QFocusEvent focusIn(QEvent::FocusIn, e->reason);
+ Qt::FocusReason r = e->reason;
+ if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) &&
+ previous && (previous->flags() & Qt::Popup) == Qt::Popup)
+ r = Qt::PopupFocusReason;
+ QFocusEvent focusIn(QEvent::FocusIn, r);
QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)),
qApp, SLOT(_q_updateFocusObject(QObject*)));
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 7fa0452fe5..9bc4373860 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -61,6 +61,10 @@
#include <QDebug>
+#ifndef QT_OPENGL_ES_2
+#include <QOpenGLFunctions_1_0>
+#endif
+
QT_BEGIN_NAMESPACE
class QOpenGLVersionProfilePrivate
@@ -360,13 +364,15 @@ int QOpenGLContextPrivate::maxTextureSize()
funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
#ifndef QT_OPENGL_ES
- if (!q->isES()) {
+ if (!q->isOpenGLES()) {
GLenum proxy = GL_PROXY_TEXTURE_2D;
GLint size;
GLint next = 64;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
+ QOpenGLFunctions_1_0 *gl1funcs = q->versionFunctions<QOpenGLFunctions_1_0>();
+ gl1funcs->initializeOpenGLFunctions();
+ gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
if (size == 0) {
return max_texture_size;
}
@@ -377,7 +383,7 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
+ gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size);
max_texture_size = size;
@@ -730,7 +736,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const
QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
{
#ifndef QT_OPENGL_ES_2
- if (isES()) {
+ if (isOpenGLES()) {
qWarning("versionFunctions: Not supported on OpenGL ES");
return 0;
}
@@ -1090,8 +1096,8 @@ void *QOpenGLContext::openGLModuleHandle()
\enum QOpenGLContext::OpenGLModuleType
This enum defines the type of the underlying OpenGL implementation.
- \value DesktopGL Desktop OpenGL
- \value GLES2 OpenGL ES 2.0 or higher
+ \value LibGL OpenGL
+ \value LibGLES OpenGL ES 2.0 or higher
\since 5.3
*/
@@ -1106,7 +1112,7 @@ void *QOpenGLContext::openGLModuleHandle()
\note A desktop OpenGL implementation may be capable of creating
ES-compatible contexts too. Therefore in most cases it is more
appropriate to check QSurfaceFormat::renderableType() or using the
- the convenience function isES().
+ the convenience function isOpenGLES().
\note This function requires that the QGuiApplication instance is already created.
@@ -1118,9 +1124,9 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
Q_ASSERT(qGuiApp);
return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
#elif defined(QT_OPENGL_ES_2)
- return GLES2;
+ return LibGLES;
#else
- return DesktopGL;
+ return LibGL;
#endif
}
@@ -1134,7 +1140,7 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
\since 5.3
*/
-bool QOpenGLContext::isES() const
+bool QOpenGLContext::isOpenGLES() const
{
return format().renderableType() == QSurfaceFormat::OpenGLES;
}
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 736ae0c0b4..402989b4d0 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -198,13 +198,19 @@ public:
static void *openGLModuleHandle();
enum OpenGLModuleType {
- DesktopGL,
- GLES2
+ LibGL,
+ LibGLES,
+
+ // ###
+ DesktopGL = LibGL,
+ GLES2 = LibGLES
};
static OpenGLModuleType openGLModuleType();
- bool isES() const;
+ bool isOpenGLES() const;
+
+ bool isES() const { return isOpenGLES(); } // ###
Q_SIGNALS:
void aboutToBeDestroyed();
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 660fdd1298..8c6a0a04ca 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -127,7 +127,7 @@ private:
class Q_GUI_EXPORT QOpenGLContextGroupPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QOpenGLContextGroup);
+ Q_DECLARE_PUBLIC(QOpenGLContextGroup)
public:
QOpenGLContextGroupPrivate()
: m_context(0)
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 432199f142..f20482a859 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -510,14 +510,14 @@ void QPlatformIntegration::sync()
a desktop OpenGL implementation may be capable of creating OpenGL
ES-compatible contexts too.
- \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isES()
+ \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isOpenGLES()
\since 5.3
*/
QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
{
qWarning("This plugin does not support dynamic OpenGL loading!");
- return QOpenGLContext::DesktopGL;
+ return QOpenGLContext::LibGL;
}
#endif
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 19e2d9bccf..b88f2a7e84 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -86,6 +86,9 @@ public:
virtual void setChecked(bool isChecked) = 0;
virtual void setShortcut(const QKeySequence& shortcut) = 0;
virtual void setEnabled(bool enabled) = 0;
+
+ virtual void setNativeContents(WId item) { Q_UNUSED(item); }
+
Q_SIGNALS:
void activated();
void hovered();
@@ -118,6 +121,8 @@ public:
setVisible(true);
}
+ virtual void dismiss() { } // Closes this and all its related menu popups
+
virtual QPlatformMenuItem *menuItemAt(int position) const = 0;
virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 2b0c95b2b6..4b36e5ca41 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -458,7 +458,7 @@ void QWindow::setVisible(bool visible)
}
#ifndef QT_NO_CURSOR
- if (visible && d->hasCursor)
+ if (visible && (d->hasCursor || QGuiApplication::overrideCursor()))
d->applyCursor();
#endif
d->platformWindow->setVisible(visible);
@@ -746,7 +746,7 @@ void QWindow::setTitle(const QString &title)
d->windowTitle = title;
changed = true;
}
- if (d->platformWindow)
+ if (d->platformWindow && type() != Qt::Desktop)
d->platformWindow->setWindowTitle(title);
if (changed)
emit windowTitleChanged(title);
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index a1215acb7e..1c4231b79f 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -164,7 +164,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader;
code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader;
- if (context->isES())
+ if (context->isOpenGLES())
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_ES;
else
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_desktop;
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 92a7330d6c..cc829df950 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -590,7 +590,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) {
- if (ctx->isES()) {
+ if (ctx->isOpenGLES()) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24))
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
GL_DEPTH_COMPONENT24, size.width(), size.height());
@@ -602,7 +602,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
GL_DEPTH_COMPONENT, size.width(), size.height());
}
} else {
- if (ctx->isES()) {
+ if (ctx->isOpenGLES()) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) {
funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
size.width(), size.height());
@@ -631,7 +631,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
#ifdef QT_OPENGL_ES
GLenum storage = GL_STENCIL_INDEX8;
#else
- GLenum storage = ctx->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
+ GLenum storage = ctx->isOpenGLES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
#endif
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
@@ -773,7 +773,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
Q_D(QOpenGLFramebufferObject);
d->init(this, size, NoAttachment, target,
#ifndef QT_OPENGL_ES_2
- QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
+ QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8
#else
GL_RGBA
#endif
@@ -793,7 +793,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum
Q_D(QOpenGLFramebufferObject);
d->init(this, QSize(width, height), NoAttachment, target,
#ifndef QT_OPENGL_ES_2
- QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
+ QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8
#else
GL_RGBA
#endif
@@ -850,7 +850,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attach
#ifdef QT_OPENGL_ES_2
internal_format = GL_RGBA;
#else
- internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
+ internal_format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
#endif
d->init(this, QSize(width, height), attachment, target, internal_format);
}
@@ -877,7 +877,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment
#ifdef QT_OPENGL_ES_2
internal_format = GL_RGBA;
#else
- internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
+ internal_format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
#endif
d->init(this, size, attachment, target, internal_format);
}
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index bd830b38e9..7a653bc16d 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -74,7 +74,7 @@ public:
// context, so we need a fallback just to be safe, even though in pratice there
// will usually be a context current.
QOpenGLContext *ctx = QOpenGLContext::currentContext();
- const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL;
+ const bool isES = ctx ? ctx->isOpenGLES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL;
internal_format = isES ? GL_RGBA : GL_RGBA8;
#else
internal_format = GL_RGBA;
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index eb2c98e1f5..bcb38ce7f1 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -256,7 +256,7 @@ QOpenGLExtensions::QOpenGLExtensions(QOpenGLContext *context)
static int qt_gl_resolve_features()
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx->isES()) {
+ if (ctx->isOpenGLES()) {
// OpenGL ES 2
int features = QOpenGLFunctions::Multitexture |
QOpenGLFunctions::Shaders |
@@ -367,7 +367,7 @@ static int qt_gl_resolve_extensions()
if (extensionMatcher.match("GL_ARB_pixel_buffer_object"))
extensions |= QOpenGLExtensions::PixelBufferObject;
- if (ctx->isES()) {
+ if (ctx->isOpenGLES()) {
if (format.majorVersion() >= 2)
extensions |= QOpenGLExtensions::GenerateMipmap;
if (extensionMatcher.match("GL_OES_mapbuffer"))
@@ -2012,12 +2012,6 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
*/
/*!
- \fn void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-
- \internal
-*/
-
-/*!
\fn bool QOpenGLFunctions::isInitialized(const QOpenGLFunctionsPrivate *d)
\internal
*/
@@ -2421,7 +2415,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveClearColor(GLclampf red, GLclampf g
static void QOPENGLF_APIENTRY qopenglfResolveClearDepthf(GLclampf depth)
{
- if (QOpenGLContext::currentContext()->isES()) {
+ if (QOpenGLContext::currentContext()->isOpenGLES()) {
RESOLVE_FUNC_VOID(0, ClearDepthf)(depth);
} else {
RESOLVE_FUNC_VOID(0, ClearDepth)((GLdouble) depth);
@@ -2470,7 +2464,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveDepthMask(GLboolean flag)
static void QOPENGLF_APIENTRY qopenglfResolveDepthRangef(GLclampf zNear, GLclampf zFar)
{
- if (QOpenGLContext::currentContext()->isES()) {
+ if (QOpenGLContext::currentContext()->isOpenGLES()) {
RESOLVE_FUNC_VOID(0, DepthRangef)(zNear, zFar);
} else {
RESOLVE_FUNC_VOID(0, DepthRange)((GLdouble) zNear, (GLdouble) zFar);
@@ -3174,15 +3168,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qop
(target, offset, size, data);
}
-#ifndef QT_OPENGL_ES_2
-// Desktop only
-
-static void QOPENGLF_APIENTRY qopenglfResolveGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- RESOLVE_FUNC_VOID(0, GetTexLevelParameteriv)(target, level, pname, params);
-}
-
-#ifndef QT_OPENGL_DYNAMIC
+#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC)
// Special translation functions for ES-specific calls on desktop GL
static void QOPENGLF_APIENTRY qopenglfTranslateClearDepthf(GLclampf depth)
@@ -3194,10 +3180,7 @@ static void QOPENGLF_APIENTRY qopenglfTranslateDepthRangef(GLclampf zNear, GLcla
{
::glDepthRange(zNear, zFar);
}
-
-#endif // QT_OPENGL_DYNAMIC
-
-#endif // QT_OPENGL_ES2
+#endif // !ES && !DYNAMIC
QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
{
@@ -3256,8 +3239,6 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
TexParameteriv = qopenglfResolveTexParameteriv;
TexSubImage2D = qopenglfResolveTexSubImage2D;
Viewport = qopenglfResolveViewport;
-
- GetTexLevelParameteriv = qopenglfResolveGetTexLevelParameteriv;
} else {
#ifndef QT_OPENGL_DYNAMIC
// Use the functions directly. This requires linking QtGui to an OpenGL implementation.
@@ -3301,15 +3282,17 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
StencilFunc = ::glStencilFunc;
StencilMask = ::glStencilMask;
StencilOp = ::glStencilOp;
- TexImage2D = ::glTexImage2D;
+#if defined(Q_OS_OSX) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+ TexImage2D = reinterpret_cast<void (*)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)>(glTexImage2D);
+#else
+ TexImage2D = glTexImage2D;
+#endif
TexParameterf = ::glTexParameterf;
TexParameterfv = ::glTexParameterfv;
TexParameteri = ::glTexParameteri;
TexParameteriv = ::glTexParameteriv;
TexSubImage2D = ::glTexSubImage2D;
Viewport = ::glViewport;
-
- GetTexLevelParameteriv = ::glGetTexLevelParameteriv;
#else // QT_OPENGL_DYNAMIC
// This should not happen.
qFatal("QOpenGLFunctions: Dynamic OpenGL builds do not support platforms with insufficient function resolving capabilities");
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 03c12200d5..de1de39db2 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -407,9 +407,6 @@ public:
void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
- // OpenGL1, not GLES2
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
-
protected:
QOpenGLFunctionsPrivate *d_ptr;
static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; }
@@ -565,9 +562,6 @@ struct QOpenGLFunctionsPrivate
void (QOPENGLF_APIENTRYP VertexAttrib4fv)(GLuint indx, const GLfloat* values);
void (QOPENGLF_APIENTRYP VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
- // OpenGL1 only, not GLES2
- void (QOPENGLF_APIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
-
// Special non-ES OpenGL variants, not to be called directly
void (QOPENGLF_APIENTRYP ClearDepth)(GLdouble depth);
void (QOPENGLF_APIENTRYP DepthRange)(GLdouble zNear, GLdouble zFar);
@@ -2154,24 +2148,6 @@ inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLe
Q_OPENGL_FUNCTIONS_DEBUG
}
-// OpenGL1, not GLES2
-
-inline void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
-#ifdef QT_OPENGL_ES_2
- Q_UNUSED(target);
- Q_UNUSED(level);
- Q_UNUSED(pname);
- Q_UNUSED(params);
- // Cannot get here.
- qFatal("QOpenGLFunctions: glGetTexLevelParameteriv not available with OpenGL ES");
-#else
- Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
- d_ptr->GetTexLevelParameteriv(target, level, pname, params);
-#endif
- Q_OPENGL_FUNCTIONS_DEBUG
-}
-
QT_END_NAMESPACE
#endif // QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index f160b340e0..81a0d82c99 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -221,7 +221,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
GLuint wrapMode = GL_REPEAT;
- if (QOpenGLContext::currentContext()->isES()) {
+ if (QOpenGLContext::currentContext()->isOpenGLES()) {
// OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead,
// we emulate GL_REPEAT by only taking the fractional part of the texture coords
// in the qopenglslTextureBrushSrcFragmentShader program.
@@ -598,7 +598,7 @@ void QOpenGL2PaintEngineExPrivate::resetGLState()
setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false);
setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
// gl_Color, corresponding to vertex attribute 3, may have been changed
float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
funcs.glVertexAttrib4fv(3, color);
@@ -1333,7 +1333,7 @@ void QOpenGL2PaintEngineEx::renderHintsChanged()
state()->renderHintsChanged = true;
#ifndef QT_OPENGL_ES_2
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGL2PaintEngineEx);
if ((state()->renderHints & QPainter::Antialiasing)
|| (state()->renderHints & QPainter::HighQualityAntialiasing))
@@ -2011,7 +2011,7 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->glyphCacheFormat = QFontEngine::Format_A8;
#ifndef QT_OPENGL_ES_2
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
d->funcs.glDisable(GL_MULTISAMPLE);
d->glyphCacheFormat = QFontEngine::Format_A32;
d->multisamplingAlwaysEnabled = false;
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index bfde270446..6e85e5eb4b 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -176,7 +176,7 @@ public:
#endif
{
#ifndef QT_OPENGL_ES_2
- if (!ctx->isES()) {
+ if (!ctx->isOpenGLES()) {
QSurfaceFormat f = ctx->format();
// Geometry shaders require OpenGL >= 3.2
@@ -445,7 +445,7 @@ bool QOpenGLShader::compileSourceCode(const char *source)
#ifdef QOpenGL_REDEFINE_HIGHP
if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers
- && QOpenGLContext::currentContext()->isES()) {
+ && QOpenGLContext::currentContext()->isOpenGLES()) {
src.append(redefineHighp);
srclen.append(GLint(sizeof(redefineHighp) - 1));
}
@@ -674,7 +674,7 @@ bool QOpenGLShaderProgram::init()
#ifndef QT_OPENGL_ES_2
// Resolve OpenGL 4 functions for tessellation shader support
QSurfaceFormat format = context->format();
- if (!context->isES()
+ if (!context->isOpenGLES()
&& format.version() >= qMakePair<int, int>(4, 0)) {
d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>();
d->tessellationFuncs->initializeOpenGLFunctions();
@@ -2236,6 +2236,10 @@ void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x2& v
Sets the uniform variable at \a location in the current context
to a 2x3 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat2x3, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec3.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value)
@@ -2251,6 +2255,10 @@ void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value
Sets the uniform variable called \a name in the current context
to a 2x3 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat2x3, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec3.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& value)
@@ -2262,6 +2270,10 @@ void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& v
Sets the uniform variable at \a location in the current context
to a 2x4 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat2x4, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec4.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value)
@@ -2277,6 +2289,10 @@ void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value
Sets the uniform variable called \a name in the current context
to a 2x4 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat2x4, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec4.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& value)
@@ -2288,6 +2304,10 @@ void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& v
Sets the uniform variable at \a location in the current context
to a 3x2 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat3x2, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec2.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value)
@@ -2303,6 +2323,10 @@ void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value
Sets the uniform variable called \a name in the current context
to a 3x2 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat3x2, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec2.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x2& value)
@@ -2340,6 +2364,10 @@ void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x3& v
Sets the uniform variable at \a location in the current context
to a 3x4 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat3x4, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec4.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value)
@@ -2355,6 +2383,10 @@ void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value
Sets the uniform variable called \a name in the current context
to a 3x4 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat3x4, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec4.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& value)
@@ -2366,6 +2398,10 @@ void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& v
Sets the uniform variable at \a location in the current context
to a 4x2 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat4x2, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec2.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value)
@@ -2381,6 +2417,10 @@ void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value
Sets the uniform variable called \a name in the current context
to a 4x2 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat4x2, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec2.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& value)
@@ -2392,6 +2432,10 @@ void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& v
Sets the uniform variable at \a location in the current context
to a 4x3 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat4x3, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec3.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value)
@@ -2407,6 +2451,10 @@ void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value
Sets the uniform variable called \a name in the current context
to a 4x3 matrix \a value.
+ \note This function is not aware of non square matrix support,
+ that is, GLSL types like mat4x3, that is present in modern OpenGL
+ versions. Instead, it treats the uniform as an array of vec3.
+
\sa setAttributeValue()
*/
void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x3& value)
@@ -3280,7 +3328,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
#ifndef QT_OPENGL_ES_2
// Geometry shaders require OpenGL 3.2 or newer
QSurfaceFormat format = context->format();
- return (!context->isES())
+ return (!context->isOpenGLES())
&& (format.version() >= qMakePair<int, int>(3, 2));
#else
// No geometry shader support in OpenGL ES2
@@ -3288,7 +3336,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
#endif
} else if (type == TessellationControl || type == TessellationEvaluation) {
#if !defined(QT_OPENGL_ES_2)
- return (!context->isES())
+ return (!context->isOpenGLES())
&& (format.version() >= qMakePair<int, int>(4, 0));
#else
// No tessellation shader support in OpenGL ES2
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 078274eabd..e3444332a0 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -180,6 +180,10 @@ bool QOpenGLTexturePrivate::create()
void QOpenGLTexturePrivate::destroy()
{
+ if (!context) {
+ // not created or already destroyed
+ return;
+ }
if (QOpenGLContext::currentContext() != context) {
qWarning("Requires a valid current OpenGL context.\n"
"Texture has not been destroyed");
@@ -2432,7 +2436,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
bool supported = false;
#if !defined(QT_OPENGL_ES_2)
- if (!ctx->isES()) {
+ if (!ctx->isOpenGLES()) {
switch (feature) {
case ImmutableMultisampleStorage:
case TextureBuffer:
@@ -2489,7 +2493,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
}
}
- if (ctx->isES())
+ if (ctx->isOpenGLES())
#endif
{
switch (feature) {
@@ -2524,7 +2528,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
void QOpenGLTexture::setMipBaseLevel(int baseLevel)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2561,7 +2565,7 @@ int QOpenGLTexture::mipBaseLevel() const
void QOpenGLTexture::setMipMaxLevel(int maxLevel)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2598,7 +2602,7 @@ int QOpenGLTexture::mipMaxLevel() const
void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2708,7 +2712,7 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel)
void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value)
{
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2737,7 +2741,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
SwizzleValue b, SwizzleValue a)
{
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2786,7 +2790,7 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon
void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
{
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2977,7 +2981,7 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire
void QOpenGLTexture::setBorderColor(QColor color)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3007,7 +3011,7 @@ void QOpenGLTexture::setBorderColor(QColor color)
void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3040,7 +3044,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3075,7 +3079,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3187,7 +3191,7 @@ void QOpenGLTexture::borderColor(unsigned int *border) const
void QOpenGLTexture::setMinimumLevelOfDetail(float value)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3224,7 +3228,7 @@ float QOpenGLTexture::minimumLevelOfDetail() const
void QOpenGLTexture::setMaximumLevelOfDetail(float value)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3260,7 +3264,7 @@ float QOpenGLTexture::maximumLevelOfDetail() const
void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3302,7 +3306,7 @@ QPair<float, float> QOpenGLTexture::levelOfDetailRange() const
void QOpenGLTexture::setLevelofDetailBias(float bias)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 3287bbb972..ac88d9d3a5 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -369,7 +369,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
|| mask.format() == QImage::Format_ARGB32_Premultiplied
#else
|| (mask.format() == QImage::Format_ARGB32_Premultiplied
- && ctx->isES())
+ && ctx->isOpenGLES())
#endif
) {
for (int y = 0; y < maskHeight; ++y) {
@@ -387,7 +387,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
src[x] = qRgba(r, g, b, avg);
// swizzle the bits to accommodate for the GL_RGBA upload.
#if Q_BYTE_ORDER != Q_BIG_ENDIAN
- if (ctx->isES())
+ if (ctx->isOpenGLES())
#endif
src[x] = ARGB2RGBA(src[x]);
}
@@ -400,7 +400,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
#ifdef QT_OPENGL_ES_2
GLenum fmt = GL_RGBA;
#else
- GLenum fmt = ctx->isES() ? GL_RGBA : GL_BGRA;
+ GLenum fmt = ctx->isOpenGLES() ? GL_RGBA : GL_BGRA;
#endif // QT_OPENGL_ES_2
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp
index 1d31fb5605..27aece8eca 100644
--- a/src/gui/opengl/qopengltexturehelper.cpp
+++ b/src/gui/opengl/qopengltexturehelper.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
{
// Resolve EXT_direct_state_access entry points if present
- if (!context->isES()
+ if (!context->isOpenGLES()
&& context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
@@ -121,7 +121,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
}
// Some DSA functions are part of NV_texture_multisample instead
- if (!context->isES()
+ if (!context->isOpenGLES()
&& context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
@@ -190,7 +190,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage1D")));
#endif
- if (context->isES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
+ if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES")));
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES")));
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES")));
diff --git a/src/gui/opengl/qopengltimerquery.cpp b/src/gui/opengl/qopengltimerquery.cpp
index 908a9cee07..5159ec58fc 100644
--- a/src/gui/opengl/qopengltimerquery.cpp
+++ b/src/gui/opengl/qopengltimerquery.cpp
@@ -135,7 +135,7 @@ bool QOpenGLTimerQueryPrivate::create()
return false;
}
- if (context->isES()) {
+ if (context->isOpenGLES()) {
qWarning("QOpenGLTimerQuery: Not supported on OpenGL ES");
return false;
}
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index 9dfd5b2a6f..5ebfc9a9c8 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -60,7 +60,7 @@ public:
QVertexArrayObjectHelper(QOpenGLContext *context)
{
Q_ASSERT(context);
- if (context->isES()) {
+ if (context->isOpenGLES()) {
GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
@@ -159,7 +159,7 @@ bool QOpenGLVertexArrayObjectPrivate::create()
context = ctx;
QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
- if (ctx->isES()) {
+ if (ctx->isOpenGLES()) {
if (ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
vaoFuncsType = OES;
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index 159e60079f..f65549d63c 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -68,7 +68,7 @@ public:
// Internal ones
OutlineCapability = 0x0001000
};
- Q_DECLARE_FLAGS (Capabilities, Capability);
+ Q_DECLARE_FLAGS (Capabilities, Capability)
QBlittable(const QSize &size, Capabilities caps);
virtual ~QBlittable();
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 26eacacd49..67a692e2db 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -238,7 +238,7 @@ private:
class QBlitterPaintEnginePrivate : public QRasterPaintEnginePrivate
{
- Q_DECLARE_PUBLIC(QBlitterPaintEngine);
+ Q_DECLARE_PUBLIC(QBlitterPaintEngine)
public:
QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p)
: QRasterPaintEnginePrivate()
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index bfcb24ae3a..ce8c1d1ca7 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -235,21 +235,6 @@ static const QRectF boundingRect(const QPointF *points, int pointCount)
}
#endif
-template <typename T> static inline bool isRect(const T *pts, int elementCount) {
- return (elementCount == 5 // 5-point polygon, check for closed rect
- && pts[0] == pts[8] && pts[1] == pts[9] // last point == first point
- && pts[0] == pts[6] && pts[2] == pts[4] // x values equal
- && pts[1] == pts[3] && pts[5] == pts[7] // y values equal...
- && pts[0] < pts[4] && pts[1] < pts[5]
- ) ||
- (elementCount == 4 // 4-point polygon, check for unclosed rect
- && pts[0] == pts[6] && pts[2] == pts[4] // x values equal
- && pts[1] == pts[3] && pts[5] == pts[7] // y values equal...
- && pts[0] < pts[4] && pts[1] < pts[5]
- );
-}
-
-
static void qt_ft_outline_move_to(qfixed x, qfixed y, void *data)
{
((QOutlineMapper *) data)->moveTo(QPointF(qt_fixed_to_real(x), qt_fixed_to_real(y)));
@@ -1193,22 +1178,14 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state();
- const qreal *points = path.points();
- const QPainterPath::ElementType *types = path.elements();
-
// There are some cases that are not supported by clip(QRect)
if (op != Qt::IntersectClip || !s->clip || s->clip->hasRectClip || s->clip->hasRegionClip) {
if (s->matrix.type() <= QTransform::TxScale
- && ((path.shape() == QVectorPath::RectangleHint)
- || (isRect(points, path.elementCount())
- && (!types || (types[0] == QPainterPath::MoveToElement
- && types[1] == QPainterPath::LineToElement
- && types[2] == QPainterPath::LineToElement
- && types[3] == QPainterPath::LineToElement))))) {
+ && path.isRect()) {
#ifdef QT_DEBUG_DRAW
qDebug() << " --- optimizing vector clip to rect clip...";
#endif
-
+ const qreal *points = path.points();
QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]);
if (setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op))
return;
@@ -1939,7 +1916,7 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly
#endif
Q_ASSERT(pointCount >= 2);
- if (mode != PolylineMode && isRect((qreal *) points, pointCount)) {
+ if (mode != PolylineMode && QVectorPath::isRect((qreal *) points, pointCount)) {
QRectF r(points[0], points[2]);
drawRects(&r, 1);
return;
@@ -1980,7 +1957,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg
qDebug() << " - " << points[i];
#endif
Q_ASSERT(pointCount >= 2);
- if (mode != PolylineMode && isRect((int *) points, pointCount)) {
+ if (mode != PolylineMode && QVectorPath::isRect((int *) points, pointCount)) {
QRect r(points[0].x(),
points[0].y(),
points[2].x() - points[0].x(),
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 6425aa065e..5b6c4bb83d 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -314,7 +314,7 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
funcs->glGenTextures(1, &d_ptr->textureId);
funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
#ifndef QT_OPENGL_ES_2
- if (!QOpenGLContext::currentContext()->isES()) {
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
}
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index e97d6e1dce..ca95c32597 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -167,6 +167,32 @@ public:
return 0;
}
+ template <typename T> static inline bool isRect(const T *pts, int elementCount) {
+ return (elementCount == 5 // 5-point polygon, check for closed rect
+ && pts[0] == pts[8] && pts[1] == pts[9] // last point == first point
+ && pts[0] == pts[6] && pts[2] == pts[4] // x values equal
+ && pts[1] == pts[3] && pts[5] == pts[7] // y values equal...
+ && pts[0] < pts[4] && pts[1] < pts[5]
+ ) ||
+ (elementCount == 4 // 4-point polygon, check for unclosed rect
+ && pts[0] == pts[6] && pts[2] == pts[4] // x values equal
+ && pts[1] == pts[3] && pts[5] == pts[7] // y values equal...
+ && pts[0] < pts[4] && pts[1] < pts[5]
+ );
+ }
+
+ inline bool isRect() const
+ {
+ const QPainterPath::ElementType * const types = elements();
+
+ return (shape() == QVectorPath::RectangleHint)
+ || (isRect(points(), elementCount())
+ && (!types || (types[0] == QPainterPath::MoveToElement
+ && types[1] == QPainterPath::LineToElement
+ && types[2] == QPainterPath::LineToElement
+ && types[3] == QPainterPath::LineToElement)));
+ }
+
private:
Q_DISABLE_COPY(QVectorPath)
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 35950c709b..34788dc4dc 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -122,20 +122,9 @@ private:
return;
const int end = start + length;
for (int i = start + 1; i < end; ++i) {
- // According to the unicode spec we should be treating characters in the Common script
- // (punctuation, spaces, etc) as being the same script as the surrounding text for the
- // purpose of splitting up text. This is important because, for example, a fullstop
- // (0x2E) can be used to indicate an abbreviation and so must be treated as part of a
- // word. Thus it must be passed along with the word in languages that have to calculate
- // word breaks. For example the thai word "ครม." has no word breaks but the word "ครม"
- // does.
- // Unfortuntely because we split up the strings for both wordwrapping and for setting
- // the font and because Japanese and Chinese are also aliases of the script "Common",
- // doing this would break too many things. So instead we only pass the full stop
- // along, and nothing else.
if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel
&& m_analysis[i].flags == m_analysis[start].flags
- && (m_analysis[i].script == m_analysis[start].script || m_string[i] == QLatin1Char('.'))
+ && m_analysis[i].script == m_analysis[start].script
&& m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject
&& i - start < MaxItemLength)
continue;
@@ -1515,26 +1504,22 @@ void QTextEngine::itemize() const
while (uc < e) {
switch (*uc) {
case QChar::ObjectReplacementCharacter:
- analysis->script = QChar::Script_Common;
analysis->flags = QScriptAnalysis::Object;
break;
case QChar::LineSeparator:
if (analysis->bidiLevel % 2)
--analysis->bidiLevel;
- analysis->script = QChar::Script_Common;
analysis->flags = QScriptAnalysis::LineOrParagraphSeparator;
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
*const_cast<ushort*>(uc) = 0x21B5; // visual line separator
break;
case QChar::Tabulation:
- analysis->script = QChar::Script_Common;
analysis->flags = QScriptAnalysis::Tab;
analysis->bidiLevel = control.baseLevel();
break;
case QChar::Space:
case QChar::Nbsp:
if (option.flags() & QTextOption::ShowTabsAndSpaces) {
- analysis->script = QChar::Script_Common;
analysis->flags = QScriptAnalysis::Space;
analysis->bidiLevel = control.baseLevel();
break;
@@ -1556,8 +1541,10 @@ void QTextEngine::itemize() const
#ifdef QT_ENABLE_HARFBUZZ_NG
analysis = scriptAnalysis.data();
if (useHarfbuzzNG) {
+ // ### pretend HB-old behavior for now
for (int i = 0; i < length; ++i) {
switch (analysis[i].script) {
+ case QChar::Script_Latin:
case QChar::Script_Han:
case QChar::Script_Hiragana:
case QChar::Script_Katakana: