From a78fa39113da9a835e29ccadbf7e6f45b173bde1 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Wed, 28 Dec 2016 12:32:37 -0400 Subject: [PATCH] =?UTF-8?q?Added=20=E2=80=9Cnone=E2=80=9D=20blend=20mode.?= =?UTF-8?q?=20This=20is=20equivalent=20to=20setBlendMode(=E2=80=9Creplace?= =?UTF-8?q?=E2=80=9D,=20=E2=80=9Cpremultiplied=E2=80=9D)=20(which=20also?= =?UTF-8?q?=20effectively=20disables=20blending)=20but=20doesn=E2=80=99t?= =?UTF-8?q?=20require=20explicitly=20setting=20the=20alpha=20multiplicatio?= =?UTF-8?q?n=20mode.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : minor --- platform/xcode/macosx/love-macosx.plist | 4 ++-- src/modules/graphics/Graphics.cpp | 1 + src/modules/graphics/Graphics.h | 1 + src/modules/graphics/opengl/Graphics.cpp | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/xcode/macosx/love-macosx.plist b/platform/xcode/macosx/love-macosx.plist index 386742df1..9357ab49f 100644 --- a/platform/xcode/macosx/love-macosx.plist +++ b/platform/xcode/macosx/love-macosx.plist @@ -69,12 +69,12 @@ public.app-category.games NSHighResolutionCapable - NSSupportsAutomaticGraphicsSwitching - NSHumanReadableCopyright © 2006-2016 LÖVE Development Team NSPrincipalClass NSApplication + NSSupportsAutomaticGraphicsSwitching + UTExportedTypeDeclarations diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index 3f40823d2..6a78c0a73 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -610,6 +610,7 @@ StringMap::Entry Graphics::blendM { "darken", BLEND_DARKEN }, { "screen", BLEND_SCREEN }, { "replace", BLEND_REPLACE }, + { "none", BLEND_NONE }, }; StringMap Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries)); diff --git a/src/modules/graphics/Graphics.h b/src/modules/graphics/Graphics.h index 4d17219b4..6b63c9c06 100644 --- a/src/modules/graphics/Graphics.h +++ b/src/modules/graphics/Graphics.h @@ -97,6 +97,7 @@ public: BLEND_DARKEN, BLEND_SCREEN, BLEND_REPLACE, + BLEND_NONE, BLEND_MAX_ENUM }; diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index ab1dc99af..ec62a39a6 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -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);