1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg: fix native image rendering with with/height=0

This commit is contained in:
Alexander Medvednikov 2023-01-30 16:06:18 +01:00
parent 38b02c908d
commit 1470eb6fa4

View File

@ -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
}
}