equal
deleted
inserted
replaced
206 |
206 |
207 static int |
207 static int |
208 SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) |
208 SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) |
209 { |
209 { |
210 SDL_WindowTextureData *data; |
210 SDL_WindowTextureData *data; |
211 SDL_Renderer *renderer = NULL; |
|
212 SDL_RendererInfo info; |
211 SDL_RendererInfo info; |
213 Uint32 i; |
212 Uint32 i; |
214 |
213 |
215 data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); |
214 data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); |
216 if (!data) { |
215 if (!data) { |
|
216 SDL_Renderer *renderer = NULL; |
217 SDL_RendererInfo info; |
217 SDL_RendererInfo info; |
218 int i; |
218 int i; |
219 const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); |
219 const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); |
220 |
220 |
221 /* Check to see if there's a specific driver requested */ |
221 /* Check to see if there's a specific driver requested */ |
265 if (data->pixels) { |
265 if (data->pixels) { |
266 SDL_free(data->pixels); |
266 SDL_free(data->pixels); |
267 data->pixels = NULL; |
267 data->pixels = NULL; |
268 } |
268 } |
269 |
269 |
270 if (SDL_GetRendererInfo(renderer, &info) < 0) { |
270 if (SDL_GetRendererInfo(data->renderer, &info) < 0) { |
271 return -1; |
271 return -1; |
272 } |
272 } |
273 |
273 |
274 /* Find the first format without an alpha channel */ |
274 /* Find the first format without an alpha channel */ |
275 *format = info.texture_formats[0]; |
275 *format = info.texture_formats[0]; |
279 *format = info.texture_formats[i]; |
279 *format = info.texture_formats[i]; |
280 break; |
280 break; |
281 } |
281 } |
282 } |
282 } |
283 |
283 |
284 data->texture = SDL_CreateTexture(renderer, *format, |
284 data->texture = SDL_CreateTexture(data->renderer, *format, |
285 SDL_TEXTUREACCESS_STREAMING, |
285 SDL_TEXTUREACCESS_STREAMING, |
286 window->w, window->h); |
286 window->w, window->h); |
287 if (!data->texture) { |
287 if (!data->texture) { |
288 return -1; |
288 return -1; |
289 } |
289 } |