Merge pull request #690 from lockie/master

allegro5: take image region into account for NK_COMMAND_IMAGE
This commit is contained in:
Rob Loach 2024-09-19 10:56:09 -04:00 committed by GitHub
commit ca8aaf3f65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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