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

examples: fix viewer example (use the new stbi.load_from_memory_with_channels) (#16004)

This commit is contained in:
penguindark 2022-10-09 07:30:02 +02:00 committed by GitHub
parent 54197121bc
commit bce420c34d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,7 +228,7 @@ pub fn read_bytes_from_file(file_path string) []u8 {
fn (mut app App) load_texture_from_buffer(buf voidptr, buf_len int) (gfx.Image, int, int) { fn (mut app App) load_texture_from_buffer(buf voidptr, buf_len int) (gfx.Image, int, int) {
// load image // load image
stbi.set_flip_vertically_on_load(true) stbi.set_flip_vertically_on_load(true)
img := stbi.load_from_memory(buf, buf_len) or { img := stbi.load_from_memory_with_channels(buf, buf_len, 4) or {
eprintln('ERROR: Can not load image from buffer, file: [${app.item_list.lst[app.item_list.item_index]}].') eprintln('ERROR: Can not load image from buffer, file: [${app.item_list.lst[app.item_list.item_index]}].')
return app.logo_texture, app.logo_w, app.logo_h return app.logo_texture, app.logo_w, app.logo_h
// exit(1) // exit(1)