mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
gg: always use 4 channels in init_sokol_image (#16564)
This commit is contained in:
@ -117,14 +117,9 @@ pub fn load(path string) !Image {
|
||||
ext: ext
|
||||
data: 0
|
||||
}
|
||||
// flag := if ext == 'png' { C.STBI_rgb_alpha } else { 0 }
|
||||
desired_channels := if ext in ['png', 'jpg', 'jpeg'] { 4 } else { 0 }
|
||||
res.data = C.stbi_load(&char(path.str), &res.width, &res.height, &res.nr_channels,
|
||||
desired_channels)
|
||||
if desired_channels == 4 && res.nr_channels == 3 {
|
||||
// Fix an alpha png bug
|
||||
res.nr_channels = 4
|
||||
}
|
||||
C.STBI_rgb_alpha)
|
||||
|
||||
if isnil(res.data) {
|
||||
return error('stbi_image failed to load from "${path}"')
|
||||
}
|
||||
|
Reference in New Issue
Block a user