comparison test/automated/surface/surface.c @ 3596:f638ded38b8a

Added SDL_RenderClear() as a fast method of clearing the screen to the drawing color. Renamed SDL_RenderPoint() and SDL_RenderLine() to SDL_RenderDrawPoint() and SDL_RenderDrawLine(). Added API for rectangle drawing (as opposed to filling) Added placeholder API functions for circles and ellipses ... I'm not sure whether these will stay. Optimized software line drawing quite a bit. Added support for Wu's anti-aliased line drawing, currently disabled by default.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 23 Dec 2009 01:55:00 +0000
parents c32c53fca10d
children 947201caa46e
comparison
equal deleted inserted replaced
3595:b7c6828d4039 3596:f638ded38b8a
54 if (SDL_ATassert( "SDL_CreateLoadBmp", face != NULL)) 54 if (SDL_ATassert( "SDL_CreateLoadBmp", face != NULL))
55 return; 55 return;
56 56
57 /* Set transparent pixel as the pixel at (0,0) */ 57 /* Set transparent pixel as the pixel at (0,0) */
58 if (face->format->palette) { 58 if (face->format->palette) {
59 ret = SDL_SetColorKey(face, (SDL_SRCCOLORKEY | SDL_RLEACCEL), 59 ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
60 *(Uint8 *) face->pixels);
61 if (SDL_ATassert( "SDL_SetColorKey", ret == 0)) 60 if (SDL_ATassert( "SDL_SetColorKey", ret == 0))
62 return; 61 return;
63 } 62 }
64 63
65 /* Convert to 32 bit to compare. */ 64 /* Convert to 32 bit to compare. */
182 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); 181 SDL_MapRGB( testsur->format, 0, 0, 0 ) );
183 if (SDL_ATassert( "SDL_FillRect", ret == 0)) 182 if (SDL_ATassert( "SDL_FillRect", ret == 0))
184 return; 183 return;
185 184
186 /* Create some rectangles for each blend mode. */ 185 /* Create some rectangles for each blend mode. */
187 ret = SDL_BlendRect( testsur, NULL, SDL_BLENDMODE_NONE, 255, 255, 255, 0 ); 186 ret = SDL_BlendFillRect( testsur, NULL, SDL_BLENDMODE_NONE, 255, 255, 255, 0 );
188 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) 187 if (SDL_ATassert( "SDL_BlendFillRect", ret == 0))
189 return; 188 return;
190 rect.x = 10; 189 rect.x = 10;
191 rect.y = 25; 190 rect.y = 25;
192 rect.w = 40; 191 rect.w = 40;
193 rect.h = 25; 192 rect.h = 25;
194 ret = SDL_BlendRect( testsur, &rect, SDL_BLENDMODE_ADD, 240, 10, 10, 75 ); 193 ret = SDL_BlendFillRect( testsur, &rect, SDL_BLENDMODE_ADD, 240, 10, 10, 75 );
195 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) 194 if (SDL_ATassert( "SDL_BlendFillRect", ret == 0))
196 return; 195 return;
197 rect.x = 30; 196 rect.x = 30;
198 rect.y = 40; 197 rect.y = 40;
199 rect.w = 45; 198 rect.w = 45;
200 rect.h = 15; 199 rect.h = 15;
201 ret = SDL_BlendRect( testsur, &rect, SDL_BLENDMODE_BLEND, 10, 240, 10, 100 ); 200 ret = SDL_BlendFillRect( testsur, &rect, SDL_BLENDMODE_BLEND, 10, 240, 10, 100 );
202 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) 201 if (SDL_ATassert( "SDL_BlendFillRect", ret == 0))
203 return; 202 return;
204 rect.x = 25; 203 rect.x = 25;
205 rect.y = 25; 204 rect.y = 25;
206 rect.w = 25; 205 rect.w = 25;
207 rect.h = 25; 206 rect.h = 25;
208 ret = SDL_BlendRect( testsur, &rect, SDL_BLENDMODE_MOD, 10, 10, 240, 125 ); 207 ret = SDL_BlendFillRect( testsur, &rect, SDL_BLENDMODE_MOD, 10, 10, 240, 125 );
209 if (SDL_ATassert( "SDL_BlendRect", ret == 0)) 208 if (SDL_ATassert( "SDL_BlendFillRect", ret == 0))
210 return; 209 return;
211 210
212 /* Draw blended lines, lines for everyone. */ 211 /* Draw blended lines, lines for everyone. */
213 for (i=0; i<testsur->w; i+=2) { 212 for (i=0; i<testsur->w; i+=2) {
214 ret = SDL_BlendLine( testsur, 0, 0, i, 59, 213 ret = SDL_BlendLine( testsur, 0, 0, i, 59,