Mercurial > sdl-ios-xcode
comparison src/video/dummy/SDL_nullrender.c @ 2267:c785543d1843
Okay, still some bugs, but everything builds again...
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 18 Aug 2007 05:39:09 +0000 |
parents | bee005ace1bf |
children | c3e7c0698cbb 99210400e8b9 |
comparison
equal
deleted
inserted
replaced
2266:e61ad15a205f | 2267:c785543d1843 |
---|---|
23 | 23 |
24 #include "SDL_video.h" | 24 #include "SDL_video.h" |
25 #include "../SDL_sysvideo.h" | 25 #include "../SDL_sysvideo.h" |
26 #include "../SDL_yuv_sw_c.h" | 26 #include "../SDL_yuv_sw_c.h" |
27 #include "../SDL_renderer_sw.h" | 27 #include "../SDL_renderer_sw.h" |
28 #include "../SDL_rendercopy.h" | |
29 | 28 |
30 | 29 |
31 /* SDL surface based renderer implementation */ | 30 /* SDL surface based renderer implementation */ |
32 | 31 |
33 static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window, | 32 static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window, |
158 dstrect->w, dstrect->h, pixels, | 157 dstrect->w, dstrect->h, pixels, |
159 target->pitch); | 158 target->pitch); |
160 } else { | 159 } else { |
161 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; | 160 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; |
162 SDL_Surface *target = data->screens[data->current_screen]; | 161 SDL_Surface *target = data->screens[data->current_screen]; |
163 SDL_RenderCopyFunc copyfunc = (SDL_RenderCopyFunc) surface->userdata; | 162 SDL_Rect real_srcrect = *srcrect; |
164 | 163 SDL_Rect real_dstrect = *dstrect; |
165 if (copyfunc) { | 164 |
166 SDL_RenderCopyData copydata; | 165 return SDL_LowerBlit(surface, &real_srcrect, target, &real_dstrect); |
167 | |
168 copydata.src = | |
169 (Uint8 *) surface->pixels + srcrect->y * surface->pitch + | |
170 srcrect->x * surface->format->BytesPerPixel; | |
171 copydata.src_w = srcrect->w; | |
172 copydata.src_h = srcrect->h; | |
173 copydata.src_pitch = surface->pitch; | |
174 copydata.dst = | |
175 (Uint8 *) target->pixels + dstrect->y * target->pitch + | |
176 dstrect->x * target->format->BytesPerPixel; | |
177 copydata.dst_w = dstrect->w; | |
178 copydata.dst_h = dstrect->h; | |
179 copydata.dst_pitch = target->pitch; | |
180 copydata.flags = 0; | |
181 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { | |
182 copydata.flags |= SDL_RENDERCOPY_MODULATE_COLOR; | |
183 copydata.r = texture->r; | |
184 copydata.g = texture->g; | |
185 copydata.b = texture->b; | |
186 } | |
187 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { | |
188 copydata.flags |= SDL_RENDERCOPY_MODULATE_ALPHA; | |
189 copydata.a = texture->a; | |
190 } | |
191 if (texture->blendMode & SDL_TEXTUREBLENDMODE_MASK) { | |
192 copydata.flags |= SDL_RENDERCOPY_MASK; | |
193 } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_BLEND) { | |
194 copydata.flags |= SDL_RENDERCOPY_BLEND; | |
195 } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_ADD) { | |
196 copydata.flags |= SDL_RENDERCOPY_ADD; | |
197 } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_MOD) { | |
198 copydata.flags |= SDL_RENDERCOPY_MOD; | |
199 } | |
200 if (texture->scaleMode) { | |
201 copydata.flags |= SDL_RENDERCOPY_NEAREST; | |
202 } | |
203 copyfunc(©data); | |
204 return 0; | |
205 } else { | |
206 SDL_Rect real_srcrect = *srcrect; | |
207 SDL_Rect real_dstrect = *dstrect; | |
208 | |
209 return SDL_LowerBlit(surface, &real_srcrect, target, | |
210 &real_dstrect); | |
211 } | |
212 } | 166 } |
213 } | 167 } |
214 | 168 |
215 static void | 169 static void |
216 SDL_DUMMY_RenderPresent(SDL_Renderer * renderer) | 170 SDL_DUMMY_RenderPresent(SDL_Renderer * renderer) |