[gdx] Minor cleanup for PMA tint black.

#1003
This commit is contained in:
Nathan Sweet 2017-09-30 14:40:13 +02:00
parent 3f242450cf
commit 8ab5ad4b6c

View File

@ -240,7 +240,7 @@ public class SkeletonRenderer {
if (vertexEffect != null) vertexEffect.begin(skeleton); if (vertexEffect != null) vertexEffect.begin(skeleton);
boolean premultipliedAlpha = this.premultipliedAlpha; boolean premultipliedAlpha = this.premultipliedAlpha;
int darkPremultipliedAlpha = (premultipliedAlpha ? 255 : 0) << 24; int darkAlpha = (premultipliedAlpha ? 255 : 0) << 24;
BlendMode blendMode = null; BlendMode blendMode = null;
int verticesLength = 0; int verticesLength = 0;
float[] vertices = null, uvs = null; float[] vertices = null, uvs = null;
@ -288,16 +288,19 @@ public class SkeletonRenderer {
Color lightColor = slot.getColor(); Color lightColor = slot.getColor();
float alpha = a * lightColor.a * color.a * 255; float alpha = a * lightColor.a * color.a * 255;
float multiplier = premultipliedAlpha ? alpha : 255; float multiplier = premultipliedAlpha ? alpha : 255;
float red = r * color.r * multiplier;
float green = g * color.g * multiplier;
float blue = b * color.b * multiplier;
float light = NumberUtils.intToFloatColor(((int)alpha << 24) // float light = NumberUtils.intToFloatColor(((int)alpha << 24) //
| ((int)(b * lightColor.b * color.b * multiplier) << 16) // | ((int)(blue * lightColor.b) << 16) //
| ((int)(g * lightColor.g * color.g * multiplier) << 8) // | ((int)(green * lightColor.g) << 8) //
| (int)(r * lightColor.r * color.r * multiplier)); | (int)(red * lightColor.r));
Color darkColor = slot.getDarkColor(); Color darkColor = slot.getDarkColor();
if (darkColor == null) darkColor = Color.BLACK; float dark = darkColor == null ? 0
float dark = darkColor == null ? 0 : NumberUtils.intToFloatColor(darkPremultipliedAlpha // : NumberUtils.intToFloatColor(darkAlpha //
| (int)(b * darkColor.b * color.b * multiplier) << 16 // | (int)(blue * darkColor.b) << 16 //
| (int)(g * darkColor.g * color.g * multiplier) << 8 // | (int)(green * darkColor.g) << 8 //
| (int)(r * darkColor.r * color.r * multiplier)); | (int)(red * darkColor.r));
BlendMode slotBlendMode = slot.data.getBlendMode(); BlendMode slotBlendMode = slot.data.getBlendMode();
if (slotBlendMode != blendMode) { if (slotBlendMode != blendMode) {