mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
SWORD25: Properly handle colour conversion
This commit is contained in:
parent
e5ea70ce67
commit
7c17cb79b7
@ -181,7 +181,7 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
|
||||
|
||||
if (rect.width() > 0 && rect.height() > 0) {
|
||||
if (ca == 0xff) {
|
||||
_backSurface.fillRect(rect, BS_ARGB(cr, cg, cb, ca));
|
||||
_backSurface.fillRect(rect, _backSurface.format.ARGBToColor(ca, cr, cg, cb));
|
||||
} else {
|
||||
byte *outo = (byte *)_backSurface.getBasePtr(rect.left, rect.top);
|
||||
byte *out;
|
||||
|
@ -227,7 +227,14 @@ uint RenderedImage::getPixel(int x, int y) {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRect, uint color, int width, int height, RectangleList *updateRects) {
|
||||
_surface.blit(*_backSurface, posX, posY, (((flipping & 1) ? Graphics::FLIP_V : 0) | ((flipping & 2) ? Graphics::FLIP_H : 0)), pPartRect, color, width, height);
|
||||
int newFlipping = (((flipping & 1) ? Graphics::FLIP_V : 0) | ((flipping & 2) ? Graphics::FLIP_H : 0));
|
||||
|
||||
int ca = (color >> BS_ASHIFT) & 0xff;
|
||||
int cr = (color >> BS_RSHIFT) & 0xff;
|
||||
int cg = (color >> BS_GSHIFT) & 0xff;
|
||||
int cb = (color >> BS_BSHIFT) & 0xff;
|
||||
|
||||
_surface.blit(*_backSurface, posX, posY, newFlipping, pPartRect, _surface.format.ARGBToColor(ca, cr, cg, cb), width, height);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -92,7 +92,10 @@ uint SWImage::getPixel(int x, int y) {
|
||||
assert(x >= 0 && x < _image.w);
|
||||
assert(y >= 0 && y < _image.h);
|
||||
|
||||
return *((const uint32 *)_image.getBasePtr(0, 0));
|
||||
byte a, r, g, b;
|
||||
_image.format.colorToARGB(_image.getPixel(0, 0), a, r, g, b);
|
||||
|
||||
return BS_ARGB(a, r, g, b);
|
||||
}
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -50,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 = BS_ARGB(r, g, b, 0xff);
|
||||
uint32 color = TS_RGB(r, g, b);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
*alt++ = color;
|
||||
|
@ -124,10 +124,6 @@ uint StaticBitmap::getPixel(int x, int y) const {
|
||||
assert(pResource->getType() == Resource::TYPE_BITMAP);
|
||||
BitmapResource *pBitmapResource = static_cast<BitmapResource *>(pResource);
|
||||
uint result = pBitmapResource->getPixel(x, y);
|
||||
// Convert to LUA-ready format
|
||||
byte a;
|
||||
a = result & 0xff;
|
||||
result = (result >> 8) | (a << 24);
|
||||
pResource->release();
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user