@@ -46,11 +46,12 @@ static inline bool isPowerOfTwo(unsigned int n) {
4646}
4747
4848static inline void bindUniformColor (int slot, uint32_t color) {
49+ const float a = ((color >> 24 ) & 0xff ) / 255 .0f ;
4950 glUniform4f (slot,
50- ((color >> 16 ) & 0xff ) / 255 .0f ,
51- ((color >> 8 ) & 0xff ) / 255 .0f ,
52- ((color ) & 0xff ) / 255 .0f ,
53- ((color >> 24 ) & 0xff ) / 255 . 0f );
51+ a * ((color >> 16 ) & 0xff ) / 255 .0f ,
52+ a * ((color >> 8 ) & 0xff ) / 255 .0f ,
53+ a * ((color ) & 0xff ) / 255 .0f ,
54+ a );
5455}
5556
5657// /////////////////////////////////////////////////////////////////////////////
@@ -154,10 +155,6 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView,
154155
155156 // Uniforms
156157 bindTexture (texture, mWrapS , mWrapT );
157- // Assume linear here; we should really check the transform in
158- // ::updateTransforms() but we don't have the texture object
159- // available at that point. The optimization is not worth the
160- // effort for now.
161158 texture->setFilter (GL_LINEAR);
162159
163160 glUniform1i (program->getUniform (" bitmapSampler" ), textureSlot);
@@ -166,14 +163,6 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView,
166163 glUniform2f (program->getUniform (" textureDimension" ), 1 .0f / width, 1 .0f / height);
167164}
168165
169- void SkiaBitmapShader::updateTransforms (Program* program, const mat4& modelView,
170- const Snapshot& snapshot) {
171- mat4 textureTransform;
172- computeScreenSpaceMatrix (textureTransform, modelView);
173- glUniformMatrix4fv (program->getUniform (" textureTransform" ), 1 ,
174- GL_FALSE, &textureTransform.data [0 ]);
175- }
176-
177166// /////////////////////////////////////////////////////////////////////////////
178167// Linear gradient shader
179168// /////////////////////////////////////////////////////////////////////////////
@@ -257,13 +246,6 @@ void SkiaLinearGradientShader::setupProgram(Program* program, const mat4& modelV
257246 glUniformMatrix4fv (program->getUniform (" screenSpace" ), 1 , GL_FALSE, &screenSpace.data [0 ]);
258247}
259248
260- void SkiaLinearGradientShader::updateTransforms (Program* program, const mat4& modelView,
261- const Snapshot& snapshot) {
262- mat4 screenSpace;
263- computeScreenSpaceMatrix (screenSpace, modelView);
264- glUniformMatrix4fv (program->getUniform (" screenSpace" ), 1 , GL_FALSE, &screenSpace.data [0 ]);
265- }
266-
267249// /////////////////////////////////////////////////////////////////////////////
268250// Circular gradient shader
269251// /////////////////////////////////////////////////////////////////////////////
@@ -384,13 +366,6 @@ void SkiaSweepGradientShader::setupProgram(Program* program, const mat4& modelVi
384366 glUniformMatrix4fv (program->getUniform (" screenSpace" ), 1 , GL_FALSE, &screenSpace.data [0 ]);
385367}
386368
387- void SkiaSweepGradientShader::updateTransforms (Program* program, const mat4& modelView,
388- const Snapshot& snapshot) {
389- mat4 screenSpace;
390- computeScreenSpaceMatrix (screenSpace, modelView);
391- glUniformMatrix4fv (program->getUniform (" screenSpace" ), 1 , GL_FALSE, &screenSpace.data [0 ]);
392- }
393-
394369// /////////////////////////////////////////////////////////////////////////////
395370// Compose shader
396371// /////////////////////////////////////////////////////////////////////////////
0 commit comments