|
|
|
@ -181,6 +181,7 @@ void fb_bitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, u |
|
|
|
|
return; |
|
|
|
|
} else if (rowrem == 0) { |
|
|
|
|
// Optimization
|
|
|
|
|
uint8_t mapc0 = 0; |
|
|
|
|
|
|
|
|
|
// First
|
|
|
|
|
for(uint8_t i = 0; i < w; i++) { |
|
|
|
@ -198,8 +199,9 @@ void fb_bitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, u |
|
|
|
|
h -= whole_cells * 8; |
|
|
|
|
for(uint8_t j = 0; j < whole_cells; j++) { |
|
|
|
|
cell += FBW; |
|
|
|
|
mapc0 += w0; |
|
|
|
|
for(uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = map[i + (j+1)*w0]; |
|
|
|
|
uint8_t mask = map[i + mapc0]; |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
@ -209,11 +211,12 @@ void fb_bitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, u |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
mapc0 += w0; |
|
|
|
|
cell += FBW; |
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
for(uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = map[i + (whole_cells+1)*w0] & (0xFF >> (8-h)); |
|
|
|
|
uint8_t mask = map[i + mapc0] & (0xFF >> (8-h)); |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
@ -222,7 +225,73 @@ void fb_bitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, u |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
// TODO wild combination, unaligned multi-row
|
|
|
|
|
uint8_t mapc0 = 0; |
|
|
|
|
|
|
|
|
|
while (h > 0) { |
|
|
|
|
// First
|
|
|
|
|
for (uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = (map[i + mapc0] & (0xFF >> (rowrem))) << rowrem; |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
|
fb[cell + i] &= ~mask; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//mapc0 += w0;
|
|
|
|
|
cell += FBW; |
|
|
|
|
|
|
|
|
|
// leftover of the first row in map
|
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
for (uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = map[i + mapc0] >> (8 - rowrem); |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
|
fb[cell + i] &= ~mask; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (h > 8) { |
|
|
|
|
h -= 8; |
|
|
|
|
} else { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
mapc0 += w0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
// Middle
|
|
|
|
|
uint8_t whole_cells = h / 8; |
|
|
|
|
h -= whole_cells * 8; |
|
|
|
|
for(uint8_t j = 0; j < whole_cells; j++) { |
|
|
|
|
cell += FBW; |
|
|
|
|
mapc0 += w0; |
|
|
|
|
for(uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = map[i + mapc0]; |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
|
fb[cell + i] &= ~mask; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
mapc0 += w0; |
|
|
|
|
cell += FBW; |
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
for(uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = map[i + mapc0] & (0xFF >> (8-h)); |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
|
fb[cell + i] &= ~mask; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|