diff libmlk-core/mlk/core/texture.c @ 486:d6757c30658e

core: rework errors
author David Demelier <markand@malikania.fr>
date Tue, 28 Feb 2023 13:04:13 +0100
parents 3ff1fe64d0cd
children 23559c7ccf47
line wrap: on
line diff
--- a/libmlk-core/mlk/core/texture.c	Tue Feb 28 08:40:35 2023 +0100
+++ b/libmlk-core/mlk/core/texture.c	Tue Feb 28 13:04:13 2023 +0100
@@ -20,7 +20,6 @@
 #include <string.h>
 
 #include "color.h"
-#include "error.h"
 #include "texture.h"
 #include "texture_p.h"
 #include "util.h"
@@ -68,7 +67,7 @@
 	};
 
 	if (SDL_SetTextureBlendMode(tex->handle, table[blend]) < 0)
-		return errorf("%s", SDL_GetError());
+		return MLK_ERR_SDL;
 
 	return 0;
 }
@@ -80,7 +79,7 @@
 	assert(alpha <= 255);
 
 	if (SDL_SetTextureAlphaMod(tex->handle, alpha) < 0)
-		return errorf("%s", SDL_GetError());
+		return MLK_ERR_SDL;
 
 	return 0;
 }
@@ -91,7 +90,7 @@
 	assert(mlk_texture_ok(tex));
 
 	if (SDL_SetTextureColorMod(tex->handle, MLK_COLOR_R(color), MLK_COLOR_G(color), MLK_COLOR_B(color)) < 0)
-		return errorf("%s", SDL_GetError());
+		return MLK_ERR_SDL;
 
 	return 0;
 }
@@ -109,7 +108,7 @@
 	};
 
 	if (SDL_RenderCopy(MLK__RENDERER(), tex->handle, NULL, &dst) < 0)
-		return errorf("%s", SDL_GetError());
+		return MLK_ERR_SDL;
 
 	return 0;
 }
@@ -140,7 +139,7 @@
 	};
 
 	if (SDL_RenderCopyEx(MLK__RENDERER(), tex->handle, &src, &dst, angle, NULL, SDL_FLIP_NONE) < 0)
-		return errorf("%s", SDL_GetError());
+		return MLK_ERR_SDL;
 
 	return 0;
 }