Date: Sat, 28 Jun 2014 09:48:47 GMT From: seiya@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r270173 - soc2014/seiya/bootsplash/sys/dev/fb Message-ID: <201406280948.s5S9mllr032371@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: seiya Date: Sat Jun 28 09:48:46 2014 New Revision: 270173 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=270173 Log: bmp: support more compression type and color depths Modified: soc2014/seiya/bootsplash/sys/dev/fb/bmp.c Modified: soc2014/seiya/bootsplash/sys/dev/fb/bmp.c ============================================================================== --- soc2014/seiya/bootsplash/sys/dev/fb/bmp.c Sat Jun 28 05:51:45 2014 (r270172) +++ soc2014/seiya/bootsplash/sys/dev/fb/bmp.c Sat Jun 28 09:48:46 2014 (r270173) @@ -186,22 +186,42 @@ bmp_info->index += bmp_info->width * (bmp_info->height - iy - height); break; case BI_RLE4: - return(1); /* TODO */ - + for (i = bmp_info->height; i > iy + height; i--) { + for (next_line = 0; next_line == 0;) { + if (*bmp_info->index) { + bmp_info->index += 2; + } else { + switch (*(bmp_info->index+1)) { + case 0: /* end of line */ + bmp_info->index += 2; + next_line = 1; + case 1: /* end of bitmap */ + return(1); + case 2: /* move */ + bmp_info->index += 4; + break; + default: /* literal bitmap data */ + bmp_info->index += 2 + + ((min(*(bmp_info->index+1), *bmp_info->index) + + 3) / 4) * 2; + break; + } + } + } + } + break; case BI_RLE8: for (i = bmp_info->height; i > iy + height; i--) { for (next_line = 0; next_line == 0;) { if (*bmp_info->index) { bmp_info->index += 2; } else { - switch(*(bmp_info->index+1)) { case 0: /* end of line */ bmp_info->index += 2; next_line = 1; break; case 1: /* end of bitmap */ - bmp_info->index = NULL; return(1); case 2: /* move */ bmp_info->index += 4; @@ -209,13 +229,13 @@ default: /* literal bitmap data */ bmp_info->index += 2 + *(bmp_info->index + 1) + (*(bmp_info->index + 1) & 1); - break; - } - } - } - } - break; - } + break; + } + } + } + } + break; + } /* draw from bottom-left */ @@ -252,8 +272,12 @@ sofs = (y * info->adp->va_line_width) + x_origin; switch(info->sdepth) { - case 1: break; /* TODO */ - case 4: break; /* TODO */ + case 1: + case 4: + for(i = 0; i < count; i++) { + bmp_SetPix(info, x_origin + i, y, val); /* TODO */ + } + break; case 8: for(i = 0; i < count; i++, sofs++) { newbank = sofs / info->adp->va_window_size; @@ -368,21 +392,12 @@ for (i = 0; i < *info->index && count < *info->index; i++, count++, x++) { if (i & 1) { /* odd count, low nybble */ - bmp_SetPix(info, x, y, *(info->index+1) & 0x0f); + val = *(info->index+1) & 0x0f; } else { /* even count, high nybble */ - bmp_SetPix(info, x, y, (*(info->index+1) >>4) & 0x0f); + val = (*(info->index+1) >> 4) & 0x0f; } - } - - /* TODO: use bmp_draw_line() instead */ - /* go to the next line */ - if(count == width) { - for (; *info->index != 0 && *(info->index+1) != 0; - info->index++) - ; - info->index += 2; - return; + bmp_SetPix(info, x, y, val); } info->index += 2; @@ -418,15 +433,6 @@ bmp_SetPix(info, x, y, val); } - /* go to the next line */ - if(count == width){ - for (; *info->index != 0 && *(info->index+1) != 0; - info->index++) - ; - info->index += 2; - return; - } - /* * warning, this depends on integer truncation, * do not hand-optimise!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406280948.s5S9mllr032371>