Mercurial > sdl-ios-xcode
diff test/automated/render/render.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 | 5f038ec1a1af |
children | 64ce267332c6 |
line wrap: on
line diff
--- a/test/automated/render/render.c Fri Dec 18 08:19:18 2009 +0000 +++ b/test/automated/render/render.c Wed Dec 23 01:55:00 2009 +0000 @@ -341,9 +341,9 @@ */ /* Clear screen. */ - ret = SDL_RenderRect( NULL ); + ret = SDL_RenderFillRect( NULL ); /* - if (SDL_ATassert( "SDL_RenderRect", ret == 0)) + if (SDL_ATassert( "SDL_RenderFillRect", ret == 0)) return -1; */ @@ -413,8 +413,8 @@ ret = SDL_SetRenderDrawColor( 13, 73, 200, SDL_ALPHA_OPAQUE ); if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) return -1; - ret = SDL_RenderRect( &rect ); - if (SDL_ATassert( "SDL_RenderRect", ret == 0)) + ret = SDL_RenderFillRect( &rect ); + if (SDL_ATassert( "SDL_RenderFillRect", ret == 0)) return -1; /* Draw a rectangle. */ @@ -425,8 +425,8 @@ ret = SDL_SetRenderDrawColor( 200, 0, 100, SDL_ALPHA_OPAQUE ); if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) return -1; - ret = SDL_RenderRect( &rect ); - if (SDL_ATassert( "SDL_RenderRect", ret == 0)) + ret = SDL_RenderFillRect( &rect ); + if (SDL_ATassert( "SDL_RenderFillRect", ret == 0)) return -1; /* Draw some points like so: @@ -439,8 +439,8 @@ ret = SDL_SetRenderDrawColor( x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE ); if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) return -1; - ret = SDL_RenderPoint( x, y ); - if (SDL_ATassert( "SDL_RenderPoint", ret == 0)) + ret = SDL_RenderDrawPoint( x, y ); + if (SDL_ATassert( "SDL_RenderDrawPoint", ret == 0)) return -1; } } @@ -449,29 +449,29 @@ ret = SDL_SetRenderDrawColor( 0, 255, 0, SDL_ALPHA_OPAQUE ); if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) return -1; - ret = SDL_RenderLine( 0, 30, 80, 30 ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 0, 30, 80, 30 ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; ret = SDL_SetRenderDrawColor( 55, 55, 5, SDL_ALPHA_OPAQUE ); if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) return -1; - ret = SDL_RenderLine( 40, 30, 40, 60 ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 40, 30, 40, 60 ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; ret = SDL_SetRenderDrawColor( 5, 105, 105, SDL_ALPHA_OPAQUE ); if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) return -1; - ret = SDL_RenderLine( 0, 0, 29, 29 ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 0, 0, 29, 29 ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; - ret = SDL_RenderLine( 29, 30, 0, 59 ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 29, 30, 0, 59 ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; - ret = SDL_RenderLine( 79, 0, 50, 29 ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 79, 0, 50, 29 ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; - ret = SDL_RenderLine( 79, 59, 50, 30 ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 79, 59, 50, 30 ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; /* See if it's the same. */ @@ -506,8 +506,8 @@ ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE ); if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) return -1; - ret = SDL_RenderRect( NULL ); - if (SDL_ATassert( "SDL_RenderRect", ret == 0)) + ret = SDL_RenderFillRect( NULL ); + if (SDL_ATassert( "SDL_RenderFillRect", ret == 0)) return -1; rect.x = 10; rect.y = 25; @@ -519,8 +519,8 @@ ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_ADD ); if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) return -1; - ret = SDL_RenderRect( &rect ); - if (SDL_ATassert( "SDL_RenderRect", ret == 0)) + ret = SDL_RenderFillRect( &rect ); + if (SDL_ATassert( "SDL_RenderFillRect", ret == 0)) return -1; rect.x = 30; rect.y = 40; @@ -532,8 +532,8 @@ ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_BLEND ); if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) return -1; - ret = SDL_RenderRect( &rect ); - if (SDL_ATassert( "SDL_RenderRect", ret == 0)) + ret = SDL_RenderFillRect( &rect ); + if (SDL_ATassert( "SDL_RenderFillRect", ret == 0)) return -1; rect.x = 25; rect.y = 25; @@ -545,8 +545,8 @@ ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_MOD ); if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) return -1; - ret = SDL_RenderRect( &rect ); - if (SDL_ATassert( "SDL_RenderRect", ret == 0)) + ret = SDL_RenderFillRect( &rect ); + if (SDL_ATassert( "SDL_RenderFillRect", ret == 0)) return -1; /* Draw blended lines, lines for everyone. */ @@ -558,8 +558,8 @@ (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD ); if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) return -1; - ret = SDL_RenderLine( 0, 0, i, 59 ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 0, 0, i, 59 ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; } for (i=0; i<SCREEN_H; i+=2) { @@ -570,8 +570,8 @@ (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD ); if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) return -1; - ret = SDL_RenderLine( 0, 0, 79, i ); - if (SDL_ATassert( "SDL_RenderLine", ret == 0)) + ret = SDL_RenderDrawLine( 0, 0, 79, i ); + if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0)) return -1; } @@ -585,8 +585,8 @@ ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD ); if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) return -1; - ret = SDL_RenderPoint( i, j ); - if (SDL_ATassert( "SDL_RenderPoint", ret == 0)) + ret = SDL_RenderDrawPoint( i, j ); + if (SDL_ATassert( "SDL_RenderDrawPoint", ret == 0)) return -1; } }