Mercurial > molko
comparison src/libmlk-core/core/texture.c @ 419:1b4e61bdb9ab
core: introduce err.h
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 12 Oct 2022 15:06:18 +0200 |
parents | 460c78706989 |
children | 3edda1ce314c |
comparison
equal
deleted
inserted
replaced
418:ed61fef6e47b | 419:1b4e61bdb9ab |
---|---|
25 #include "texture_p.h" | 25 #include "texture_p.h" |
26 #include "util.h" | 26 #include "util.h" |
27 #include "window.h" | 27 #include "window.h" |
28 #include "window_p.h" | 28 #include "window_p.h" |
29 | 29 |
30 int | 30 enum mlk_err |
31 texture_new(struct texture *tex, unsigned int w, unsigned int h) | 31 texture_new(struct texture *tex, unsigned int w, unsigned int h) |
32 { | 32 { |
33 assert(tex); | 33 assert(tex); |
34 assert(w); | |
35 assert(h); | |
34 | 36 |
35 tex->handle = SDL_CreateTexture(RENDERER(), | 37 tex->handle = SDL_CreateTexture(RENDERER(), |
36 SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h); | 38 SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h); |
37 | 39 |
38 if (!tex->handle) { | 40 if (!tex->handle) { |
39 tex->w = tex->h = 0; | 41 tex->w = tex->h = 0; |
40 return errorf("%s", SDL_GetError()); | 42 return MLK_ERR_INTERNAL; |
41 } | 43 } |
42 | 44 |
43 tex->w = w; | 45 tex->w = w; |
44 tex->h = h; | 46 tex->h = h; |
45 | 47 |