comparison src/image.c @ 5:b5c649b6367b

core: implement sprites, closes #2440
author David Demelier <markand@malikania.fr>
date Mon, 06 Jan 2020 21:14:35 +0100
parents cd58eabb7fb4
children 63eaec5ceba9
comparison
equal deleted inserted replaced
4:cd58eabb7fb4 5:b5c649b6367b
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19 #include <assert.h>
19 #include <stdbool.h> 20 #include <stdbool.h>
20 21
21 #include <SDL_image.h> 22 #include <SDL_image.h>
22 23
23 #include "texture_p.h" 24 #include "texture_p.h"
24 25
25 struct texture * 26 struct texture *
26 image_openf(const char *path) 27 image_openf(const char *path)
27 { 28 {
29 assert(path);
30
28 return texture_from_surface(IMG_Load(path)); 31 return texture_from_surface(IMG_Load(path));
29 } 32 }
30 33
31 struct texture * 34 struct texture *
32 image_openb(const char *buffer, size_t size) 35 image_openb(const char *buffer, size_t size)
33 { 36 {
37 assert(buffer);
38
34 SDL_RWops *ops = SDL_RWFromConstMem(buffer, size); 39 SDL_RWops *ops = SDL_RWFromConstMem(buffer, size);
35 40
36 if (!ops) 41 if (!ops)
37 return NULL; 42 return NULL;
38 43