From owner-svn-soc-all@FreeBSD.ORG Wed Jun 18 06:33:24 2014 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C96099FB for ; Wed, 18 Jun 2014 06:33:24 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99E6C2C02 for ; Wed, 18 Jun 2014 06:33:24 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5I6XOxV008804 for ; Wed, 18 Jun 2014 06:33:24 GMT (envelope-from seiya@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.8/8.14.8/Submit) id s5I6XOR5008508 for svn-soc-all@FreeBSD.org; Wed, 18 Jun 2014 06:33:24 GMT (envelope-from seiya@FreeBSD.org) Date: Wed, 18 Jun 2014 06:33:24 GMT Message-Id: <201406180633.s5I6XOR5008508@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to seiya@FreeBSD.org using -f From: seiya@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269715 - soc2014/seiya/bootsplash/sys/dev/fb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2014 06:33:24 -0000 Author: seiya Date: Wed Jun 18 06:33:23 2014 New Revision: 269715 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269715 Log: bmp: tiny enhance 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 Wed Jun 18 05:35:09 2014 (r269714) +++ soc2014/seiya/bootsplash/sys/dev/fb/bmp.c Wed Jun 18 06:33:23 2014 (r269715) @@ -224,6 +224,46 @@ return(0); } +/* +** bmp_draw_line +** +** Given (info), set the pixels from (x_origin) to (x_origin) + (count) at (y) to (val) +** +*/ +static void +bmp_draw_line(BMP_INFO *info, int y, int x_origin, int count, int val) +{ + int i; + int sofs; + int newbank; + + /* + * range check to avoid explosions + */ + if ((x_origin < 0) || (x_origin + count >= info->swidth) || (y < 0) || (y >= info->sheight)) + return; + + /* + * calculate offset into video memory + */ + sofs = (y * info->adp->va_line_width) + x_origin; + + switch(info->sdepth) { + case 1: break; /* TODO */ + case 4: break; /* TODO */ + + case 8: + for(i = 0; i < count; i++, sofs++) { + newbank = sofs / info->adp->va_window_size; + if (info->bank != newbank) { + vidd_set_win_org(info->adp, newbank*info->adp->va_window_size); + info->bank = newbank; + } + *(info->vidmem + (sofs % info->adp->va_window_size)) = val; + } + break; + } +} /* ** bmp_SetPix @@ -393,6 +433,7 @@ bmp_DecodeRLE8(BMP_INFO *info, int line, int sx, int width) { int i; + int count; /* pixels to be drawn at the `y`th line */ int x,y; /* screen position on screen */ y = line; @@ -405,10 +446,11 @@ * two colour indexes to alternate between for the run */ if (*info->index) { - for (i = 0; i < *info->index && (x - sx) < width; i++, x++) - bmp_SetPix(info, x, y, *(info->index+1)); - + count = ((width - x - sx - 1) > *info->index)? *info->index : (width - x - sx - 1); + bmp_draw_line(info, y, x, count, *(info->index+1)); + x += count; info->index += 2; + /* * A leading zero is an escape; it may signal the end of the * bitmap, a cursor move, or some absolute data.