Mercurial > sdl-ios-xcode
comparison src/video/dummy/SDL_nullrender.c @ 2901:133601e3b255
Added RenderPiont() API
Merged the drawing tests into a single test program
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 21 Dec 2008 17:39:41 +0000 |
parents | 32e8bbba1e94 |
children | 2133d2d300fd |
comparison
equal
deleted
inserted
replaced
2900:3a9636c83849 | 2901:133601e3b255 |
---|---|
31 | 31 |
32 static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window, | 32 static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window, |
33 Uint32 flags); | 33 Uint32 flags); |
34 static int SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer); | 34 static int SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer); |
35 static int SDL_DUMMY_SetDrawBlendMode(SDL_Renderer * renderer); | 35 static int SDL_DUMMY_SetDrawBlendMode(SDL_Renderer * renderer); |
36 static int SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y); | |
36 static int SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1, | 37 static int SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1, |
37 int x2, int y2); | 38 int x2, int y2); |
38 static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer, | 39 static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer, |
39 const SDL_Rect * rect); | 40 const SDL_Rect * rect); |
40 static int SDL_DUMMY_RenderCopy(SDL_Renderer * renderer, | 41 static int SDL_DUMMY_RenderCopy(SDL_Renderer * renderer, |
92 } | 93 } |
93 SDL_zerop(data); | 94 SDL_zerop(data); |
94 | 95 |
95 renderer->SetDrawColor = SDL_DUMMY_SetDrawColor; | 96 renderer->SetDrawColor = SDL_DUMMY_SetDrawColor; |
96 renderer->SetDrawBlendMode = SDL_DUMMY_SetDrawBlendMode; | 97 renderer->SetDrawBlendMode = SDL_DUMMY_SetDrawBlendMode; |
98 renderer->RenderPoint = SDL_DUMMY_RenderPoint; | |
97 renderer->RenderLine = SDL_DUMMY_RenderLine; | 99 renderer->RenderLine = SDL_DUMMY_RenderLine; |
98 renderer->RenderFill = SDL_DUMMY_RenderFill; | 100 renderer->RenderFill = SDL_DUMMY_RenderFill; |
99 renderer->RenderCopy = SDL_DUMMY_RenderCopy; | 101 renderer->RenderCopy = SDL_DUMMY_RenderCopy; |
100 renderer->RenderPresent = SDL_DUMMY_RenderPresent; | 102 renderer->RenderPresent = SDL_DUMMY_RenderPresent; |
101 renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer; | 103 renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer; |
141 { | 143 { |
142 return 0; | 144 return 0; |
143 } | 145 } |
144 | 146 |
145 static int | 147 static int |
146 SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) | 148 SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y) |
147 { | 149 { |
148 SDL_DUMMY_RenderData *data = | 150 SDL_DUMMY_RenderData *data = |
149 (SDL_DUMMY_RenderData *) renderer->driverdata; | 151 (SDL_DUMMY_RenderData *) renderer->driverdata; |
150 SDL_Surface *target = data->screens[data->current_screen]; | 152 SDL_Surface *target = data->screens[data->current_screen]; |
151 int status; | 153 int status; |
152 | 154 |
153 if (renderer->blendMode == SDL_BLENDMODE_NONE) { | 155 if (renderer->blendMode == SDL_BLENDMODE_NONE || |
156 renderer->blendMode == SDL_BLENDMODE_MASK) { | |
157 Uint32 color = | |
158 SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, | |
159 renderer->a); | |
160 | |
161 status = SDL_DrawPoint(target, x, y, color); | |
162 } else { | |
163 status = | |
164 SDL_BlendPoint(target, x, y, renderer->blendMode, renderer->r, | |
165 renderer->g, renderer->b, renderer->a); | |
166 } | |
167 return status; | |
168 } | |
169 | |
170 static int | |
171 SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) | |
172 { | |
173 SDL_DUMMY_RenderData *data = | |
174 (SDL_DUMMY_RenderData *) renderer->driverdata; | |
175 SDL_Surface *target = data->screens[data->current_screen]; | |
176 int status; | |
177 | |
178 if (renderer->blendMode == SDL_BLENDMODE_NONE || | |
179 renderer->blendMode == SDL_BLENDMODE_MASK) { | |
154 Uint32 color = | 180 Uint32 color = |
155 SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, | 181 SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, |
156 renderer->a); | 182 renderer->a); |
157 | 183 |
158 status = SDL_DrawLine(target, x1, y1, x2, y2, color); | 184 status = SDL_DrawLine(target, x1, y1, x2, y2, color); |