fix invalid texture draw by returning if bitmap is inactive

This commit is contained in:
scawful
2024-07-19 16:33:57 -04:00
parent dea86b090c
commit d66748a5da

View File

@@ -416,6 +416,9 @@ void Canvas::DrawBitmap(const Bitmap &bitmap, int border_offset, bool ready) {
} }
void Canvas::DrawBitmap(const Bitmap &bitmap, int border_offset, float scale) { void Canvas::DrawBitmap(const Bitmap &bitmap, int border_offset, float scale) {
if (!bitmap.is_active()) {
return;
}
draw_list_->AddImage((void *)bitmap.texture(), draw_list_->AddImage((void *)bitmap.texture(),
ImVec2(canvas_p0_.x, canvas_p0_.y), ImVec2(canvas_p0_.x, canvas_p0_.y),
ImVec2(canvas_p0_.x + (bitmap.width() * scale), ImVec2(canvas_p0_.x + (bitmap.width() * scale),
@@ -425,6 +428,9 @@ void Canvas::DrawBitmap(const Bitmap &bitmap, int border_offset, float scale) {
void Canvas::DrawBitmap(const Bitmap &bitmap, int x_offset, int y_offset, void Canvas::DrawBitmap(const Bitmap &bitmap, int x_offset, int y_offset,
float scale, int alpha) { float scale, int alpha) {
if (!bitmap.is_active()) {
return;
}
draw_list_->AddImage( draw_list_->AddImage(
(void *)bitmap.texture(), (void *)bitmap.texture(),
ImVec2(canvas_p0_.x + x_offset + scrolling_.x, ImVec2(canvas_p0_.x + x_offset + scrolling_.x,