From cdfb7d44f2c698a6c3dcfcbd4bdccf066ccfaf8a Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Thu, 25 Jul 2019 14:26:45 -0400 Subject: sdl: fix video regression introduced by 5d05b9d The quake commit tried to optimize lcd updates but inadvertently broke wolf3d (which always uses a 320x200 screen size). This fixes that and also lets direct mode truly exit early to hopefully save some cycles. Change-Id: I41d96cd584257fe25e791c7f615812849f348e4f --- .../sdl/src/video/rockbox/SDL_rockboxvideo.c | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c b/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c index 3a12d984b8..9d11ae2acc 100644 --- a/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c +++ b/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c @@ -687,21 +687,21 @@ static void blit_rotated(fb_data *src, int x, int y, int w, int h) rb->lcd_framebuffer[x_0 * LCD_WIDTH + y_0] = src[(LCD_WIDTH - y_0) * LCD_HEIGHT + x_0]; } -//static fb_data tmp_fb[LCD_WIDTH * LCD_HEIGHT]; - static void ROCKBOX_UpdateRects(_THIS, int numrects, SDL_Rect *rects) { + /* Direct mode writes directly to lcd_framebuffer. Update and + * exit! */ + if(this->hidden->direct) + { + rb->lcd_update(); + return; + } + if(this->screen->pixels) { for(int i = 0; i < numrects; ++i) { - /* no scaling */ - if(this->hidden->direct) - { - /* no-op */ - } - /* screen is rotated */ - else if(this->hidden->rotate) + if(this->hidden->rotate) { LOGF("rotated copy"); blit_rotated(this->screen->pixels, rects[i].x, rects[i].y, rects[i].w, rects[i].h); @@ -769,9 +769,13 @@ static void ROCKBOX_UpdateRects(_THIS, int numrects, SDL_Rect *rects) /* FIXME: this won't work for rotated screen or overlapping rects */ flip_pixels(rects[i].x, rects[i].y, rects[i].w, rects[i].h); #endif - rb->lcd_update_rect(rects[i].x, rects[i].y, rects[i].w, rects[i].h); + /* We are lazy and do not want to figure out the new + * rectangle coordinates. See lcd_update() below. */ + //rb->lcd_update_rect(rects[i].x, rects[i].y, rects[i].w, rects[i].h); } /* for */ } /* if */ + + rb->lcd_update(); } int ROCKBOX_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) -- cgit v1.2.3