diff --git a/src/video/fbcon/SDL_fbvideo.c b/src/video/fbcon/SDL_fbvideo.c index 81830b6..1399140 100644 --- a/src/video/fbcon/SDL_fbvideo.c +++ b/src/video/fbcon/SDL_fbvideo.c @@ -165,6 +165,10 @@ static void FB_RestorePalette(_THIS); static FB_bitBlit FB_blit16; static FB_bitBlit FB_blit16blocked; +static FB_bitBlit FB_blit32; +static FB_bitBlit FB_blit32blocked; + + static int SDL_getpagesize(void) { #ifdef HAVE_GETPAGESIZE @@ -1119,6 +1123,10 @@ static SDL_Surface *FB_SetVideoMode(_THIS, SDL_Surface *current, blitFunc = (rotate == FBCON_ROTATE_NONE || rotate == FBCON_ROTATE_UD) ? FB_blit16 : FB_blit16blocked; + } else if (vinfo.bits_per_pixel == 32) { + blitFunc = (rotate == FBCON_ROTATE_NONE || + rotate == FBCON_ROTATE_UD) ? + FB_blit32 : FB_blit32blocked; } else { #ifdef FBCON_DEBUG fprintf(stderr, "Init vinfo:\n"); @@ -1495,6 +1503,57 @@ static void FB_blit16blocked(Uint8 *byte_src_pos, int src_right_delta, int src_d } } +static void FB_blit32(Uint8 *byte_src_pos, int src_right_delta, int src_down_delta, + Uint8 *byte_dst_pos, int dst_linebytes, int width, int height) +{ + int w; + Uint32 *src_pos = (Uint32 *)byte_src_pos; + Uint32 *dst_pos = (Uint32 *)byte_dst_pos; + + while (height) { + Uint32 *src = src_pos; + Uint32 *dst = dst_pos; + for (w = width; w != 0; w--) { + *dst = *src; + src += src_right_delta; + dst++; + } + dst_pos = (Uint32 *)((Uint8 *)dst_pos + dst_linebytes); + src_pos += src_down_delta; + height--; + } +} + +#define BLOCKSIZE_W 32 +#define BLOCKSIZE_H 32 + +static void FB_blit32blocked(Uint8 *byte_src_pos, int src_right_delta, int src_down_delta, + Uint8 *byte_dst_pos, int dst_linebytes, int width, int height) +{ + int w; + Uint32 *src_pos = (Uint32 *)byte_src_pos; + Uint32 *dst_pos = (Uint32 *)byte_dst_pos; + + while (height > 0) { + Uint32 *src = src_pos; + Uint32 *dst = dst_pos; + for (w = width; w > 0; w -= BLOCKSIZE_W) { + FB_blit32((Uint8 *)src, + src_right_delta, + src_down_delta, + (Uint8 *)dst, + dst_linebytes, + min(w, BLOCKSIZE_W), + min(height, BLOCKSIZE_H)); + src += src_right_delta * BLOCKSIZE_W; + dst += BLOCKSIZE_W; + } + dst_pos = (Uint32 *)((Uint8 *)dst_pos + dst_linebytes * BLOCKSIZE_H); + src_pos += src_down_delta * BLOCKSIZE_H; + height -= BLOCKSIZE_H; + } +} + static void FB_DirectUpdate(_THIS, int numrects, SDL_Rect *rects) { int width = cache_vinfo.xres; @@ -1507,10 +1566,10 @@ static void FB_DirectUpdate(_THIS, int numrects, SDL_Rect *rects) return; } - if (cache_vinfo.bits_per_pixel != 16) { - SDL_SetError("Shadow copy only implemented for 16 bpp"); - return; - } +// if (cache_vinfo.bits_per_pixel != 16) { +// SDL_SetError("Shadow copy only implemented for 16 bpp"); +// return; +// } for (i = 0; i < numrects; i++) { int x1, y1, x2, y2;