Skip to content
Permalink
Browse files

Remove the Video::setpal method.

This is a useless indirection, the real work is done by Video::dosetpal, which is called by Palette::set (using private data), which is called by Video::setpal. Just call Palette::set directly.
  • Loading branch information
pphaneuf committed Feb 26, 2014
1 parent 26e9363 commit fe0cec29c77a2d578d75126d5de1a4e1b8e0b8e7
@@ -127,19 +127,12 @@ Video_Dumb::~Video_Dumb() {
#endif
}

void Video_Dumb::setpal(const Palette& p) {
pal = p;
newpal=true;
}

void Video_Dumb::dosetpal(const SDL_Color pal[256], int size) {
}

void Video_Dumb::end_frame() {
if(newpal) {
pal.set();
if(newpal)
newpal = false;
}

#ifndef WIN32
// Shouldn't we do something on Windows too?
@@ -95,7 +95,6 @@ class Video {
delete vb;
}
virtual void end_frame() = 0;
virtual void setpal(const Palette& p) = 0;
virtual void dosetpal(const SDL_Color pal[256], int size) = 0;
virtual void snap_shot(int x, int y, int w, int h) = 0;
virtual Video_bitmap* new_bitmap(int px, int py, int w, int h) = 0;
@@ -46,7 +46,6 @@ class Video_Dumb: public Video {
Video_Dumb(int w, int h, const char *wname);
virtual ~Video_Dumb();
virtual void end_frame();
virtual void setpal(const Palette& p);
virtual void dosetpal(const SDL_Color pal[256], int size);
virtual void snap_shot(int x, int y, int w, int h);
virtual Video_bitmap* new_bitmap(int px, int py, int w, int h);
@@ -88,7 +88,7 @@ void Fade::setdest(const Palette& dst) {
current[j++] = dest.g(i) << 7;
current[j++] = dest.b(i) << 7;
}
video->setpal(dest);
dest.set();
currentframe=destframe;
}

@@ -133,7 +133,7 @@ void Fade::set() {
if(currentframe==destframe)
return;
if(currentframe==destframe-1) {
video->setpal(dest);
dest.set();
} else {
for(int i(0); i<256; i++)
video->pal.setcolor(i, current[i*3]>>7, current[i*3+1]>>7, current[i*3+2]>>7);
@@ -88,9 +88,6 @@ class Video_SDL : public Video {
SDL_RenderPresent(renderer_);
++framecount;
}
virtual void setpal(const Palette& p) {
p.set();
}
virtual void dosetpal(const SDL_Color pal[256], int size) {
SDL_SetPaletteColors(surface_->format->palette, pal, 0, size);
}
@@ -81,6 +81,6 @@ Setpalette::Setpalette(const Palette& p): pal(p) {

void Setpalette::init() {
Module::init();
video->setpal(pal);
pal.set();
ret();
}
@@ -437,7 +437,7 @@ void Pane_selectscheme::step() {
Canvas::change_level(i+1, pal, bit);
pi.inter->font->colorize(*pal, 255, 255, 255);
pi.mp->courrier->colorize(*pal, 255, 255, 255);
video->setpal(*pal);
pal->set();
if(!playback) {
config.info.multi_level = i+1;
config.write();

0 comments on commit fe0cec2

Please sign in to comment.
You can’t perform that action at this time.