mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-25 12:56:59 +01:00
Correct game screenshot saving: Always save as 8-bit data, always use
Gui::gui->screenshot
This commit is contained in:
parent
be3d67e12d
commit
193785d51b
@ -58,7 +58,7 @@ public:
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
SDL_Surface *tmp = SDL_DisplayFormat(Gui::gui->screenshot);
|
SDL_Surface *tmp = sdl_surface_8bit_copy(Gui::gui->screenshot);
|
||||||
|
|
||||||
this->box->gi->setScreenshot(tmp);
|
this->box->gi->setScreenshot(tmp);
|
||||||
} break;
|
} break;
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
/* If we haven't' saved a screenshot, save it anyway */
|
/* If we haven't' saved a screenshot, save it anyway */
|
||||||
if (!this->box->gi->screenshot)
|
if (!this->box->gi->screenshot)
|
||||||
{
|
{
|
||||||
SDL_Surface *p = TheC64->TheDisplay->SurfaceFromC64Display();
|
SDL_Surface *p = sdl_surface_8bit_copy(Gui::gui->screenshot);
|
||||||
|
|
||||||
this->box->gi->setScreenshot(p);
|
this->box->gi->setScreenshot(p);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ void SaveGameView::saveSnapshot()
|
|||||||
if (!was_paused)
|
if (!was_paused)
|
||||||
TheC64->Resume();
|
TheC64->Resume();
|
||||||
|
|
||||||
Gui::gui->cur_gameInfo->setScreenshot(TheC64->TheDisplay->SurfaceFromC64Display());
|
Gui::gui->cur_gameInfo->setScreenshot(sdl_surface_8bit_copy(Gui::gui->screenshot));
|
||||||
Gui::gui->saveGameInfo(Gui::gui->save_game_path, out_name);
|
Gui::gui->saveGameInfo(Gui::gui->save_game_path, out_name);
|
||||||
ThePrefs.Save(prefs_name);
|
ThePrefs.Save(prefs_name);
|
||||||
|
|
||||||
|
@ -172,8 +172,6 @@ static int png_colortype_from_surface(SDL_Surface *surface)
|
|||||||
|
|
||||||
if (surface->format->palette)
|
if (surface->format->palette)
|
||||||
colortype |= PNG_COLOR_MASK_PALETTE;
|
colortype |= PNG_COLOR_MASK_PALETTE;
|
||||||
else if (surface->format->Amask)
|
|
||||||
colortype |= PNG_COLOR_MASK_ALPHA;
|
|
||||||
|
|
||||||
return colortype;
|
return colortype;
|
||||||
}
|
}
|
||||||
@ -287,6 +285,39 @@ SDL_Surface *sdl_surface_from_data(void *data, size_t sz)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_Surface *sdl_surface_8bit_copy(SDL_Surface *src)
|
||||||
|
{
|
||||||
|
Uint32 rmask,gmask,bmask,amask;
|
||||||
|
SDL_Surface *out;
|
||||||
|
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
rmask = 0xff000000;
|
||||||
|
gmask = 0x00ff0000;
|
||||||
|
bmask = 0x0000ff00;
|
||||||
|
amask = 0x000000ff;
|
||||||
|
#else
|
||||||
|
rmask = 0x000000ff;
|
||||||
|
gmask = 0x0000ff00;
|
||||||
|
bmask = 0x00ff0000;
|
||||||
|
amask = 0xff000000;
|
||||||
|
#endif
|
||||||
|
if (!src)
|
||||||
|
return NULL;
|
||||||
|
if (src->format->BitsPerPixel != 8)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
out = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 8,
|
||||||
|
rmask, gmask, bmask, amask);
|
||||||
|
if (!out)
|
||||||
|
return NULL;
|
||||||
|
memcpy(out->pixels, src->pixels, src->h * src->pitch);
|
||||||
|
|
||||||
|
SDL_SetColors(out, sdl_palette, 0, PALETTE_SIZE);
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void highlight_background(SDL_Surface *where, Font *font,
|
void highlight_background(SDL_Surface *where, Font *font,
|
||||||
SDL_Surface *bg_left, SDL_Surface *bg_middle, SDL_Surface *bg_right,
|
SDL_Surface *bg_left, SDL_Surface *bg_middle, SDL_Surface *bg_right,
|
||||||
int x, int y, int w, int h)
|
int x, int y, int w, int h)
|
||||||
|
@ -88,4 +88,6 @@ const char *ip_to_str(uint8_t *ip_in);
|
|||||||
|
|
||||||
const char *region_to_str(int region);
|
const char *region_to_str(int region);
|
||||||
|
|
||||||
|
SDL_Surface *sdl_surface_8bit_copy(SDL_Surface *src);
|
||||||
|
|
||||||
#endif /* __UTILS_H__ */
|
#endif /* __UTILS_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user