Replace 800x600 width a resolution from a .h file. Lots of positions are still hardco...
[ccbs] / bigscreen / rotatescreen.cpp
index fcc975c..78a0e78 100644 (file)
@@ -4,7 +4,7 @@
 RotateScreen::RotateScreen()
        : valid(false), current_screen(0), in_fade(false)
 {
-       fadefrom_buf = new unsigned char[800 * 600 * 4];
+       fadefrom_buf = new unsigned char[SCREEN_WIDTH * SCREEN_HEIGHT * 4];
 }
 
 RotateScreen::~RotateScreen()
@@ -60,7 +60,7 @@ void RotateScreen::draw(unsigned char *buf)
                        // ugly hack here? :-)
                        subscreens[current_screen].screen->draw(subscreens[current_screen].buf);
                        
-                       memcpy(buf, subscreens[current_screen].buf, 800 * 600 * 4);
+                       memcpy(buf, subscreens[current_screen].buf, SCREEN_WIDTH * SCREEN_HEIGHT * 4);
                } else {
                        // find the fade factors
                        int fr, fg, fb, fa;
@@ -80,7 +80,7 @@ void RotateScreen::draw(unsigned char *buf)
 
                        if (fade_to_new_info && elapsed_fade >= 0.5) {
                                // fade G&B to be = R
-                               for (unsigned i = 0; i < 800 * 600; ++i) {
+                               for (unsigned i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; ++i) {
                                        dptr[0] = sptr2[0] + (((int(sptr2[2]) - int(sptr2[0])) * fb) >> 8);
                                        dptr[1] = sptr2[1] + (((int(sptr2[2]) - int(sptr2[1])) * fg) >> 8);
                                        dptr[2] = sptr2[2];
@@ -89,7 +89,7 @@ void RotateScreen::draw(unsigned char *buf)
                                        sptr1 += 4, sptr2 += 4, dptr += 4;
                                }
                        } else {
-                               for (unsigned i = 0; i < 800 * 600; ++i) {
+                               for (unsigned i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; ++i) {
                                        dptr[0] = sptr1[0] + (((int(sptr2[0]) - int(sptr1[0])) * fb) >> 8);
                                        dptr[1] = sptr1[1] + (((int(sptr2[1]) - int(sptr1[1])) * fg) >> 8);
                                        dptr[2] = sptr1[2] + (((int(sptr2[2]) - int(sptr1[2])) * fr) >> 8);
@@ -126,7 +126,7 @@ void RotateScreen::draw(unsigned char *buf)
                        fade_found_start_time = false;
                        fade_to_new_info = force;
                        
-                       memcpy(fadefrom_buf, subscreens[old_current_screen].buf, 800 * 600 * 4);
+                       memcpy(fadefrom_buf, subscreens[old_current_screen].buf, SCREEN_WIDTH * SCREEN_HEIGHT * 4);
 
                        if (subscreens[current_screen].screen->check_invalidated())
                                subscreens[current_screen].screen->draw(subscreens[current_screen].buf);
@@ -170,7 +170,7 @@ bool RotateScreen::can_update()
 void RotateScreen::add_screen(GenericScreen *screen)
 {
        Subscreen ss;
-       ss.buf = new unsigned char[800 * 600 * 4];
+       ss.buf = new unsigned char[SCREEN_WIDTH * SCREEN_HEIGHT * 4];
        ss.screen = screen;
 
        screen->draw(ss.buf);