From 369332e464cda947470c90bfa9f804543bc0e8c8 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier Date: Mon, 25 Jul 2016 04:20:38 +0200 Subject: [PATCH] TINYGL: Treat alpha the same way as other color components. When kLightsMode (aka kInterpRGB) is false, "a" is always 0 (vertice data is not used in caller in corresponding branches), so taking it into account makes all triangles transparent. This is not visible in practice, because putPixelTextureMappingPerspective is only called when (kInterpST || kInterpSTZ) is true, and kInterpRGB is always true when that's the case. But unifying color processing allows further code simplification. --- graphics/tinygl/ztriangle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/tinygl/ztriangle.cpp b/graphics/tinygl/ztriangle.cpp index 6ec10b27903..788475b1661 100644 --- a/graphics/tinygl/ztriangle.cpp +++ b/graphics/tinygl/ztriangle.cpp @@ -91,12 +91,12 @@ FORCEINLINE static void putPixelTextureMappingPerspective(FrameBuffer *buffer, i c_r = (col >> textureFormat.rShift) & 0xFF; c_g = (col >> textureFormat.gShift) & 0xFF; c_b = (col >> textureFormat.bShift) & 0xFF; - unsigned int l_a = (a / 256); - c_a = (c_a * l_a) / 256; if (kLightsMode) { + unsigned int l_a = (a / 256); unsigned int l_r = (r / 256); unsigned int l_g = (g / 256); unsigned int l_b = (b / 256); + c_a = (c_a * l_a) / 256; c_r = (c_r * l_r) / 256; c_g = (c_g * l_g) / 256; c_b = (c_b * l_b) / 256;