From: Ricardo Cruz Date: Wed, 20 Oct 2004 21:08:51 +0000 (+0000) Subject: Apply filters when reloading Surfaces. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5cbc442143d66a117c0a50e3bfb7969b622be2a8;p=supertux.git Apply filters when reloading Surfaces. Fixes bug that after changing video mode, player only looked right and enemies left. SVN-Revision: 2042 --- diff --git a/lib/video/surface.cpp b/lib/video/surface.cpp index 1c69e3f9f..bcb8dc866 100644 --- a/lib/video/surface.cpp +++ b/lib/video/surface.cpp @@ -194,12 +194,21 @@ Surface::reload() { w = impl->w; h = impl->h; + for(std::vector::iterator i = + data.applied_filters.begin(); i != data.applied_filters.end(); + i++) + impl->apply_filter(i->type, i->color); } } void Surface::apply_filter(int filter, Color color) { impl->apply_filter(filter, color); + +SurfaceData::Filter apply_filter; +apply_filter.type = filter; +apply_filter.color = color; +data.applied_filters.push_back(apply_filter); } Surface::~Surface() diff --git a/lib/video/surface.h b/lib/video/surface.h index ef311d8a5..2a27db870 100644 --- a/lib/video/surface.h +++ b/lib/video/surface.h @@ -72,6 +72,10 @@ namespace SuperTux ConstructorType type; SDL_Surface* surface; std::string file; + + struct Filter { int type; Color color; }; + std::vector applied_filters; + bool use_alpha; int x; int y;