Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: co657_lcdplay co657_nrf52_beacons door_lock co657_IoT
Fork of C12832 by
Revision 19:de1f73b31288, committed 2015-11-01
- Comitter:
- co657_frmb
- Date:
- Sun Nov 01 23:09:05 2015 +0000
- Parent:
- 18:8c294697c901
- Child:
- 20:dbee79303f9a
- Commit message:
- Some small optimisations.
Changed in this revision
| C12832.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/C12832.cpp Sun Nov 01 02:22:53 2015 +0000
+++ b/C12832.cpp Sun Nov 01 23:09:05 2015 +0000
@@ -149,13 +149,13 @@
if (draw_mode == NORMAL) {
if (color == 0) {
- buffer[x + ((y >> 3) << 7)] &= ~(1 << (y & 0x07)); // erase pixel
+ buffer[x + ((y & ~7) << 4)] &= ~(1 << (y & 0x07)); // erase pixel
} else {
- buffer[x + ((y >> 3) << 7)] |= (1 << (y & 0x07)); // set pixel
+ buffer[x + ((y & ~7) << 4)] |= (1 << (y & 0x07)); // set pixel
}
} else { // XOR mode
if (color == 1) {
- buffer[x + ((y >> 3) << 7)] ^= (1 << (y & 0x07)); // xor pixel
+ buffer[x + ((y & ~7) << 4)] ^= (1 << (y & 0x07)); // xor pixel
}
}
}
@@ -165,13 +165,13 @@
{
if (draw_mode == NORMAL) {
if (colour == 0) {
- buffer[x + ((y >> 3) << 7)] &= ~(1 << (y & 0x07)); // erase pixel
+ buffer[x + ((y & ~7) << 4)] &= ~(1 << (y & 0x07)); // erase pixel
} else {
- buffer[x + ((y >> 3) << 7)] |= (1 << (y & 0x07)); // set pixel
+ buffer[x + ((y & ~7) << 4)] |= (1 << (y & 0x07)); // set pixel
}
} else { // XOR mode
if (colour == 1) {
- buffer[x + ((y >> 3) << 7)] ^= (1 << (y & 0x07)); // xor pixel
+ buffer[x + ((y & ~7) << 4)] ^= (1 << (y & 0x07)); // xor pixel
}
}
}
@@ -340,7 +340,7 @@
x1 = 127;
}
- yoff = ((y0 >> 3) << 7);
+ yoff = ((y0 & ~7) << 4);
ybit = (1 << (y0 & 0x07));
if (draw_mode == NORMAL) {
@@ -381,7 +381,7 @@
if ((y0 & ~0x07) == (y1 & ~0x07)) {
/* first and last pixels are in the same byte */
uint8_t ybits = ((1 << ((y1 & 0x07) + 1)) - 1) ^ ((1 << (y0 & 0x07)) - 1);
- int yoff = (y0 >> 3) << 7; /* same as y1 */
+ int yoff = (y0 & ~7) << 4; /* same as y1 */
if (draw_mode == NORMAL) {
if (colour == 1) {
@@ -395,8 +395,8 @@
} else {
uint8_t st_ybits = (0xff << (y0 & 0x07));
uint8_t sp_ybits = ((1 << ((y1 & 0x07) + 1)) - 1);
- int st_yoff = (y0 >> 3) << 7;
- int sp_yoff = (y1 >> 3) << 7;
+ int st_yoff = (y0 & ~7) << 4;
+ int sp_yoff = (y1 & ~7) << 4;
/* fill in first byte */
if (draw_mode == NORMAL) {
@@ -457,7 +457,7 @@
void C12832::fillrect(int x0, int y0, int x1, int y1, int color)
{
- int l,c,i;
+ int l,i;
if(x0 > x1) {
i = x0;
x0 = x1;
@@ -471,9 +471,7 @@
}
for(l = x0; l<= x1; l ++) {
- for(c = y0; c<= y1; c++) {
- pixel(l,c,color);
- }
+ vline (l, y0, y1, color);
}
if(auto_up) copy_to_lcd();
}
