[mipi_rgb] Fix byte order and dirty bounds in fill() (#14537)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jonathan Swoboda
2026-03-06 12:18:09 -10:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 035f985693
commit d8deb2255d
+6 -6
View File
@@ -288,9 +288,7 @@ void MipiRgb::draw_pixel_at(int x, int y, Color color) {
if (!this->check_buffer_())
return;
size_t pos = (y * this->width_) + x;
uint8_t hi_byte = static_cast<uint8_t>(color.r & 0xF8) | (color.g >> 5);
uint8_t lo_byte = static_cast<uint8_t>((color.g & 0x1C) << 3) | (color.b >> 3);
uint16_t new_color = hi_byte | (lo_byte << 8); // big endian
uint16_t new_color = convert_big_endian(display::ColorUtil::color_to_565(color));
if (this->buffer_[pos] == new_color)
return;
this->buffer_[pos] = new_color;
@@ -315,10 +313,12 @@ void MipiRgb::fill(Color color) {
}
auto *ptr_16 = reinterpret_cast<uint16_t *>(this->buffer_);
uint8_t hi_byte = static_cast<uint8_t>(color.r & 0xF8) | (color.g >> 5);
uint8_t lo_byte = static_cast<uint8_t>((color.g & 0x1C) << 3) | (color.b >> 3);
uint16_t new_color = lo_byte | (hi_byte << 8); // little endian
uint16_t new_color = convert_big_endian(display::ColorUtil::color_to_565(color));
std::fill_n(ptr_16, this->width_ * this->height_, new_color);
this->x_low_ = 0;
this->y_low_ = 0;
this->x_high_ = this->width_ - 1;
this->y_high_ = this->height_ - 1;
}
int MipiRgb::get_width() {