X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bigscreen%2Fccbs_bigscreen.cpp;h=7165bc393006f1843c406bb28943ec04bdfa8652;hb=405a983fa5d81d4ea5efdf13fa43dbe14a6d8a87;hp=e9a30110c5eb449ed67ca0a067f2d6dac4e4eb68;hpb=250bedbb9992af9f72996b0f790e8c585c3fe4e0;p=ccbs diff --git a/bigscreen/ccbs_bigscreen.cpp b/bigscreen/ccbs_bigscreen.cpp index e9a3011..7165bc3 100644 --- a/bigscreen/ccbs_bigscreen.cpp +++ b/bigscreen/ccbs_bigscreen.cpp @@ -39,8 +39,6 @@ void init(pqxx::connection &conn) } screens.erase(screens.begin(), screens.end()); - bool show_only_main_screen = (USE_SPLITSCREEN && screens.size() == 1); - #if !USE_SPLITSCREEN RotateScreen *rs = new RotateScreen(); mainscreen = rs; @@ -69,6 +67,8 @@ void init(pqxx::connection &conn) } } + bool show_only_main_screen = (USE_SPLITSCREEN && screens.size() == 1); + /* * Show auxilliary screens except if we have too many already, * or if we're in the special split-screen end-tournament mode, @@ -144,14 +144,20 @@ void main_loop(pqxx::connection &conn) } if (mainscreen && mainscreen->check_invalidated()) { - mainscreen->draw(framebuf, SCREEN_WIDTH, SCREEN_HEIGHT); - SDL_LockSurface(screen); - for (unsigned y = 0; y < SCREEN_HEIGHT; ++y) { - unsigned char *sptr = framebuf + y * SCREEN_WIDTH * 4; - unsigned char *dptr = (unsigned char *)screen->pixels + y * screen->pitch; - memcpy(dptr, sptr, SCREEN_WIDTH * 4); + if (screen->pitch == SCREEN_WIDTH * 4) { + SDL_LockSurface(screen); + mainscreen->draw((unsigned char *)screen->pixels, SCREEN_WIDTH, SCREEN_HEIGHT); + SDL_UnlockSurface(screen); + } else { + mainscreen->draw(framebuf, SCREEN_WIDTH, SCREEN_HEIGHT); + SDL_LockSurface(screen); + for (unsigned y = 0; y < SCREEN_HEIGHT; ++y) { + unsigned char *sptr = framebuf + y * SCREEN_WIDTH * 4; + unsigned char *dptr = (unsigned char *)screen->pixels + y * screen->pitch; + memcpy(dptr, sptr, SCREEN_WIDTH * 4); + } + SDL_UnlockSurface(screen); } - SDL_UnlockSurface(screen); SDL_Flip(screen); conn.await_notification(0, 10000); } else {