MYST3: Remove unneeded use of Graphics::ColorMasks

This commit is contained in:
Cameron Cawley 2021-04-18 17:14:54 +01:00 committed by Eugene Sandulenko
parent 780c4568c1
commit f9dc98b0f6
13 changed files with 13 additions and 32 deletions

View File

@ -125,7 +125,7 @@ public:
virtual Texture *createTexture(const Graphics::Surface *surface) = 0;
virtual void freeTexture(Texture *texture) = 0;
virtual void drawRect2D(const Common::Rect &rect, uint32 color) = 0;
virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) = 0;
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
float transparency = -1.0, bool additiveBlending = false) = 0;
virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,

View File

@ -25,7 +25,6 @@
#if defined(USE_OPENGL_GAME) && !defined(USE_GLES2)
#include "graphics/colormasks.h"
#include "graphics/opengl/context.h"
#include "graphics/surface.h"
@ -130,10 +129,7 @@ void OpenGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
}
}
void OpenGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
uint8 a, r, g, b;
Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);
void OpenGLRenderer::drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) {
glDisable(GL_TEXTURE_2D);
glColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0);

View File

@ -44,7 +44,7 @@ public:
Texture *createTexture(const Graphics::Surface *surface) override;
void freeTexture(Texture *texture) override;
virtual void drawRect2D(const Common::Rect &rect, uint32 color) override;
virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) override;
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
float transparency = -1.0, bool additiveBlending = false) override;
virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,

View File

@ -41,7 +41,6 @@
#if defined(USE_GLES2) || defined(USE_OPENGL_SHADERS)
#include "graphics/colormasks.h"
#include "graphics/surface.h"
#include "math/glmath.h"
@ -187,10 +186,7 @@ void ShaderRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
}
}
void ShaderRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
uint8 a, r, g, b;
Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);
void ShaderRenderer::drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) {
_boxShader->use();
_boxShader->setUniform("textured", false);
_boxShader->setUniform("color", Math::Vector4d(r / 255.0, g / 255.0, b / 255.0, a / 255.0));

View File

@ -45,7 +45,7 @@ public:
virtual Texture *createTexture(const Graphics::Surface *surface) override;
virtual void freeTexture(Texture *texture) override;
virtual void drawRect2D(const Common::Rect &rect, uint32 color) override;
virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) override;
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
float transparency = -1.0, bool additiveBlending = false) override;
virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,

View File

@ -24,7 +24,6 @@
#include "common/rect.h"
#include "common/textconsole.h"
#include "graphics/colormasks.h"
#include "graphics/surface.h"
#include "math/vector2d.h"
@ -135,10 +134,7 @@ void TinyGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
}
}
void TinyGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
uint8 a, r, g, b;
Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);
void TinyGLRenderer::drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) {
tglDisable(TGL_TEXTURE_2D);
tglColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0);

View File

@ -45,7 +45,7 @@ public:
Texture *createTexture(const Graphics::Surface *surface) override;
void freeTexture(Texture *texture) override;
virtual void drawRect2D(const Common::Rect &rect, uint32 color) override;
virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) override;
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
float transparency = -1.0, bool additiveBlending = false) override;
virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,

View File

@ -70,7 +70,7 @@ void Inventory::draw() {
if (_vm->isWideScreenModEnabled()) {
// Draw a black background to cover the main game frame
Common::Rect screen = _vm->_gfx->viewport();
_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF000000);
_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF, 0x00, 0x00, 0x00);
}
uint16 hoveredItemVar = hoveredItem();

View File

@ -32,8 +32,6 @@
#include "common/events.h"
#include "graphics/colormasks.h"
#include "gui/message.h"
namespace Myst3 {

View File

@ -29,8 +29,6 @@
#include "common/config-manager.h"
#include "graphics/colormasks.h"
namespace Myst3 {
Movie::Movie(Myst3Engine *vm, uint16 id) :

View File

@ -29,8 +29,6 @@
#include "engines/myst3/node.h"
#include "engines/myst3/state.h"
#include "graphics/colormasks.h"
#include "math/vector2d.h"
namespace Myst3 {
@ -106,12 +104,12 @@ void Scene::drawSunspotFlare(const SunSpot &s) {
Common::Rect frame = Common::Rect(Renderer::kOriginalWidth, Renderer::kFrameHeight);
uint8 a = (uint8)(s.intensity * s.radius);
uint8 r, g, b;
Graphics::colorToRGB< Graphics::ColorMasks<888> >(s.color, r, g, b);
uint32 color = Graphics::ARGBToColor< Graphics::ColorMasks<8888> >(a, r, g, b);
uint8 r = (s.color >> 16) & 0xFF;
uint8 g = (s.color >> 8) & 0xFF;
uint8 b = (s.color >> 0) & 0xFF;
_vm->_gfx->selectTargetWindow(this, false, true);
_vm->_gfx->drawRect2D(frame, color);
_vm->_gfx->drawRect2D(frame, a, r, g, b);
}

View File

@ -483,7 +483,7 @@ void Subtitles::drawOverlay() {
if (_vm->isWideScreenModEnabled()) {
// Draw a black background to cover the main game frame
_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF000000);
_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF, 0x00, 0x00, 0x00);
// Center the subtitles in the screen
bottomBorder.translate((screen.width() - Renderer::kOriginalWidth) / 2, 0);

View File

@ -27,7 +27,6 @@
#include "engines/myst3/sound.h"
#include "engines/myst3/state.h"
#include "graphics/colormasks.h"
#include "graphics/surface.h"
namespace Myst3 {