comparison libmlk-core/mlk/core/texture.c @ 485:3ff1fe64d0cd

core: window -> mlk_window
author David Demelier <markand@malikania.fr>
date Tue, 28 Feb 2023 08:40:35 +0100
parents bc5483849614
children d6757c30658e
comparison
equal deleted inserted replaced
484:f14b8290b3ce 485:3ff1fe64d0cd
32 { 32 {
33 assert(tex); 33 assert(tex);
34 assert(w); 34 assert(w);
35 assert(h); 35 assert(h);
36 36
37 tex->handle = SDL_CreateTexture(RENDERER(), 37 tex->handle = SDL_CreateTexture(MLK__RENDERER(),
38 SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h); 38 SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h);
39 39
40 if (!tex->handle) { 40 if (!tex->handle) {
41 tex->w = tex->h = 0; 41 tex->w = tex->h = 0;
42 return MLK_ERR_SDL; 42 return MLK_ERR_SDL;
106 .y = y, 106 .y = y,
107 .w = tex->w, 107 .w = tex->w,
108 .h = tex->h 108 .h = tex->h
109 }; 109 };
110 110
111 if (SDL_RenderCopy(RENDERER(), tex->handle, NULL, &dst) < 0) 111 if (SDL_RenderCopy(MLK__RENDERER(), tex->handle, NULL, &dst) < 0)
112 return errorf("%s", SDL_GetError()); 112 return errorf("%s", SDL_GetError());
113 113
114 return 0; 114 return 0;
115 } 115 }
116 116
137 .y = dst_y, 137 .y = dst_y,
138 .w = dst_w, 138 .w = dst_w,
139 .h = dst_h 139 .h = dst_h
140 }; 140 };
141 141
142 if (SDL_RenderCopyEx(RENDERER(), tex->handle, &src, &dst, angle, NULL, SDL_FLIP_NONE) < 0) 142 if (SDL_RenderCopyEx(MLK__RENDERER(), tex->handle, &src, &dst, angle, NULL, SDL_FLIP_NONE) < 0)
143 return errorf("%s", SDL_GetError()); 143 return errorf("%s", SDL_GetError());
144 144
145 return 0; 145 return 0;
146 } 146 }
147 147
162 texture_from_surface(struct mlk_texture *tex, SDL_Surface *surface) 162 texture_from_surface(struct mlk_texture *tex, SDL_Surface *surface)
163 { 163 {
164 assert(tex); 164 assert(tex);
165 assert(surface); 165 assert(surface);
166 166
167 if (!(tex->handle = SDL_CreateTextureFromSurface(RENDERER(), surface))) { 167 if (!(tex->handle = SDL_CreateTextureFromSurface(MLK__RENDERER(), surface))) {
168 tex->w = tex->h = 0; 168 tex->w = tex->h = 0;
169 return MLK_ERR_SDL; 169 return MLK_ERR_SDL;
170 } 170 }
171 171
172 tex->w = surface->w; 172 tex->w = surface->w;