forked from len0rd/rockbox
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
This commit is contained in:
parent
fc9aff3746
commit
3d1c27f4d1
1 changed files with 73 additions and 3 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue