diff src/core/texture.c @ 97:58133933ea17

window: expose some data to avoid functions
author David Demelier <markand@malikania.fr>
date Mon, 30 Mar 2020 20:10:00 +0200
parents ed72843a7194
children
line wrap: on
line diff
--- a/src/core/texture.c	Mon Mar 30 20:05:00 2020 +0200
+++ b/src/core/texture.c	Mon Mar 30 20:10:00 2020 +0200
@@ -23,6 +23,7 @@
 #include "texture.h"
 #include "texture_p.h"
 #include "util.h"
+#include "window.h"
 #include "window_p.h"
 
 bool
@@ -30,7 +31,7 @@
 {
 	assert(tex);
 
-	tex->handle = SDL_CreateTexture(win.renderer,
+	tex->handle = SDL_CreateTexture(RENDERER(),
 	    SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h);
 
 	if (!tex->handle) {
@@ -64,7 +65,7 @@
 		.h = tex->h
 	};
 
-	SDL_RenderCopy(win.renderer, tex->handle, NULL, &dst);
+	SDL_RenderCopy(RENDERER(), tex->handle, NULL, &dst);
 }
 
 void
@@ -92,7 +93,7 @@
 		.h = dst_h
 	};
 
-	SDL_RenderCopyEx(win.renderer, tex->handle, &src, &dst, angle, NULL, SDL_FLIP_NONE);
+	SDL_RenderCopyEx(RENDERER(), tex->handle, &src, &dst, angle, NULL, SDL_FLIP_NONE);
 }
 
 void
@@ -114,7 +115,7 @@
 	assert(tex);
 	assert(surface);
 
-	if (!(tex->handle = SDL_CreateTextureFromSurface(win.renderer, surface))) {
+	if (!(tex->handle = SDL_CreateTextureFromSurface(RENDERER(), surface))) {
 		tex->w = tex->h = 0;
 		return error_sdl();
 	}