changeset 424:2f4a8e166128

core: use err.h in image
author David Demelier <markand@malikania.fr>
date Sat, 15 Oct 2022 14:03:27 +0200
parents 63ebfa352ae1
children bf20b77968fd
files src/libmlk-core/core/image.c src/libmlk-core/core/image.h
diffstat 2 files changed, 2 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/libmlk-core/core/image.c	Sat Oct 15 14:00:38 2022 +0200
+++ b/src/libmlk-core/core/image.c	Sat Oct 15 14:03:27 2022 +0200
@@ -22,8 +22,6 @@
 
 #include "error.h"
 #include "texture.h"
-#include "vfs.h"
-#include "vfs_p.h"
 #include "window.h"
 #include "window_p.h"
 
@@ -47,7 +45,7 @@
 	assert(path);
 
 	if (!(tex->handle = IMG_LoadTexture(RENDERER(), path)))
-		return errorf("%s", SDL_GetError());
+		return ERR_INTERNAL;
 
 	dimensions(tex);
 
@@ -62,27 +60,9 @@
 	SDL_RWops *ops = SDL_RWFromConstMem(buffer, size);
 
 	if (!ops || !(tex->handle = IMG_LoadTexture_RW(RENDERER(), ops, 1)))
-		return errorf("%s", SDL_GetError());
+		return ERR_INTERNAL;
 
 	dimensions(tex);
 
 	return 0;
 }
-
-int
-image_openvfs(struct texture *tex, struct vfs_file *file)
-{
-	assert(tex);
-	assert(vfs_file_ok(file));
-
-	SDL_RWops *ops;
-
-	if (!(ops = vfs_to_rw(file)))
-		return -1;
-	if (!(tex->handle = IMG_LoadTexture_RW(RENDERER(), ops, 1)))
-		return errorf("%s", SDL_GetError());
-
-	dimensions(tex);
-
-	return 0;
-}
--- a/src/libmlk-core/core/image.h	Sat Oct 15 14:00:38 2022 +0200
+++ b/src/libmlk-core/core/image.h	Sat Oct 15 14:03:27 2022 +0200
@@ -24,7 +24,6 @@
 #include "core.h"
 
 struct texture;
-struct vfs_file;
 
 CORE_BEGIN_DECLS
 
@@ -34,10 +33,6 @@
 int
 image_openmem(struct texture *, const void *, size_t);
 
-int
-image_openvfs(struct texture *, struct vfs_file *);
-
-
 CORE_END_DECLS
 
 #endif /* !MLK_CORE_IMAGE_H */