From 830411e055408d226f1ab6d91085342c3fd3e71b Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 15 Feb 2013 01:06:03 +0200 Subject: [PATCH] fix incorrect assumption, minor refactoring --- src/video/omapdss/sdlif.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/video/omapdss/sdlif.c b/src/video/omapdss/sdlif.c index 27a730f..9e374ef 100644 --- a/src/video/omapdss/sdlif.c +++ b/src/video/omapdss/sdlif.c @@ -251,19 +251,20 @@ static void omap_UpdateRects(SDL_VideoDevice *this, int nrects, SDL_Rect *rects) { struct SDL_PrivateVideoData *pdata = this->hidden; SDL_Surface *screen = this->screen; - Uint16 *src, *dst; - int i, x, y, w, h; + int fullscreen_blit = 0; + int i, Bpp, x, y, w, h; + char *src, *dst; trace("%d, %p", nrects, rects); - if (screen->flags & SDL_DOUBLEBUF) { - if (nrects == 1 && rects->x == 0 && rects->y == 0 + fullscreen_blit = + nrects == 1 && rects->x == 0 && rects->y == 0 && (rects->w == screen->w || rects->w == 0) - && (rects->h == screen->h || rects->h == 0) - && !pdata->app_uses_flip) - { + && (rects->h == screen->h || rects->h == 0); + + if (screen->flags & SDL_DOUBLEBUF) { + if (fullscreen_blit && !pdata->app_uses_flip) screen->pixels = osdl_video_flip(pdata); - } return; } @@ -272,7 +273,12 @@ static void omap_UpdateRects(SDL_VideoDevice *this, int nrects, SDL_Rect *rects) if (src == dst) return; - for (i = 0; i < nrects; i++) { + if (fullscreen_blit) { + memcpy(dst, src, screen->pitch * screen->h); + return; + } + + for (i = 0, Bpp = screen->format->BytesPerPixel; i < nrects; i++) { /* this supposedly has no clipping, but we'll do it anyway */ x = rects[i].x, y = rects[i].y, w = rects[i].w, h = rects[i].h; if (x < 0) @@ -288,9 +294,9 @@ static void omap_UpdateRects(SDL_VideoDevice *this, int nrects, SDL_Rect *rects) h = screen->h - y; for (; h > 0; y++, h--) - memcpy(dst + y * screen->pitch / 2 + x, - src + y * screen->pitch / 2 + x, - w * 2); + memcpy(dst + y * screen->pitch + x * Bpp, + src + y * screen->pitch + x * Bpp, + w * Bpp); } } -- 2.39.2