summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp10
-rw-r--r--src/opengl/gl2paintengineex/qtriangulator.cpp21
-rw-r--r--src/opengl/qgl.cpp6
-rw-r--r--src/opengl/qgl_p.h4
-rw-r--r--src/opengl/qglextensions_p.h23
-rw-r--r--src/opengl/qglframebufferobject.cpp23
-rw-r--r--src/opengl/qglpixelbuffer.cpp4
-rw-r--r--src/opengl/qglpixmapfilter.cpp6
-rw-r--r--src/opengl/qpaintengine_opengl.cpp2
-rw-r--r--src/opengl/qpixmapdata_gl.cpp4
-rw-r--r--src/opengl/qpixmapdata_gl_p.h1
11 files changed, 52 insertions, 52 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index a98d7cc..84c7fed 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -102,7 +102,7 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled;
extern bool qt_applefontsmoothing_enabled;
#endif
-extern QImage qt_imageForBrush(int brushStyle, bool invert);
+Q_DECL_IMPORT extern QImage qt_imageForBrush(int brushStyle, bool invert);
////////////////////////////////// Private Methods //////////////////////////////////////////
@@ -825,7 +825,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
- if (glSupportsElementIndexUint)
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint)
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW);
else
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint16) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW);
@@ -836,7 +836,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW);
#else
cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size());
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size());
} else {
@@ -853,7 +853,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0);
- if (glSupportsElementIndexUint)
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint)
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0);
else
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0);
@@ -861,7 +861,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBindBuffer(GL_ARRAY_BUFFER, 0);
#else
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices);
- if (glSupportsElementIndexUint)
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint)
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices);
else
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices);
diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp
index b839b00..85f604a 100644
--- a/src/opengl/gl2paintengineex/qtriangulator.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulator.cpp
@@ -58,7 +58,6 @@
#include <math.h>
#include <private/qgl_p.h>
-#include <private/qglextensions_p.h>
QT_BEGIN_NAMESPACE
@@ -3014,10 +3013,8 @@ void QTriangulator<T>::MonotoneToTriangles::decompose()
QTriangleSet qTriangulate(const qreal *polygon,
int count, uint hint, const QTransform &matrix)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QTriangleSet triangleSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(polygon, count, hint, matrix);
QVertexSet<quint32> vertexSet = triangulator.triangulate();
@@ -3037,10 +3034,8 @@ QTriangleSet qTriangulate(const qreal *polygon,
QTriangleSet qTriangulate(const QVectorPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QTriangleSet triangleSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.triangulate();
@@ -3059,10 +3054,8 @@ QTriangleSet qTriangulate(const QVectorPath &path,
QTriangleSet qTriangulate(const QPainterPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QTriangleSet triangleSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.triangulate();
@@ -3081,10 +3074,8 @@ QTriangleSet qTriangulate(const QPainterPath &path,
QPolylineSet qPolyline(const QVectorPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QPolylineSet polyLineSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.polyline();
@@ -3103,10 +3094,8 @@ QPolylineSet qPolyline(const QVectorPath &path,
QPolylineSet qPolyline(const QPainterPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QPolylineSet polyLineSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.polyline();
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 7f25887..62eff6e 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -5292,6 +5292,12 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions()
#if defined(QT_OPENGL_ES)
if (extensions.match("GL_OES_packed_depth_stencil"))
glExtensions |= PackedDepthStencil;
+ if (extensions.match("GL_OES_element_index_uint"))
+ glExtensions |= ElementIndexUint;
+ if (extensions.match("GL_OES_depth24"))
+ glExtensions |= Depth24;
+#else
+ glExtensions |= ElementIndexUint;
#endif
if (extensions.match("GL_ARB_framebuffer_object")) {
// ARB_framebuffer_object also includes EXT_framebuffer_blit.
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 387c8f7..6c494ee 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -284,7 +284,9 @@ public:
DDSTextureCompression = 0x00008000,
ETC1TextureCompression = 0x00010000,
PVRTCTextureCompression = 0x00020000,
- FragmentShader = 0x00040000
+ FragmentShader = 0x00040000,
+ ElementIndexUint = 0x00080000,
+ Depth24 = 0x00100000
};
Q_DECLARE_FLAGS(Extensions, Extension)
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index e81e849..a35ad87 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -346,17 +346,6 @@ struct QGLExtensionFuncs
qt_glEGLImageTargetTexture2DOES = 0;
qt_glEGLImageTargetRenderbufferStorageOES = 0;
#endif
-
- // OES_element_index_uint
-#if !defined(QT_OPENGL_ES)
- qt_glSupportsElementIndexUint = true;
-#else
- QString extensions = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
- if (extensions.contains("GL_OES_element_index_uint"))
- qt_glSupportsElementIndexUint = true;
- else
- qt_glSupportsElementIndexUint = false;
-#endif
}
@@ -483,8 +472,6 @@ struct QGLExtensionFuncs
_glEGLImageTargetTexture2DOES qt_glEGLImageTargetTexture2DOES;
_glEGLImageTargetRenderbufferStorageOES qt_glEGLImageTargetRenderbufferStorageOES;
#endif
-
- bool qt_glSupportsElementIndexUint;
};
@@ -576,6 +563,14 @@ struct QGLExtensionFuncs
#define GL_TEXTURE1 0x84C1
#endif
+#ifndef GL_DEPTH_COMPONENT16
+#define GL_DEPTH_COMPONENT16 0x81A5
+#endif
+
+#ifndef GL_DEPTH_COMPONENT24_OES
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif
+
#ifndef GL_EXT_framebuffer_object
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
@@ -883,8 +878,6 @@ struct QGLExtensionFuncs
#define glEGLImageTargetRenderbufferStorageOES QGLContextPrivate::extensionFuncs(ctx).qt_glEGLImageTargetRenderbufferStorageOES
#endif
-#define glSupportsElementIndexUint QGLContextPrivate::extensionFuncs(ctx).qt_glSupportsElementIndexUint
-
extern bool qt_resolve_framebufferobject_extensions(QGLContext *ctx);
bool qt_resolve_buffer_extensions(QGLContext *ctx);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 6c9b288..3ccefbf 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -508,17 +508,26 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
Q_ASSERT(glIsRenderbuffer(depth_buffer));
if (samples != 0 && glRenderbufferStorageMultisampleEXT) {
#ifdef QT_OPENGL_ES
-#define GL_DEPTH_COMPONENT16 0x81A5
- glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples,
- GL_DEPTH_COMPONENT16, size.width(), size.height());
+ if (QGLExtensions::glExtensions() & QGLExtensions::Depth24) {
+ glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples,
+ GL_DEPTH_COMPONENT24_OES, size.width(), size.height());
+ } else {
+ glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples,
+ GL_DEPTH_COMPONENT16, size.width(), size.height());
+ }
#else
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples,
GL_DEPTH_COMPONENT, size.width(), size.height());
#endif
} else {
#ifdef QT_OPENGL_ES
-#define GL_DEPTH_COMPONENT16 0x81A5
- glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, size.width(), size.height());
+ if (QGLExtensions::glExtensions() & QGLExtensions::Depth24) {
+ glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24_OES,
+ size.width(), size.height());
+ } else {
+ glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
+ size.width(), size.height());
+ }
#else
glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, size.width(), size.height());
#endif
@@ -1162,8 +1171,8 @@ void QGLFramebufferObject::drawTexture(const QPointF &point, QMacCompatGLuint te
}
#endif
-extern int qt_defaultDpiX();
-extern int qt_defaultDpiY();
+Q_DECL_IMPORT extern int qt_defaultDpiX();
+Q_DECL_IMPORT extern int qt_defaultDpiY();
/*! \reimp */
int QGLFramebufferObject::metric(PaintDeviceMetric metric) const
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 994947b..3992f34 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -416,8 +416,8 @@ QPaintEngine *QGLPixelBuffer::paintEngine() const
#endif
}
-extern int qt_defaultDpiX();
-extern int qt_defaultDpiY();
+Q_DECL_IMPORT extern int qt_defaultDpiX();
+Q_DECL_IMPORT extern int qt_defaultDpiY();
/*! \reimp */
int QGLPixelBuffer::metric(PaintDeviceMetric metric) const
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index bfa5ef1..74018cd 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -63,8 +63,8 @@
QT_BEGIN_NAMESPACE
// qpixmapfilter.cpp
-void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
-QImage qt_halfScaled(const QImage &source);
+Q_DECL_IMPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
+Q_DECL_IMPORT QImage qt_halfScaled(const QImage &source);
void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const
{
@@ -436,7 +436,7 @@ static inline uint nextMultiple(uint x, uint multiplier)
return x + multiplier - mod;
}
-void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
+Q_DECL_IMPORT void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
quint32 *dest, int dstStride);
bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 2f17aa6..74b6b9a 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -79,7 +79,7 @@
QT_BEGIN_NAMESPACE
-extern QImage qt_imageForBrush(int brushStyle, bool invert); //in qbrush.cpp
+Q_DECL_IMPORT extern QImage qt_imageForBrush(int brushStyle, bool invert); //in qbrush.cpp
#ifdef QT_MAC_USE_COCOA
extern void *qt_current_nsopengl_context(); // qgl_mac.mm
#endif
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 89000bb..cd7f0c2 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -739,8 +739,8 @@ QGLTexture* QGLPixmapData::texture() const
return &m_texture;
}
-extern int qt_defaultDpiX();
-extern int qt_defaultDpiY();
+Q_DECL_IMPORT extern int qt_defaultDpiX();
+Q_DECL_IMPORT extern int qt_defaultDpiY();
int QGLPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
{
diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h
index f000993..c0b223f 100644
--- a/src/opengl/qpixmapdata_gl_p.h
+++ b/src/opengl/qpixmapdata_gl_p.h
@@ -169,6 +169,7 @@ private:
friend class QGLPixmapGLPaintDevice;
friend class QMeeGoPixmapData;
+ friend class QMeeGoLivePixmapData;
};
QT_END_NAMESPACE