comparison src/video/SDL_blendfillrect.c @ 3594:c8bed77b0386

Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects() Fixed line drawing so when blending a sequence of lines there are no overlapping pixels drawn.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 18 Dec 2009 07:41:59 +0000
parents b931bcfd94a0
children f7b03b6838cb
comparison
equal deleted inserted replaced
3593:b931bcfd94a0 3594:c8bed77b0386
199 SDL_Rect clipped; 199 SDL_Rect clipped;
200 200
201 if (!dst) { 201 if (!dst) {
202 SDL_SetError("Passed NULL destination surface"); 202 SDL_SetError("Passed NULL destination surface");
203 return -1; 203 return -1;
204 }
205
206 if (blendMode < SDL_BLENDMODE_BLEND) {
207 Uint32 color = SDL_MapRGBA(dst->format, r, g, b, a);
208 return SDL_FillRect(dst, rect, color);
209 } 204 }
210 205
211 /* This function doesn't work on surfaces < 8 bpp */ 206 /* This function doesn't work on surfaces < 8 bpp */
212 if (dst->format->BitsPerPixel < 8) { 207 if (dst->format->BitsPerPixel < 8) {
213 SDL_SetError("SDL_BlendFillRect(): Unsupported surface format"); 208 SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
277 int status = 0; 272 int status = 0;
278 273
279 if (!dst) { 274 if (!dst) {
280 SDL_SetError("Passed NULL destination surface"); 275 SDL_SetError("Passed NULL destination surface");
281 return -1; 276 return -1;
282 }
283
284 if (blendMode < SDL_BLENDMODE_BLEND) {
285 Uint32 color = SDL_MapRGBA(dst->format, r, g, b, a);
286 return SDL_FillRects(dst, rects, color);
287 } 277 }
288 278
289 /* This function doesn't work on surfaces < 8 bpp */ 279 /* This function doesn't work on surfaces < 8 bpp */
290 if (dst->format->BitsPerPixel < 8) { 280 if (dst->format->BitsPerPixel < 8) {
291 SDL_SetError("SDL_BlendFillRects(): Unsupported surface format"); 281 SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");