comparison src/render/SDL_render.c @ 5169:4d39eeaad00b

Added a way to get a framebuffer interface for a window, and also a way to create a software renderer for an arbitrary surface. The software renderer has been re-routed to use the framebuffer interface, which makes it possible to have software rendering available even on simple ports.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 03 Feb 2011 15:49:37 -0800
parents b3ccd1947786
children 4d098d286794
comparison
equal deleted inserted replaced
5168:2b1989f59674 5169:4d39eeaad00b
24 /* The SDL 2D rendering system */ 24 /* The SDL 2D rendering system */
25 25
26 #include "SDL_render.h" 26 #include "SDL_render.h"
27 #include "SDL_sysrender.h" 27 #include "SDL_sysrender.h"
28 #include "../video/SDL_pixels_c.h" 28 #include "../video/SDL_pixels_c.h"
29 #include "software/SDL_renderer_sw_c.h"
29 30
30 31
31 #define CHECK_RENDERER_MAGIC(renderer, retval) \ 32 #define CHECK_RENDERER_MAGIC(renderer, retval) \
32 if (!renderer || renderer->magic != &renderer_magic) { \ 33 if (!renderer || renderer->magic != &renderer_magic) { \
33 SDL_SetError("Invalid renderer"); \ 34 SDL_SetError("Invalid renderer"); \
135 renderer = render_drivers[index]->CreateRenderer(window, flags); 136 renderer = render_drivers[index]->CreateRenderer(window, flags);
136 } 137 }
137 138
138 if (renderer) { 139 if (renderer) {
139 renderer->magic = &renderer_magic; 140 renderer->magic = &renderer_magic;
141 renderer->window = window;
140 142
141 SDL_AddEventWatch(SDL_RendererEventWatch, renderer); 143 SDL_AddEventWatch(SDL_RendererEventWatch, renderer);
142 } 144 }
143 return renderer; 145 return renderer;
146 }
147
148 SDL_Renderer *
149 SDL_CreateSoftwareRenderer(SDL_Surface * surface)
150 {
151 return SW_CreateRendererForSurface(surface);
144 } 152 }
145 153
146 int 154 int
147 SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info) 155 SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info)
148 { 156 {