diff --git a/vlib/gg/image.c.v b/vlib/gg/image.c.v index f5f4217663..f7496b5e97 100644 --- a/vlib/gg/image.c.v +++ b/vlib/gg/image.c.v @@ -283,8 +283,18 @@ pub fn (ctx &Context) draw_image_with_config(config DrawImageConfig) { } x := config.img_rect.x y := config.img_rect.y - C.darwin_draw_image(x, ctx.height - (y + config.img_rect.height), config.img_rect.width, - config.img_rect.height, img) + width := if config.img_rect.width == 0 { + f32(img.width) + } else { + config.img_rect.width + } + height := if config.img_rect.height == 0 { + f32(img.height) + } else { + config.img_rect.height + } + C.darwin_draw_image(x, ctx.height - (y + config.img_rect.height), width, + height, img) return } }