diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2014-12-02 16:41:02 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-12-03 14:05:36 +0100 |
commit | edbdaf07d9b7a9304294c8ed650ed85f81b52e14 (patch) | |
tree | 022f1dbb9068052e3e3420e17fe4722079d2e0a9 /vcl/opengl/program.cxx | |
parent | cf3ba3561522cba179ab602b257df902d6d5d110 (diff) |
vcl: Implement bitmap color replacement operation in OpenGL backend
Change-Id: Ia86b67e92985eeb4fb2a5f6cd74c65fab2ac5566
Diffstat (limited to 'vcl/opengl/program.cxx')
-rw-r--r-- | vcl/opengl/program.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vcl/opengl/program.cxx b/vcl/opengl/program.cxx index 320b06f067a4..8b92c4bebb26 100644 --- a/vcl/opengl/program.cxx +++ b/vcl/opengl/program.cxx @@ -126,6 +126,12 @@ GLuint OpenGLProgram::GetUniformLocation( const OString& rName ) return it->second; } +void OpenGLProgram::SetUniform1f( const OString& rName, GLfloat v1 ) +{ + GLuint nUniform = GetUniformLocation( rName ); + glUniform1f( nUniform, v1 ); +} + void OpenGLProgram::SetUniform2f( const OString& rName, GLfloat v1, GLfloat v2 ) { GLuint nUniform = GetUniformLocation( rName ); @@ -170,6 +176,19 @@ void OpenGLProgram::SetColorf( const OString& rName, SalColor nColor, double fTr SetBlendMode( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); } +void OpenGLProgram::SetColor( const OString& rName, const Color& rColor ) +{ + GLuint nUniform = GetUniformLocation( rName ); + glUniform4f( nUniform, + ((float) rColor.GetRed()) / 255, + ((float) rColor.GetGreen()) / 255, + ((float) rColor.GetBlue()) / 255, + 1.0f - ((float) rColor.GetTransparency()) / 255 ); + + if( rColor.GetTransparency() > 0 ) + SetBlendMode( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); +} + void OpenGLProgram::SetColorWithIntensity( const OString& rName, const Color& rColor, long nFactor ) { GLuint nUniform = GetUniformLocation( rName ); |