summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/opengl.pro2
-rw-r--r--src/opengl/qgl.cpp4
-rw-r--r--src/opengl/qgl.h32
-rw-r--r--src/opengl/qgl_qpa.cpp3
-rw-r--r--src/opengl/qpaintengine_opengl.cpp13
-rw-r--r--src/opengl/qwindowsurface_gl.cpp12
-rw-r--r--src/opengl/qwindowsurface_gl_p.h4
7 files changed, 33 insertions, 37 deletions
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 5774bef..e7c1c44 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -120,7 +120,7 @@ x11 {
LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
}
-mac {
+mac:!qpa {
OBJECTIVE_SOURCES += qgl_mac.mm \
qglpixelbuffer_mac.mm
LIBS_PRIVATE += -framework AppKit -framework Carbon
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b3b459d..057fb55 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1423,10 +1423,6 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags()
}
}
-#ifdef Q_WS_QPA
- hasOpenGL(); // ### I have no idea why this is needed here, but it makes things work for testlite
-#endif
-
QString versionString(QLatin1String(reinterpret_cast<const char*>(glGetString(GL_VERSION))));
OpenGLVersionFlags versionFlags = qOpenGLVersionFlagsFromString(versionString);
if (currentCtx) {
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index ff73d88..c57995d 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -61,21 +61,29 @@ QT_BEGIN_HEADER
#if defined(Q_WS_MAC)
# include <OpenGL/gl.h>
#elif defined(QT_OPENGL_ES_1)
-# include <GLES/gl.h>
-#ifndef GL_DOUBLE
-# define GL_DOUBLE GL_FLOAT
-#endif
-#ifndef GLdouble
+# if defined(Q_OS_MAC)
+# include <OpenGLES/ES1/gl.h>
+# else
+# include <GLES/gl.h>
+# endif
+# ifndef GL_DOUBLE
+# define GL_DOUBLE GL_FLOAT
+# endif
+# ifndef GLdouble
typedef GLfloat GLdouble;
-#endif
+# endif
#elif defined(QT_OPENGL_ES_2)
-# include <GLES2/gl2.h>
-#ifndef GL_DOUBLE
-# define GL_DOUBLE GL_FLOAT
-#endif
-#ifndef GLdouble
+# if defined(Q_OS_MAC)
+# include <OpenGLES/ES2/gl.h>
+# else
+# include <GLES2/gl2.h>
+# endif
+# ifndef GL_DOUBLE
+# define GL_DOUBLE GL_FLOAT
+# endif
+# ifndef GLdouble
typedef GLfloat GLdouble;
-#endif
+# endif
#else
# include <GL/gl.h>
#endif
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 4bac1fb..994344c 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -127,7 +127,8 @@ void QGLContextPrivate::setupSharing() {
bool QGLFormat::hasOpenGL()
{
- return QApplicationPrivate::platformIntegration()->hasOpenGL();
+ return QApplicationPrivate::platformIntegration()
+ ->hasCapability(QPlatformIntegration::OpenGL);
}
void qDeleteQGLContext(void *handle)
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 2c01ac4..9da811a 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4736,7 +4736,7 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine,
// qDebug() << "new context" << context << font_cache;
qt_context_cache.insert(context, font_cache);
if (context->isValid()) {
- if (context->device()->devType() == QInternal::Widget) {
+ if (context->device() && context->device()->devType() == QInternal::Widget) {
QWidget *widget = static_cast<QWidget *>(context->device());
connect(widget, SIGNAL(destroyed(QObject*)), SLOT(widgetDestroyed(QObject*)));
}
@@ -4832,7 +4832,6 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine,
}
QImage glyph_im(fontEngine->alphaMapForGlyph(glyphs[i]));
- glyph_im = glyph_im.convertToFormat(QImage::Format_Indexed8);
glyph_width = glyph_im.width();
Q_ASSERT(glyph_width >= 0);
// pad the glyph width to an even number
@@ -4855,15 +4854,21 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine,
#endif
if (!glyph_im.isNull()) {
-
int idx = 0;
uchar *tex_data = (uchar *) malloc(glyph_width*glyph_im.height()*2);
memset(tex_data, 0, glyph_width*glyph_im.height()*2);
+ bool is8BitGray = false;
+#ifdef Q_WS_QPA
+ if (glyph_im.format() == QImage::Format_Indexed8) {
+ is8BitGray = true;
+ }
+#endif
+ glyph_im = glyph_im.convertToFormat(QImage::Format_Indexed8);
for (int y=0; y<glyph_im.height(); ++y) {
uchar *s = (uchar *) glyph_im.scanLine(y);
for (int x=0; x<glyph_im.width(); ++x) {
- uchar alpha = qAlpha(glyph_im.color(*s));
+ uchar alpha = is8BitGray ? *s : qAlpha(glyph_im.color(*s));
tex_data[idx] = alpha;
tex_data[idx+1] = alpha;
++s;
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 77f6103..70c1fde 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -181,7 +181,6 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
//
// QGLWindowSurface
//
-#ifndef Q_WS_QPA
class QGLGlobalShareWidget
{
public:
@@ -257,22 +256,13 @@ void qt_destroy_gl_share_widget()
{
_qt_gl_share_widget()->destroy();
}
-#endif//Q_WS_QPA
const QGLContext *qt_gl_share_context()
{
-#ifdef Q_WS_QPA
- //make it possible to have an assesor to defaultSharedGLContext.
- const QPlatformGLContext *platformContext = QPlatformGLContext::defaultSharedContext();
- if (!platformContext)
- qDebug() << "Please implement a defaultSharedContext for your platformplugin";
- return QGLContext::fromPlatformGLContext(const_cast<QPlatformGLContext *>(platformContext));
-#else
QGLWidget *widget = qt_gl_share_widget();
if (widget)
return widget->context();
return 0;
-#endif
}
#ifdef QGL_USE_TEXTURE_POOL
@@ -427,7 +417,7 @@ QGLWindowSurface::~QGLWindowSurface()
if (!qt_gl_share_widget()->context()->isSharing())
qt_destroy_gl_share_widget();
}
-#endif
+#endif // QGL_USE_TEXTURE_POOL
}
void QGLWindowSurface::deleted(QObject *object)
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index 4ad8339..c71ce59 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -66,12 +66,8 @@ class QRegion;
class QWidget;
struct QGLWindowSurfacePrivate;
-#ifdef Q_WS_QPA
-Q_OPENGL_EXPORT const QGLContext* qt_gl_share_context();
-#else
Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget();
Q_OPENGL_EXPORT void qt_destroy_gl_share_widget();
-#endif
class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice
{