summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-08-29 14:13:08 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-08-29 14:39:07 +0200
commitcf9a304e6e3134421b8268bf8e75dc46b3d044c2 (patch)
tree17a7587d9d42eedd8f1655048b6dc8da03383d76 /src/gui/opengl
parentc1ccf6922637952f749cc2d67fbc07f9ab340b33 (diff)
Build on Windows/clean build on Linux.
Change-Id: I26552e85a8e8c63002db93b7d9b645981620f0af Reviewed-on: http://codereview.qt.nokia.com/3738 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r--src/gui/opengl/opengl.pri6
-rw-r--r--src/gui/opengl/qopengl.h3
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage_p.h1
-rw-r--r--src/gui/opengl/qopenglextensions_p.h13
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp2
-rw-r--r--src/gui/opengl/qpaintengineex_opengl2.cpp22
-rw-r--r--src/gui/opengl/qtextureglyphcache_gl_p.h5
-rw-r--r--src/gui/opengl/qtriangulator.cpp4
-rw-r--r--src/gui/opengl/qtriangulator_p.h4
10 files changed, 36 insertions, 26 deletions
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index 0401769ceb..87b8d80d4b 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -24,7 +24,8 @@ HEADERS += opengl/qopengl.h \
opengl/qrbtree_p.h \
opengl/qtextureglyphcache_gl_p.h \
opengl/qopenglshadercache_p.h \
- opengl/qopenglshadercache_meego_p.h
+ opengl/qopenglshadercache_meego_p.h \
+ opengl/qopenglcolormap.h
SOURCES += opengl/qopengl.cpp \
opengl/qopenglfunctions.cpp \
@@ -39,6 +40,7 @@ SOURCES += opengl/qopengl.cpp \
opengl/qopenglcustomshaderstage.cpp \
opengl/qtriangulatingstroker.cpp \
opengl/qtriangulator.cpp \
- opengl/qtextureglyphcache_gl.cpp
+ opengl/qtextureglyphcache_gl.cpp \
+ opengl/qopenglcolormap.cpp
#INCLUDEPATH += ../3rdparty/harfbuzz/src
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 7d75794956..cef4277d6b 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -63,6 +63,9 @@ typedef GLfloat GLdouble;
# if defined(Q_OS_MAC)
# include <OpenGL/gl.h>
# else
+# if defined(Q_OS_WIN)
+# include <QtCore/qt_windows.h>
+# endif
# include <GL/gl.h>
# endif
#endif
diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h
index 36ad307848..de459c0050 100644
--- a/src/gui/opengl/qopenglcustomshaderstage_p.h
+++ b/src/gui/opengl/qopenglcustomshaderstage_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+class QPainter;
class QOpenGLCustomShaderStagePrivate;
class Q_GUI_EXPORT QOpenGLCustomShaderStage
{
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index a4d88a059e..65d92e3a65 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -72,7 +72,7 @@ typedef ptrdiff_t GLsizeiptrARB;
typedef char GLchar;
#endif
-struct QOpenGLExtensionsPrivate;
+class QOpenGLExtensionsPrivate;
class Q_GUI_EXPORT QOpenGLExtensions : public QOpenGLFunctions
{
@@ -122,7 +122,7 @@ public:
GLenum internalFormat,
GLsizei width, GLsizei height);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
+ void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
private:
static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; }
@@ -130,9 +130,10 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLExtensions::OpenGLExtensions)
-struct QOpenGLExtensionsPrivate : public QOpenGLFunctionsPrivate
+class QOpenGLExtensionsPrivate : public QOpenGLFunctionsPrivate
{
- QOpenGLExtensionsPrivate(QOpenGLContext *ctx);
+public:
+ explicit QOpenGLExtensionsPrivate(QOpenGLContext *ctx);
GLvoid* (QOPENGLF_APIENTRYP MapBuffer)(GLenum target, GLenum access);
GLboolean (QOPENGLF_APIENTRYP UnmapBuffer)(GLenum target);
@@ -142,7 +143,7 @@ struct QOpenGLExtensionsPrivate : public QOpenGLFunctionsPrivate
void (QOPENGLF_APIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples,
GLenum internalFormat,
GLsizei width, GLsizei height);
- void (QOPENGLF_APIENTRYP GetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
+ void (QOPENGLF_APIENTRYP GetBufferSubData)(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
};
inline GLvoid *QOpenGLExtensions::glMapBuffer(GLenum target, GLenum access)
@@ -183,7 +184,7 @@ inline void QOpenGLExtensions::glRenderbufferStorageMultisample(GLenum target, G
Q_OPENGL_FUNCTIONS_DEBUG
}
-inline void QOpenGLExtensions::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
+inline void QOpenGLExtensions::glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data)
{
Q_D(QOpenGLExtensions);
Q_ASSERT(QOpenGLExtensions::isInitialized(d));
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 4ef80bfa89..3947df4fc4 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -2332,7 +2332,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveRenderbufferStorageMultisample(GLen
(target, samples, internalFormat, width, height);
}
-static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
+static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data)
{
RESOLVE_FUNC_VOID(ResolveEXT, GetBufferSubData)
(target, offset, size, data);
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index e8baf11db8..715b6ead2f 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -47,6 +47,8 @@
#include <QtCore/qfile.h>
#include <QtCore/qvarlengtharray.h>
#include <QtCore/qvector.h>
+#include <QtGui/qtransform.h>
+#include <QtGui/QColor>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qpaintengineex_opengl2.cpp b/src/gui/opengl/qpaintengineex_opengl2.cpp
index 7bdac27336..13d5ece2c8 100644
--- a/src/gui/opengl/qpaintengineex_opengl2.cpp
+++ b/src/gui/opengl/qpaintengineex_opengl2.cpp
@@ -122,7 +122,7 @@ QOpenGL2PaintEngineExPrivate::~QOpenGL2PaintEngineExPrivate()
void QOpenGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id)
{
-// glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit?
+// funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit?
if (id != GLuint(-1) && id == lastTextureUsed)
return;
@@ -196,7 +196,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
// Get the image data for the pattern
QImage texImage = qt_imageForBrush(style, false);
- glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
+ funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
//ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, QOpenGLContext::InternalBindOption);
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
}
@@ -209,7 +209,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
// for opacity to the cache.
GLuint texId = QOpenGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0);
- glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
+ funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
glBindTexture(GL_TEXTURE_2D, texId);
if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient)
@@ -226,7 +226,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
if (currentBrushPixmap.width() > max_texture_size || currentBrushPixmap.height() > max_texture_size)
currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
- glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
+ funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
QOpenGLTexture *tex = 0;//ctx->d_func()->bindTexture(currentBrushPixmap, GL_TEXTURE_2D, GL_RGBA,
// QOpenGLContext::InternalBindOption |
// QOpenGLContext::CanFlipNativePixmapBindOption);
@@ -582,7 +582,7 @@ void QOpenGL2PaintEngineEx::beginNativePainting()
void QOpenGL2PaintEngineExPrivate::resetGLState()
{
glDisable(GL_BLEND);
- glActiveTexture(GL_TEXTURE0);
+ funcs.glActiveTexture(GL_TEXTURE0);
glDisable(GL_STENCIL_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
@@ -1356,7 +1356,7 @@ void QOpenGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixma
ensureActive();
d->transferMode(ImageDrawingMode);
- glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
+ d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
QOpenGLTexture *texture = 0;
// ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, bindOptions);
@@ -1392,7 +1392,7 @@ void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, c
ensureActive();
d->transferMode(ImageDrawingMode);
- glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
+ d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
QOpenGLTexture *texture = 0;//ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, bindOptions);
GLuint id = texture->id();
@@ -1731,7 +1731,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
glEnable(GL_BLEND);
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
- glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
+ funcs.glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
} else {
// Other brush styles need two passes.
@@ -1748,7 +1748,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
- glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
+ funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
glBindTexture(GL_TEXTURE_2D, cache->texture());
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false);
@@ -1783,7 +1783,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
QOpenGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QOpenGLTextureGlyphCache::Linear:QOpenGLTextureGlyphCache::Nearest;
if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) {
- glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
+ funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
if (lastMaskTextureUsed != cache->texture()) {
glBindTexture(GL_TEXTURE_2D, cache->texture());
lastMaskTextureUsed = cache->texture();
@@ -1903,7 +1903,7 @@ void QOpenGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFra
allOpaque &= (opacity >= 0.99f);
}
- glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
+ funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
QOpenGLTexture *texture = 0;//ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA,
// QOpenGLContext::InternalBindOption
// | QOpenGLContext::CanFlipNativePixmapBindOption);
diff --git a/src/gui/opengl/qtextureglyphcache_gl_p.h b/src/gui/opengl/qtextureglyphcache_gl_p.h
index cf157e07df..d8f10d12ba 100644
--- a/src/gui/opengl/qtextureglyphcache_gl_p.h
+++ b/src/gui/opengl/qtextureglyphcache_gl_p.h
@@ -64,9 +64,10 @@ QT_BEGIN_NAMESPACE
class QOpenGL2PaintEngineExPrivate;
-struct QOpenGLGlyphTexture : public QOpenGLSharedResource
+class QOpenGLGlyphTexture : public QOpenGLSharedResource
{
- QOpenGLGlyphTexture(QOpenGLContext *ctx)
+public:
+ explicit QOpenGLGlyphTexture(QOpenGLContext *ctx)
: QOpenGLSharedResource(ctx->shareGroup())
, m_width(0)
, m_height(0)
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp
index dbbae4d938..d66b2ac9a5 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/opengl/qtriangulator.cpp
@@ -2508,7 +2508,7 @@ void QTriangulator<T>::MonotoneToTriangles::decompose()
// qTriangulate //
//============================================================================//
-QTriangleSet qTriangulate(const qreal *polygon,
+Q_GUI_EXPORT QTriangleSet qTriangulate(const qreal *polygon,
int count, uint hint, const QTransform &matrix)
{
QTriangleSet triangleSet;
@@ -2531,7 +2531,7 @@ QTriangleSet qTriangulate(const qreal *polygon,
return triangleSet;
}
-QTriangleSet qTriangulate(const QVectorPath &path,
+Q_GUI_EXPORT QTriangleSet qTriangulate(const QVectorPath &path,
const QTransform &matrix, qreal lod)
{
QTriangleSet triangleSet;
diff --git a/src/gui/opengl/qtriangulator_p.h b/src/gui/opengl/qtriangulator_p.h
index 192bd9cb19..8f95d58e23 100644
--- a/src/gui/opengl/qtriangulator_p.h
+++ b/src/gui/opengl/qtriangulator_p.h
@@ -137,8 +137,8 @@ struct Q_GUI_EXPORT QPolylineSet
// integers, the polygon is triangulated, and then scaled back by 1/32.
// 'hint' should be a combination of QVectorPath::Hints.
// 'lod' is the level of detail. Default is 1. Curves are split into more lines when 'lod' is higher.
-QTriangleSet qTriangulate(const qreal *polygon, int count, uint hint = QVectorPath::PolygonHint | QVectorPath::OddEvenFill, const QTransform &matrix = QTransform());
-QTriangleSet qTriangulate(const QVectorPath &path, const QTransform &matrix = QTransform(), qreal lod = 1);
+QTriangleSet Q_GUI_EXPORT qTriangulate(const qreal *polygon, int count, uint hint = QVectorPath::PolygonHint | QVectorPath::OddEvenFill, const QTransform &matrix = QTransform());
+QTriangleSet Q_GUI_EXPORT qTriangulate(const QVectorPath &path, const QTransform &matrix = QTransform(), qreal lod = 1);
QTriangleSet Q_GUI_EXPORT qTriangulate(const QPainterPath &path, const QTransform &matrix = QTransform(), qreal lod = 1);
QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix = QTransform(), qreal lod = 1);
QPolylineSet Q_GUI_EXPORT qPolyline(const QPainterPath &path, const QTransform &matrix = QTransform(), qreal lod = 1);