mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
stbi: change Image.data from voidptr to &u8, to reduce casts (#21977)
This commit is contained in:
parent
ef0457d6e3
commit
fdd0dab1c3
@ -42,7 +42,7 @@ pub mut:
|
|||||||
height int
|
height int
|
||||||
nr_channels int
|
nr_channels int
|
||||||
ok bool
|
ok bool
|
||||||
data voidptr
|
data &u8 = unsafe { nil }
|
||||||
ext string
|
ext string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,6 @@ pub fn load(path string, params LoadParams) !Image {
|
|||||||
mut res := Image{
|
mut res := Image{
|
||||||
ok: true
|
ok: true
|
||||||
ext: ext
|
ext: ext
|
||||||
data: 0
|
|
||||||
}
|
}
|
||||||
res.data = C.stbi_load(&char(path.str), &res.width, &res.height, &res.nr_channels,
|
res.data = C.stbi_load(&char(path.str), &res.width, &res.height, &res.nr_channels,
|
||||||
params.desired_channels)
|
params.desired_channels)
|
||||||
@ -139,7 +138,6 @@ pub fn load(path string, params LoadParams) !Image {
|
|||||||
pub fn load_from_memory(buf &u8, bufsize int, params LoadParams) !Image {
|
pub fn load_from_memory(buf &u8, bufsize int, params LoadParams) !Image {
|
||||||
mut res := Image{
|
mut res := Image{
|
||||||
ok: true
|
ok: true
|
||||||
data: 0
|
|
||||||
}
|
}
|
||||||
res.data = C.stbi_load_from_memory(buf, bufsize, &res.width, &res.height, &res.nr_channels,
|
res.data = C.stbi_load_from_memory(buf, bufsize, &res.width, &res.height, &res.nr_channels,
|
||||||
params.desired_channels)
|
params.desired_channels)
|
||||||
@ -162,7 +160,6 @@ pub fn resize_uint8(img &Image, output_w int, output_h int) !Image {
|
|||||||
mut res := Image{
|
mut res := Image{
|
||||||
ok: true
|
ok: true
|
||||||
ext: img.ext
|
ext: img.ext
|
||||||
data: 0
|
|
||||||
width: output_w
|
width: output_w
|
||||||
height: output_h
|
height: output_h
|
||||||
nr_channels: img.nr_channels
|
nr_channels: img.nr_channels
|
||||||
|
Loading…
x
Reference in New Issue
Block a user