summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-02-23 01:22:29 +0000
committerJens Arnold <amiconn@rockbox.org>2006-02-23 01:22:29 +0000
commitba4991cc194dafd867a000fe410b7fce29b3b64d (patch)
tree54d5dfeefa4259acc672dd8c865d117e2fa6eac8
parent6876336fee5c03514b9d67c43c424c9aaa1414eb (diff)
downloadrockbox-ba4991cc194dafd867a000fe410b7fce29b3b64d.tar.gz
rockbox-ba4991cc194dafd867a000fe410b7fce29b3b64d.zip
Apply same optimisation as for the core lcd drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8797 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/lib/gray_draw.c57
1 files changed, 38 insertions, 19 deletions
diff --git a/apps/plugins/lib/gray_draw.c b/apps/plugins/lib/gray_draw.c
index b842658bd7..4222d80dc1 100644
--- a/apps/plugins/lib/gray_draw.c
+++ b/apps/plugins/lib/gray_draw.c
@@ -190,9 +190,10 @@ void gray_hline(int x1, int x2, int y)
/* Draw a vertical line (optimised) */
void gray_vline(int x, int y1, int y2)
{
- int y, bits;
+ int y;
+ int bits = 0;
unsigned char *dst;
- bool fillopt;
+ bool fillopt = false;
void (*pfunc)(unsigned char *address);
/* direction flip */
@@ -213,14 +214,23 @@ void gray_vline(int x, int y1, int y2)
y1 = 0;
if (y2 >= _gray_info.height)
y2 = _gray_info.height - 1;
-
- bits = _gray_info.fg_brightness;
- fillopt = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
- (_gray_info.drawmode & DRMODE_BG) :
- (_gray_info.drawmode & DRMODE_FG);
- if (fillopt &&(_gray_info.drawmode & DRMODE_INVERSEVID))
- bits = _gray_info.bg_brightness;
-
+
+ if (_gray_info.drawmode & DRMODE_INVERSEVID)
+ {
+ if (_gray_info.drawmode & DRMODE_BG)
+ {
+ fillopt = true;
+ bits = _gray_info.bg_brightness;
+ }
+ }
+ else
+ {
+ if (_gray_info.drawmode & DRMODE_FG)
+ {
+ fillopt = true;
+ bits = _gray_info.fg_brightness;
+ }
+ }
pfunc = _gray_pixelfuncs[_gray_info.drawmode];
dst = &_gray_info.cur_buffer[MULU16(x, _gray_info.height) + y1];
@@ -253,9 +263,9 @@ void gray_drawrect(int x, int y, int width, int height)
/* Fill a rectangular area */
void gray_fillrect(int x, int y, int width, int height)
{
- int bits;
+ int bits = 0;
unsigned char *dst, *dst_end;
- bool fillopt;
+ bool fillopt = false;
void (*pfunc)(unsigned char *address);
/* nothing to draw? */
@@ -279,13 +289,22 @@ void gray_fillrect(int x, int y, int width, int height)
if (y + height > _gray_info.height)
height = _gray_info.height - y;
- bits = _gray_info.fg_brightness;
- fillopt = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
- (_gray_info.drawmode & DRMODE_BG) :
- (_gray_info.drawmode & DRMODE_FG);
- if (fillopt &&(_gray_info.drawmode & DRMODE_INVERSEVID))
- bits = _gray_info.bg_brightness;
-
+ if (_gray_info.drawmode & DRMODE_INVERSEVID)
+ {
+ if (_gray_info.drawmode & DRMODE_BG)
+ {
+ fillopt = true;
+ bits = _gray_info.bg_brightness;
+ }
+ }
+ else
+ {
+ if (_gray_info.drawmode & DRMODE_FG)
+ {
+ fillopt = true;
+ bits = _gray_info.fg_brightness;
+ }
+ }
pfunc = _gray_pixelfuncs[_gray_info.drawmode];
dst = &_gray_info.cur_buffer[MULU16(x, _gray_info.height) + y];
dst_end = dst + MULU16(width, _gray_info.height);