Added “none” blend mode. This is equivalent to setBlendMode(“replace”, “premultiplied”) (which also effectively disables blending) but doesn’t require explicitly setting the alpha multiplication mode.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-12-28 12:32:37 -04:00
parent 4ef91ed79f
commit a78fa39113
4 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -1602,6 +1602,7 @@ void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
dstRGB = dstA = GL_ONE_MINUS_SRC_COLOR;
break;
case BLEND_REPLACE:
case BLEND_NONE:
default:
srcRGB = srcA = GL_ONE;
dstRGB = dstA = GL_ZERO;
@@ -1609,7 +1610,7 @@ void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
}
// We can only do alpha-multiplication when srcRGB would have been unmodified.
if (srcRGB == GL_ONE && alphamode == BLENDALPHA_MULTIPLY)
if (srcRGB == GL_ONE && alphamode == BLENDALPHA_MULTIPLY && mode != BLEND_NONE)
srcRGB = GL_SRC_ALPHA;
glBlendEquation(func);