From d04a3e52e32f9e4ed5929faddadc6ee14b7ffd66 Mon Sep 17 00:00:00 2001 From: Peyton Creery <44987569+phcreery@users.noreply.github.com> Date: Mon, 4 Sep 2023 01:24:34 -0500 Subject: [PATCH] stbi: add LoadParams to load_from_memory() as well (#19268) --- vlib/stbi/stbi.c.v | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vlib/stbi/stbi.c.v b/vlib/stbi/stbi.c.v index 37f4aec7ca..8882ddc493 100644 --- a/vlib/stbi/stbi.c.v +++ b/vlib/stbi/stbi.c.v @@ -135,14 +135,13 @@ pub fn load(path string, params LoadParams) !Image { } // load_from_memory load an image from a memory buffer -pub fn load_from_memory(buf &u8, bufsize int) !Image { +pub fn load_from_memory(buf &u8, bufsize int, params LoadParams) !Image { mut res := Image{ ok: true data: 0 } - flag := C.STBI_rgb_alpha res.data = C.stbi_load_from_memory(buf, bufsize, &res.width, &res.height, &res.nr_channels, - flag) + params.desired_channels) if isnil(res.data) { return error('stbi_image failed to load from memory') }