mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Extract draw_bitmap from draw_glyph.
This commit is contained in:
parent
ceef8d32d3
commit
5d0b5d427a
@ -299,20 +299,29 @@ void ILI9341::draw_pixels(
|
||||
io.lcd_write_pixels(colors, count);
|
||||
}
|
||||
|
||||
void ILI9341::draw_bitmap(
|
||||
const ui::Point p,
|
||||
const ui::Size size,
|
||||
const uint8_t* const pixels,
|
||||
const ui::Color foreground,
|
||||
const ui::Color background
|
||||
) {
|
||||
lcd_start_ram_write(p, size);
|
||||
|
||||
const size_t count = size.w * size.h;
|
||||
for(size_t i=0; i<count; i++) {
|
||||
const auto pixel = pixels[i >> 3] & (1U << (i & 0x7));
|
||||
io.lcd_write_pixel(pixel ? foreground : background);
|
||||
}
|
||||
}
|
||||
|
||||
void ILI9341::draw_glyph(
|
||||
const ui::Point p,
|
||||
const ui::Glyph& glyph,
|
||||
const ui::Color foreground,
|
||||
const ui::Color background
|
||||
) {
|
||||
lcd_start_ram_write(p, glyph.size());
|
||||
|
||||
const size_t count = glyph.w() * glyph.h();
|
||||
const auto pixels = glyph.pixels();
|
||||
for(size_t i=0; i<count; i++) {
|
||||
const auto pixel = pixels[i >> 3] & (1U << (i & 0x7));
|
||||
io.lcd_write_pixel(pixel ? foreground : background);
|
||||
}
|
||||
draw_bitmap(p, glyph.size(), glyph.pixels(), foreground, background);
|
||||
}
|
||||
|
||||
void ILI9341::scroll_set_area(
|
||||
|
@ -65,6 +65,14 @@ public:
|
||||
draw_pixels(r, colors.data(), colors.size());
|
||||
}
|
||||
|
||||
void draw_bitmap(
|
||||
const ui::Point p,
|
||||
const ui::Size size,
|
||||
const uint8_t* const data,
|
||||
const ui::Color foreground,
|
||||
const ui::Color background
|
||||
);
|
||||
|
||||
void draw_glyph(
|
||||
const ui::Point p,
|
||||
const ui::Glyph& glyph,
|
||||
|
Loading…
Reference in New Issue
Block a user