WII: Replace use of Graphics::ColorMasks

This commit is contained in:
Cameron Cawley 2020-06-16 13:57:34 +01:00 committed by Eugene Sandulenko
parent ceed6b2c8c
commit 0a29fced6e
4 changed files with 7 additions and 37 deletions

View file

@ -67,9 +67,9 @@ OSystem_Wii::OSystem_Wii() :
_configGraphicsMode(0), _configGraphicsMode(0),
_actualGraphicsMode(0), _actualGraphicsMode(0),
_bilinearFilter(false), _bilinearFilter(false),
#ifdef USE_RGB_COLOR
_pfRGB565(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)), _pfRGB565(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)),
_pfRGB3444(Graphics::PixelFormat(2, 4, 4, 4, 3, 8, 4, 0, 12)), _pfRGB3444(Graphics::PixelFormat(2, 4, 4, 4, 3, 8, 4, 0, 12)),
#ifdef USE_RGB_COLOR
_pfGame(Graphics::PixelFormat::createFormatCLUT8()), _pfGame(Graphics::PixelFormat::createFormatCLUT8()),
_pfGameTexture(Graphics::PixelFormat::createFormatCLUT8()), _pfGameTexture(Graphics::PixelFormat::createFormatCLUT8()),
_pfCursor(Graphics::PixelFormat::createFormatCLUT8()), _pfCursor(Graphics::PixelFormat::createFormatCLUT8()),

View file

@ -84,9 +84,9 @@ private:
s32 _configGraphicsMode; s32 _configGraphicsMode;
s32 _actualGraphicsMode; s32 _actualGraphicsMode;
bool _bilinearFilter; bool _bilinearFilter;
#ifdef USE_RGB_COLOR
const Graphics::PixelFormat _pfRGB565; const Graphics::PixelFormat _pfRGB565;
const Graphics::PixelFormat _pfRGB3444; const Graphics::PixelFormat _pfRGB3444;
#ifdef USE_RGB_COLOR
Graphics::PixelFormat _pfGame; Graphics::PixelFormat _pfGame;
Graphics::PixelFormat _pfGameTexture; Graphics::PixelFormat _pfGameTexture;
Graphics::PixelFormat _pfCursor; Graphics::PixelFormat _pfCursor;

View file

@ -28,7 +28,6 @@
#include <gxflux/gfx_con.h> #include <gxflux/gfx_con.h>
#include "common/config-manager.h" #include "common/config-manager.h"
#include "graphics/colormasks.h"
#include "graphics/conversion.h" #include "graphics/conversion.h"
#include "backends/fs/wii/wii-fs-factory.h" #include "backends/fs/wii/wii-fs-factory.h"
@ -332,7 +331,7 @@ void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) {
u16 *d = _texGame.palette; u16 *d = _texGame.palette;
for (uint i = 0; i < num; ++i, s +=3) for (uint i = 0; i < num; ++i, s +=3)
d[start + i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(s[0], s[1], s[2]); d[start + i] = _pfRGB565.RGBToColor(s[0], s[1], s[2]);
gfx_tex_flush_palette(&_texGame); gfx_tex_flush_palette(&_texGame);
@ -340,7 +339,7 @@ void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) {
d = _cursorPalette; d = _cursorPalette;
for (uint i = 0; i < num; ++i, s += 3) { for (uint i = 0; i < num; ++i, s += 3) {
d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]); d[start + i] = _pfRGB3444.ARGBToColor(0xff, s[0], s[1], s[2]);
} }
if (_cursorPaletteDisabled) { if (_cursorPaletteDisabled) {
@ -363,7 +362,7 @@ void OSystem_Wii::grabPalette(byte *colors, uint start, uint num) const {
u8 r, g, b; u8 r, g, b;
for (uint i = 0; i < num; ++i, d += 3) { for (uint i = 0; i < num; ++i, d += 3) {
Graphics::colorToRGB<Graphics::ColorMasks<565> >(s[start + i], r, g, b); _pfRGB565.colorToRGB(s[start + i], r, g, b);
d[0] = r; d[0] = r;
d[1] = g; d[1] = g;
d[2] = b; d[2] = b;
@ -392,7 +391,7 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
u16 *d = _texMouse.palette; u16 *d = _texMouse.palette;
for (uint i = 0; i < num; ++i, s += 3) for (uint i = 0; i < num; ++i, s += 3)
d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]); d[start + i] = _pfRGB3444.ARGBToColor(0xff, s[0], s[1], s[2]);
_cursorPaletteDirty = true; _cursorPaletteDirty = true;
} }
@ -631,7 +630,7 @@ int16 OSystem_Wii::getOverlayHeight() {
} }
Graphics::PixelFormat OSystem_Wii::getOverlayFormat() const { Graphics::PixelFormat OSystem_Wii::getOverlayFormat() const {
return Graphics::createPixelFormat<3444>(); return _pfRGB3444;
} }
bool OSystem_Wii::showMouse(bool visible) { bool OSystem_Wii::showMouse(bool visible) {

View file

@ -302,35 +302,6 @@ struct ColorMasks<8888> {
typedef uint32 PixelType; typedef uint32 PixelType;
}; };
#ifdef __WII__
/* Gamecube/Wii specific ColorMask ARGB3444 */
template<>
struct ColorMasks<3444> {
enum {
kBytesPerPixel = 2,
kAlphaBits = 3,
kRedBits = 4,
kGreenBits = 4,
kBlueBits = 4,
kBlueShift = 0,
kGreenShift = kBlueBits,
kRedShift = kGreenBits+kBlueBits,
kAlphaShift = kGreenBits+kBlueBits+kRedBits,
kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift,
kRedMask = ((1 << kRedBits) - 1) << kRedShift,
kGreenMask = ((1 << kGreenBits) - 1) << kGreenShift,
kBlueMask = ((1 << kBlueBits) - 1) << kBlueShift,
kRedBlueMask = kRedMask | kBlueMask
};
typedef uint16 PixelType;
};
#endif
template<class T> template<class T>
uint32 RGBToColor(uint8 r, uint8 g, uint8 b) { uint32 RGBToColor(uint8 r, uint8 g, uint8 b) {
return T::kAlphaMask | return T::kAlphaMask |