Browse Source

allegro5: correctly handle zero region in NK_COMMAND_IMAGE

Andrew Kravchuk 1 year ago
parent
commit
e4901c5358
1 changed files with 3 additions and 1 deletions
  1. 3 1
      demo/allegro5/nuklear_allegro5.h

+ 3 - 1
demo/allegro5/nuklear_allegro5.h

@@ -324,9 +324,11 @@ nk_allegro5_render()
         } break;
         case NK_COMMAND_IMAGE: {
             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,
                                   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);
         } break;
         case NK_COMMAND_RECT_MULTI_COLOR: