summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/opengl/gdiimpl.cxx9
-rw-r--r--vcl/opengl/maskFragmentShader.glsl10
2 files changed, 11 insertions, 8 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index c317d4c07835..187458bece73 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -406,7 +406,7 @@ bool OpenGLSalGraphicsImpl::CreateMaskProgram( void )
glBindAttribLocation( mnMaskProgram, GL_ATTRIB_POS, "position" );
glBindAttribLocation( mnMaskProgram, GL_ATTRIB_TEX, "tex_coord_in" );
mnMaskUniform = glGetUniformLocation( mnMaskProgram, "sampler" );
- mnMaskColorUniform = glGetUniformLocation( mnMaskProgram, "mask" );
+ mnMaskColorUniform = glGetUniformLocation( mnMaskProgram, "color" );
CHECK_GL_ERROR();
return true;
@@ -844,7 +844,7 @@ void OpenGLSalGraphicsImpl::DrawTextureWithMask( OpenGLTexture& rTexture, OpenGL
CHECK_GL_ERROR();
}
-void OpenGLSalGraphicsImpl::DrawMask( OpenGLTexture& rMask, SalColor nMaskColor, const SalTwoRect& /*pPosAry*/ )
+void OpenGLSalGraphicsImpl::DrawMask( OpenGLTexture& rMask, SalColor nMaskColor, const SalTwoRect& pPosAry )
{
if( mnMaskProgram == 0 )
{
@@ -858,7 +858,10 @@ void OpenGLSalGraphicsImpl::DrawMask( OpenGLTexture& rMask, SalColor nMaskColor,
glActiveTexture( GL_TEXTURE0 );
rMask.Bind();
- //DrawTextureRect( rMask, pPosAry );
+ glEnable( GL_BLEND );
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ DrawTextureRect( rMask, pPosAry );
+ glDisable( GL_BLEND );
rMask.Unbind();
glUseProgram( 0 );
diff --git a/vcl/opengl/maskFragmentShader.glsl b/vcl/opengl/maskFragmentShader.glsl
index 4a8204e6a663..2cc737759ab0 100644
--- a/vcl/opengl/maskFragmentShader.glsl
+++ b/vcl/opengl/maskFragmentShader.glsl
@@ -7,15 +7,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-precision mediump float;
varying vec2 tex_coord;
uniform sampler2D sampler;
-uniform vec4 color;"
+uniform vec4 color;
void main() {
- vec4 texel0;
- texel0 = texture2D(sampler, tex_coord);
- gl_FragColor = color * texel0.a;
+ vec4 texel0;
+ texel0 = texture2D(sampler, tex_coord);
+ gl_FragColor = color;
+ gl_FragColor.a = 1.0 - texel0.r;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */