allegro5: correctly handle zero region in NK_COMMAND_IMAGE

This commit is contained in:
Andrew Kravchuk 2024-09-18 06:46:14 +02:00
parent 19dc0131f3
commit e4901c5358
No known key found for this signature in database
GPG Key ID: B8A851BA50F6285F

View File

@ -324,9 +324,11 @@ nk_allegro5_render()
} break; } break;
case NK_COMMAND_IMAGE: { case NK_COMMAND_IMAGE: {
const struct nk_command_image *i = (const struct nk_command_image *)cmd; const struct nk_command_image *i = (const struct nk_command_image *)cmd;
nk_ushort w = i->img.region[2],
h = i->img.region[3];
al_draw_scaled_bitmap(i->img.handle.ptr, al_draw_scaled_bitmap(i->img.handle.ptr,
i->img.region[0], i->img.region[1], i->img.region[0], i->img.region[1],
i->img.region[2], i->img.region[3], w ? w : i->w, h ? h : i->h,
i->x, i->y, i->w, i->h, 0); i->x, i->y, i->w, i->h, 0);
} break; } break;
case NK_COMMAND_RECT_MULTI_COLOR: case NK_COMMAND_RECT_MULTI_COLOR: