X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Fccbs_bigscreen.cpp;fp=bigscreen%2Fccbs_bigscreen.cpp;h=2694e3711850820c72904153a5ef762e298a3252;hp=e9a30110c5eb449ed67ca0a067f2d6dac4e4eb68;hb=fe5d8dd4bcbab4fed744782495a9fecdb5a5b1a7;hpb=94e4ce30af61cc8bc8a25fe25f770b48e6125a68 diff --git a/bigscreen/ccbs_bigscreen.cpp b/bigscreen/ccbs_bigscreen.cpp index e9a3011..2694e37 100644 --- a/bigscreen/ccbs_bigscreen.cpp +++ b/bigscreen/ccbs_bigscreen.cpp @@ -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) { + 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 {