SWORD25: Remove unneeded use of Graphics::ColorMasks

This commit is contained in:
Cameron Cawley 2021-04-18 17:22:38 +01:00 committed by Eugene Sandulenko
parent 757a819da9
commit 10b724fd71
2 changed files with 11 additions and 17 deletions

View File

@ -37,8 +37,6 @@
#include "sword25/gfx/image/vectorimage.h"
#include "sword25/gfx/image/renderedimage.h"
#include "graphics/colormasks.h"
namespace Sword25 {
#define BEZSMOOTHNESS 0.5
@ -291,7 +289,7 @@ VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success, co
r = bs.getByte();
g = bs.getByte();
b = bs.getByte();
_bgColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(0xff, r, g, b);
_bgColor = BS_RGB(r, g, b);
}
break;
default:
@ -546,7 +544,7 @@ bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBit
if (shapeType == 3)
a = bs.getByte();
color = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b);
color = BS_ARGB(a, r, g, b);
if (type != 0)
return false;
@ -575,7 +573,7 @@ bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBit
if (shapeType == 3)
a = bs.getByte();
color = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b);
color = BS_ARGB(a, r, g, b);
_elements.back()._lineStyles.push_back(VectorImageElement::LineStyleType(width, color));
}

View File

@ -40,7 +40,6 @@
#include "sword25/gfx/image/art.h"
#include "sword25/gfx/image/vectorimage.h"
#include "graphics/colormasks.h"
namespace Sword25 {
@ -51,7 +50,7 @@ void art_rgb_fill_run1(byte *buf, byte r, byte g, byte b, int n) {
memset(buf, g, n + n + n + n);
} else {
uint32 *alt = (uint32 *)buf;
uint32 color = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(r, g, b, 0xff);
uint32 color = BS_ARGB(r, g, b, 0xff);
for (i = 0; i < n; i++)
*alt++ = color;
@ -225,19 +224,16 @@ void art_rgb_svp_alpha1(const ArtSVP *svp,
uint32 color,
byte *buf, int rowstride) {
ArtRgbSVPAlphaData data;
byte r, g, b, alpha;
int i;
int a, da;
Graphics::colorToARGB<Graphics::ColorMasks<8888> >(color, alpha, r, g, b);
data.r = r;
data.g = g;
data.b = b;
data.alpha = alpha;
data.r = (color >> 16) & 0xFF;
data.g = (color >> 8) & 0xFF;
data.b = (color >> 0) & 0xFF;
data.alpha = (color >> 24) & 0xFF;
a = 0x8000;
da = (alpha * 66051 + 0x80) >> 8; /* 66051 equals 2 ^ 32 / (255 * 255) */
da = (data.alpha * 66051 + 0x80) >> 8; /* 66051 equals 2 ^ 32 / (255 * 255) */
for (i = 0; i < 256; i++) {
data.alphatab[i] = a >> 16;
@ -248,7 +244,7 @@ void art_rgb_svp_alpha1(const ArtSVP *svp,
data.rowstride = rowstride;
data.x0 = x0;
data.x1 = x1;
if (alpha == 255)
if (data.alpha == 255)
art_svp_render_aa(svp, x0, y0, x1, y1, art_rgb_svp_alpha_opaque_callback1, &data);
else
art_svp_render_aa(svp, x0, y0, x1, y1, art_rgb_svp_alpha_callback1, &data);
@ -357,7 +353,7 @@ void drawBez(ArtBpath *bez1, ArtBpath *bez2, byte *buffer, int width, int height
// HACK: Some frames have green bounding boxes drawn.
// Perhaps they were used by original game artist Umriss
// We skip them just like the original
if (bez2 == 0 && color == Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(0xff, 0x00, 0xff, 0x00)) {
if (bez2 == 0 && color == BS_RGB(0x00, 0xff, 0x00)) {
return;
}