Merge pull request #110247 from BlueCube3310/image-fill-mips

Image: Make `fill` method also fill the mipmaps
This commit is contained in:
Thaddeus Crews 2025-09-24 09:59:04 -05:00
commit 3d1d4bf934
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
2 changed files with 11 additions and 7 deletions

View file

@ -3293,13 +3293,13 @@ void Image::fill(const Color &p_color) {
ERR_FAIL_COND_MSG(is_compressed(), "Cannot fill in compressed image formats.");
uint8_t *dst_data_ptr = data.ptrw();
int pixel_size = get_format_pixel_size(format);
int64_t pixel_count = data.size() / pixel_size;
// Put first pixel with the format-aware API.
_set_color_at_ofs(dst_data_ptr, 0, p_color);
_repeat_pixel_over_subsequent_memory(dst_data_ptr, pixel_size, width * height);
_repeat_pixel_over_subsequent_memory(dst_data_ptr, pixel_size, pixel_count);
}
void Image::fill_rect(const Rect2i &p_rect, const Color &p_color) {