summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-15 13:26:57 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-15 13:26:57 +0000
commit3d1c27f4d127e9e91f3a97555781777151a43bae (patch)
treef0b17a26bf7cec279bfa4b1b45922d7b76e04344 /firmware/drivers/lcd.c
parentfc9aff374616d52cb7d63dbc13029faed09af0b5 (diff)
Added lcd_clearline() - the opposite of drawline. We need this to make funny
graphical stuff. lcd_bitmap() with the last argument set to 'false' now only OR the bitmap to the background instead of using XOR as it did previously. I really can't see the point in XORing... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1011 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd.c')
-rw-r--r--firmware/drivers/lcd.c76
1 files changed, 73 insertions, 3 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index 3303c16cc4..fa6baf18d9 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -594,7 +594,7 @@ void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
{
/* First partial row */
data = *src++ << shift;
- *dst = (*dst & mask) ^ data;
+ *dst = (*dst & mask) | data;
data >>= 8;
dst++;
@@ -602,7 +602,7 @@ void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
for (y = 8; y < ny-8; y += 8)
{
data |= *src++ << shift;
- *dst = (*dst & mask2) ^ data;
+ *dst = (*dst & mask2) | data;
data >>= 8;
dst++;
}
@@ -611,7 +611,7 @@ void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
/* Last partial row */
if (y + shift < ny)
data |= *src++ << shift;
- *dst = (*dst & mask3) ^ (data & mask4);
+ *dst = (*dst & mask3) | (data & mask4);
}
}
@@ -729,6 +729,76 @@ void lcd_drawline( int x1, int y1, int x2, int y2 )
}
}
+void lcd_clearline( int x1, int y1, int x2, int y2 )
+{
+ int numpixels;
+ int i;
+ int deltax, deltay;
+ int d, dinc1, dinc2;
+ int x, xinc1, xinc2;
+ int y, yinc1, yinc2;
+
+ deltax = abs(x2 - x1);
+ deltay = abs(y2 - y1);
+
+ if(deltax >= deltay)
+ {
+ numpixels = deltax;
+ d = 2 * deltay - deltax;
+ dinc1 = deltay * 2;
+ dinc2 = (deltay - deltax) * 2;
+ xinc1 = 1;
+ xinc2 = 1;
+ yinc1 = 0;
+ yinc2 = 1;
+ }
+ else
+ {
+ numpixels = deltay;
+ d = 2 * deltax - deltay;
+ dinc1 = deltax * 2;
+ dinc2 = (deltax - deltay) * 2;
+ xinc1 = 0;
+ xinc2 = 1;
+ yinc1 = 1;
+ yinc2 = 1;
+ }
+ numpixels++; /* include endpoints */
+
+ if(x1 > x2)
+ {
+ xinc1 = -xinc1;
+ xinc2 = -xinc2;
+ }
+
+ if(y1 > y2)
+ {
+ yinc1 = -yinc1;
+ yinc2 = -yinc2;
+ }
+
+ x = x1;
+ y = y1;
+
+ for(i=0; i<numpixels; i++)
+ {
+ CLEAR_PIXEL(x,y);
+
+ if(d < 0)
+ {
+ d += dinc1;
+ x += xinc1;
+ y += yinc1;
+ }
+ else
+ {
+ d += dinc2;
+ x += xinc2;
+ y += yinc2;
+ }
+ }
+}
+
/*
* Set a single pixel
*/