Removed set_pixel_format

This is rather redundant. It's only called once when the CVideo subsystem is initialized and
nowhere else, and we already use the ARGB8888 format for all surfaces (which is what my testing
has revealed the SDL framebuffer surface's format is).
This commit is contained in:
Charles Dang 2019-07-23 11:28:07 +11:00
parent a4893a8990
commit 0e173a451d
3 changed files with 0 additions and 49 deletions

View file

@ -697,41 +697,6 @@ manager::~manager()
flush_cache();
}
static SDL_PixelFormat last_pixel_format;
void set_pixel_format(SDL_PixelFormat* format)
{
assert(format != nullptr);
SDL_PixelFormat& f = *format;
SDL_PixelFormat& l = last_pixel_format;
// if the pixel format change, we clear the cache,
// because some images are now optimized for the wrong display format
// FIXME: 8 bpp use palette, need to compare them. For now assume a change
if(format->BitsPerPixel == 8
|| f.BitsPerPixel != l.BitsPerPixel
|| f.BytesPerPixel != l.BytesPerPixel
|| f.Rmask != l.Rmask
|| f.Gmask != l.Gmask
|| f.Bmask != l.Bmask
// || f.Amask != l.Amask This field in not checked, not sure why.
|| f.Rloss != l.Rloss
|| f.Gloss != l.Gloss
|| f.Bloss != l.Bloss
// || f.Aloss != l.Aloss This field in not checked, not sure why.
|| f.Rshift != l.Rshift
|| f.Gshift != l.Gshift
|| f.Bshift != l.Bshift
// || f.Ashift != l.Ashift This field in not checked, not sure why.
)
{
LOG_DP << "detected a new display format\n";
flush_cache();
}
last_pixel_format = *format;
}
void set_color_adjustment(int r, int g, int b)
{
if(r != red_adjust || g != green_adjust || b != blue_adjust) {

View file

@ -172,10 +172,6 @@ namespace image {
const std::vector<std::string>& get_team_colors();
///sets the pixel format used by the images. Is called every time the
///video mode changes. Invalidates all images.
void set_pixel_format(SDL_PixelFormat* format);
///sets the amount scaled images should be scaled. Invalidates all
///scaled images.
void set_zoom(unsigned int zoom);

View file

@ -179,8 +179,6 @@ void CVideo::make_fake()
#else
frameBuffer = SDL_CreateRGBSurface(0, 16, 16, 24, 0xFF0000, 0xFF00, 0xFF, 0);
#endif
image::set_pixel_format(frameBuffer->format);
}
void CVideo::make_test_fake(const unsigned width, const unsigned height)
@ -191,8 +189,6 @@ void CVideo::make_test_fake(const unsigned width, const unsigned height)
frameBuffer = SDL_CreateRGBSurface(0, width, height, 32, 0xFF0000, 0xFF00, 0xFF, 0);
#endif
image::set_pixel_format(frameBuffer->format);
fake_interactive = true;
refresh_rate_ = 1;
}
@ -253,9 +249,6 @@ void CVideo::init_window()
event_handler_.join_global();
update_framebuffer();
if(frameBuffer) {
image::set_pixel_format(frameBuffer->format);
}
}
void CVideo::set_window_mode(const MODE_EVENT mode, const point& size)
@ -288,9 +281,6 @@ void CVideo::set_window_mode(const MODE_EVENT mode, const point& size)
}
update_framebuffer();
if(frameBuffer) {
image::set_pixel_format(frameBuffer->format);
}
}
SDL_Rect CVideo::screen_area(bool as_pixels) const