mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 03:10:22 +00:00
GRAPHICS: enhance blit in nine-patch with transparency color
This commit is contained in:
parent
43e95f3a48
commit
f2825c85de
@ -208,7 +208,7 @@ bad_bitmap:
|
||||
}
|
||||
}
|
||||
|
||||
void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette, int numColors, MacWindowManager *wm) {
|
||||
void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette, int numColors, MacWindowManager *wm, uint32 transColor) {
|
||||
/* don't draw bitmaps that are smaller than the fixed area */
|
||||
if (dw < _h._fix || dh < _v._fix)
|
||||
return;
|
||||
@ -249,7 +249,7 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
|
||||
for (uint i = 0; i < srf->w; ++i) {
|
||||
for (uint j = 0; j < srf->h; ++j) {
|
||||
uint32 color = *(uint32*)srf->getBasePtr(i, j);
|
||||
if (color > 0) {
|
||||
if (color != transColor) {
|
||||
*((byte *)target.getBasePtr(i, j)) = closestGrayscale(color, palette, numColors);
|
||||
}
|
||||
}
|
||||
@ -258,9 +258,9 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
|
||||
for (uint i = 0; i < srf->w; ++i) {
|
||||
for (uint j = 0; j < srf->h; ++j) {
|
||||
uint32 color = *(uint32*)srf->getBasePtr(i, j);
|
||||
byte r, g, b;
|
||||
_bmp->format.colorToRGB(color, r, g, b);
|
||||
if (color > 0) {
|
||||
byte a, r, g, b;
|
||||
_bmp->format.colorToARGB(color, a, r, g, b);
|
||||
if (a > 0 && color != transColor) {
|
||||
*((byte *)target.getBasePtr(i, j)) = wm->findBestColor(r, g, b);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bitmap);
|
||||
~NinePatchBitmap();
|
||||
|
||||
void blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette = NULL, int numColors = 0, MacWindowManager *wm = NULL);
|
||||
void blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette = NULL, int numColors = 0, MacWindowManager *wm = NULL, uint32 transColor = 0);
|
||||
void blitClip(Graphics::Surface &target, Common::Rect clip, int dx, int dy, int dw, int dh);
|
||||
|
||||
int getWidth() { return _width; }
|
||||
|
Loading…
Reference in New Issue
Block a user