mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-26 14:27:14 +00:00
AGS: Fix fully transparent savegame screenshots
If On A Winter's Night, Four Travelers was such as game that generated fully transparent screenshots. I am not completely sure why it happens, and the easiest solution was to reset the alpha byte to 0xff.
This commit is contained in:
parent
4945526219
commit
6816c62822
@ -922,6 +922,7 @@ void create_savegame_screenshot(Bitmap *&screenShot) {
|
||||
quit("!Invalid game.screenshot_width/height, must be from 16x16 to screen res");
|
||||
|
||||
screenShot = CopyScreenIntoBitmap(usewid, usehit);
|
||||
screenShot->GetAllegroBitmap()->makeOpaque();
|
||||
|
||||
// Restore original screen
|
||||
_G(debug_flags) = old_flags;
|
||||
|
@ -51,6 +51,20 @@ int BITMAP::getpixel(int x, int y) const {
|
||||
return *(const uint32 *)pixel;
|
||||
}
|
||||
|
||||
void BITMAP::makeOpaque() {
|
||||
if (format.aBits() == 0)
|
||||
return;
|
||||
assert(format.bytesPerPixel == 4);
|
||||
uint32 alphaMask = format.ARGBToColor(0xff, 0, 0, 0);
|
||||
|
||||
unsigned char *pixels = getPixels();
|
||||
for (int y = 0 ; y < h ; ++y, pixels += pitch) {
|
||||
uint32 *data = (uint32*)pixels;
|
||||
for (int x = 0 ; x < w ; ++x, ++data)
|
||||
(*data) |= alphaMask;
|
||||
}
|
||||
}
|
||||
|
||||
void BITMAP::circlefill(int x, int y, int radius, int color) {
|
||||
int cx = 0;
|
||||
int cy = radius;
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
_owner->clear();
|
||||
}
|
||||
|
||||
void makeOpaque();
|
||||
|
||||
/**
|
||||
* Draws a solid filled in circle
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user