summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-09-29 15:08:41 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-10-02 15:57:17 (GMT)
commit385176ad28b3a79bcd196d2d529c4bf7abd4fcc0 (patch)
treee50e39712472bc672308dac1770261587b3f98b6 /src/opengl/gl2paintengineex/qglengineshadermanager_p.h
parent4f7d94ca73556f3a40631ad07f565995f6f85176 (diff)
downloadQt-385176ad28b3a79bcd196d2d529c4bf7abd4fcc0.zip
Qt-385176ad28b3a79bcd196d2d529c4bf7abd4fcc0.tar.gz
Qt-385176ad28b3a79bcd196d2d529c4bf7abd4fcc0.tar.bz2
Added support for drawing a pixmap multiple times in one call.
This is internal API. It's possible to specify a horizontal and vertical scale, rotation, opacity and source rectangle for each pixmap item. Useful for particle effects. Reviewed-by: Trond
Diffstat (limited to 'src/opengl/gl2paintengineex/qglengineshadermanager_p.h')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index fbb6d9c..291d24c 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -247,6 +247,7 @@ struct QGLEngineShaderProg
QVector<uint> uniformLocations;
bool useTextureCoords;
+ bool useOpacityAttribute;
bool operator==(const QGLEngineShaderProg& other) {
// We don't care about the program
@@ -277,6 +278,7 @@ struct QGLEngineCachedShaderProg
static const GLuint QT_VERTEX_COORDS_ATTR = 0;
static const GLuint QT_TEXTURE_COORDS_ATTR = 1;
+static const GLuint QT_OPACITY_ATTR = 2;
class QGLEngineSharedShaders : public QObject
{
@@ -285,6 +287,7 @@ public:
enum ShaderName {
MainVertexShader,
MainWithTexCoordsVertexShader,
+ MainWithTexCoordsAndOpacityVertexShader,
UntransformedPositionVertexShader,
PositionOnlyVertexShader,
@@ -307,6 +310,7 @@ public:
MainFragmentShader_C,
MainFragmentShader_O,
MainFragmentShader,
+ MainFragmentShader_ImageArrays,
ImageSrcFragmentShader,
ImageSrcWithPatternFragmentShader,
@@ -406,13 +410,19 @@ public:
NumUniforms
};
+ enum OpacityMode {
+ NoOpacity,
+ UniformOpacity,
+ AttributeOpacity
+ };
+
// There are optimisations we can do, depending on the brush transform:
// 1) May not have to apply perspective-correction
// 2) Can use lower precision for matrix
void optimiseForBrushTransform(const QTransform &transform);
void setSrcPixelType(Qt::BrushStyle);
void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images
- void setUseGlobalOpacity(bool);
+ void setOpacityMode(OpacityMode);
void setMaskType(MaskType);
void setCompositionMode(QPainter::CompositionMode);
void setCustomStage(QGLCustomShaderStage* stage);
@@ -451,7 +461,7 @@ private:
// Current state variables which influence the choice of shader:
QTransform brushTransform;
int srcPixelType;
- bool useGlobalOpacity;
+ OpacityMode opacityMode;
MaskType maskType;
QPainter::CompositionMode compositionMode;
QGLCustomShaderStage* customSrcStage;