diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-04 11:47:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2014-10-27 11:54:39 +0100 |
commit | 5adbb9cc576546c42249099e549f1947cca54610 (patch) | |
tree | 0454a5e9ff21651fe4bc1fac6ab7424914d53a3e /src/gui/opengl/qopenglengineshadersource_p.h | |
parent | da72e5538ebcc7e6008d0c4b3538d2a994f02a7e (diff) |
Support Alpha8 and Grayscale8 natively in the OpenGL paint engine
Adds special shaders for the Alpha8 and Grayscale8 formats so that
they do not need to rely on the support of GL_ALPHA and GL_LUMINANCE
that has been removed from core in recent OpenGL versions.
Change-Id: Ie370379b458abf2a50e252bc5099aefc1b11fb1d
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/gui/opengl/qopenglengineshadersource_p.h')
-rw-r--r-- | src/gui/opengl/qopenglengineshadersource_p.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h index bc81fe4c77..acda09a8ee 100644 --- a/src/gui/opengl/qopenglengineshadersource_p.h +++ b/src/gui/opengl/qopenglengineshadersource_p.h @@ -367,6 +367,22 @@ static const char* const qopenglslNonPremultipliedImageSrcFragmentShader = "\n\ return sample; \n\ }\n"; +static const char* const qopenglslGrayscaleImageSrcFragmentShader = "\n\ + varying highp vec2 textureCoords; \n\ + uniform sampler2D imageTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + return texture2D(imageTexture, textureCoords).rrra; \n\ + }\n"; + +static const char* const qopenglslAlphaImageSrcFragmentShader = "\n\ + varying highp vec2 textureCoords; \n\ + uniform sampler2D imageTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + return vec4(0, 0, 0, texture2D(imageTexture, textureCoords).r); \n\ + }\n"; + static const char* const qopenglslShockingPinkSrcFragmentShader = "\n\ lowp vec4 srcPixel() \n\ { \n\ |