summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-07-02 07:21:21 +0000
committerJens Arnold <amiconn@rockbox.org>2005-07-02 07:21:21 +0000
commit3291ae6bfac7a0cd39dafe12b006f73cbcb874d1 (patch)
tree3ddbd67cc25fd390e62708bbdd00dd115fbdb9b6 /apps
parent876a044ae054fb85d3290b8e457faa2271f3d9f5 (diff)
downloadrockbox-3291ae6bfac7a0cd39dafe12b006f73cbcb874d1.tar.gz
rockbox-3291ae6bfac7a0cd39dafe12b006f73cbcb874d1.zip
A couple of optimisations.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6981 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/lib/playergfx.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c
index 5b756a7727..87be782d4d 100644
--- a/apps/plugins/lib/playergfx.c
+++ b/apps/plugins/lib/playergfx.c
@@ -317,7 +317,7 @@ void pgfx_hline(int x1, int x2, int y)
317void pgfx_vline(int x, int y1, int y2) 317void pgfx_vline(int x, int y1, int y2)
318{ 318{
319 int y; 319 int y;
320 unsigned char *dst; 320 unsigned char *dst, *dst_end;
321 unsigned mask; 321 unsigned mask;
322 lcd_blockfunc_type *bfunc; 322 lcd_blockfunc_type *bfunc;
323 323
@@ -344,8 +344,10 @@ void pgfx_vline(int x, int y1, int y2)
344 dst = &gfx_buffer[pixel_height * (x/5) + y1]; 344 dst = &gfx_buffer[pixel_height * (x/5) + y1];
345 mask = 0x10 >> (x % 5); 345 mask = 0x10 >> (x % 5);
346 346
347 for (y = y1; y <= y2; y++) 347 dst_end = dst + y2 - y1;
348 do
348 bfunc(dst++, mask, 0x1F); 349 bfunc(dst++, mask, 0x1F);
350 while (dst <= dst_end);
349} 351}
350 352
351/* Draw a rectangular box */ 353/* Draw a rectangular box */
@@ -366,8 +368,8 @@ void pgfx_drawrect(int x, int y, int width, int height)
366/* Fill a rectangular area */ 368/* Fill a rectangular area */
367void pgfx_fillrect(int x, int y, int width, int height) 369void pgfx_fillrect(int x, int y, int width, int height)
368{ 370{
369 int nx, i; 371 int nx;
370 unsigned char *dst; 372 unsigned char *dst, *dst_end;
371 unsigned mask, mask_right; 373 unsigned mask, mask_right;
372 lcd_blockfunc_type *bfunc; 374 lcd_blockfunc_type *bfunc;
373 375
@@ -402,16 +404,20 @@ void pgfx_fillrect(int x, int y, int width, int height)
402 { 404 {
403 unsigned char *dst_col = dst; 405 unsigned char *dst_col = dst;
404 406
405 for (i = height; i > 0; i--) 407 dst_end = dst_col + height;
408 do
406 bfunc(dst_col++, mask, 0x1F); 409 bfunc(dst_col++, mask, 0x1F);
410 while (dst_col < dst_end);
407 411
408 dst += pixel_height; 412 dst += pixel_height;
409 mask = 0x1F; 413 mask = 0x1F;
410 } 414 }
411 mask &= mask_right; 415 mask &= mask_right;
412 416
413 for (i = height; i > 0; i--) 417 dst_end = dst + height;
418 do
414 bfunc(dst++, mask, 0x1F); 419 bfunc(dst++, mask, 0x1F);
420 while (dst < dst_end);
415} 421}
416 422
417/* About PlayerGFX internal bitmap format: 423/* About PlayerGFX internal bitmap format:
@@ -429,7 +435,7 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y,
429 int stride, int x, int y, int width, int height) 435 int stride, int x, int y, int width, int height)
430{ 436{
431 int nx, shift; 437 int nx, shift;
432 unsigned char *dst; 438 unsigned char *dst, *dst_end;
433 unsigned mask, mask_right; 439 unsigned mask, mask_right;
434 lcd_blockfunc_type *bfunc; 440 lcd_blockfunc_type *bfunc;
435 441
@@ -465,10 +471,11 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y,
465 mask = 0x1F >> (x % 5); 471 mask = 0x1F >> (x % 5);
466 mask_right = 0x1F0 >> (nx % 5); 472 mask_right = 0x1F0 >> (nx % 5);
467 473
468 for (y = 0; y < height; y++) 474 dst_end = dst + height;
475 do
469 { 476 {
470 const unsigned char *src_row = src; 477 const unsigned char *src_row = src;
471 unsigned char *dst_row = dst; 478 unsigned char *dst_row = dst++;
472 unsigned mask_row = mask; 479 unsigned mask_row = mask;
473 unsigned data = *src_row++; 480 unsigned data = *src_row++;
474 int extrabits = shift; 481 int extrabits = shift;
@@ -493,8 +500,8 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y,
493 bfunc(dst_row, mask_row & mask_right, data >> extrabits); 500 bfunc(dst_row, mask_row & mask_right, data >> extrabits);
494 501
495 src += stride; 502 src += stride;
496 dst++;
497 } 503 }
504 while (dst < dst_end);
498} 505}
499 506
500/* Draw a full bitmap */ 507/* Draw a full bitmap */