~vcs-imports/libsdl/trunk

« back to all changes in this revision

Viewing changes to test/automated/render/render.c

  • Committer: slouken
  • Date: 2010-01-21 06:21:52 UTC
  • Revision ID: svn-v4:c70aab31-4412-0410-b14c-859654838e24:trunk/SDL:5525
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
static int render_testBlit (void);
44
44
static int render_testBlitColour (void);
45
45
static int render_testBlitAlpha (void);
46
 
static int render_testBlitBlendMode( SDL_TextureID tface, int mode );
 
46
static int render_testBlitBlendMode( SDL_Texture * tface, int mode );
47
47
static int render_testBlitBlend (void);
48
48
 
49
49
 
225
225
/**
226
226
 * @brief Loads the test face.
227
227
 */
228
 
static SDL_TextureID render_loadTestFace (void)
 
228
static SDL_Texture * render_loadTestFace (void)
229
229
{
230
230
   SDL_Surface *face;
231
 
   SDL_TextureID tface;
 
231
   SDL_Texture *tface;
232
232
 
233
233
   /* Create face surface. */
234
234
   face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
261
261
{
262
262
   int fail;
263
263
   int ret;
264
 
   SDL_TextureID tface;
 
264
   SDL_Texture *tface;
265
265
   Uint8 r, g, b;
266
266
 
267
267
   /* Get test face. */
296
296
{
297
297
   int fail;
298
298
   int ret;
299
 
   SDL_TextureID tface;
 
299
   SDL_Texture *tface;
300
300
   Uint8 a;
301
301
 
302
302
   /* Get test face. */
606
606
{
607
607
   int ret;
608
608
   SDL_Rect rect;
609
 
   SDL_TextureID tface;
 
609
   SDL_Texture *tface;
610
610
   int i, j, ni, nj;
611
611
 
612
612
   /* Clear surface. */
658
658
{
659
659
   int ret;
660
660
   SDL_Rect rect;
661
 
   SDL_TextureID tface;
 
661
   SDL_Texture *tface;
662
662
   int i, j, ni, nj;
663
663
 
664
664
   /* Clear surface. */
716
716
{
717
717
   int ret;
718
718
   SDL_Rect rect;
719
 
   SDL_TextureID tface;
 
719
   SDL_Texture *tface;
720
720
   int i, j, ni, nj;
721
721
 
722
722
   /* Clear surface. */
774
774
/**
775
775
 * @brief Tests a blend mode.
776
776
 */
777
 
static int render_testBlitBlendMode( SDL_TextureID tface, int mode )
 
777
static int render_testBlitBlendMode( SDL_Texture * tface, int mode )
778
778
{
779
779
   int ret;
780
780
   int i, j, ni, nj;
820
820
{
821
821
   int ret;
822
822
   SDL_Rect rect;
823
 
   SDL_TextureID tface;
 
823
   SDL_Texture *tface;
824
824
   int i, j, ni, nj;
825
825
   int mode;
826
826
 
1004
1004
   int ret;
1005
1005
   const char *driver, *str;
1006
1006
   char msg[256];
1007
 
   SDL_WindowID wid;
 
1007
   SDL_Window *w;
1008
1008
   SDL_RendererInfo renderer;
1009
1009
 
1010
1010
   /* Initializes the SDL subsystems. */
1054
1054
      if (SDL_ATassert( "SDL_GetCurrentVideoDriver", SDL_strcmp(driver,str)==0))
1055
1055
         goto err_cleanup;
1056
1056
      /* Create window. */
1057
 
      wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
 
1057
      w = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1058
1058
            80, 60, SDL_WINDOW_SHOWN );
1059
 
      if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
 
1059
      if (SDL_ATassert( "SDL_CreateWindow", w!=NULL ))
1060
1060
         goto err_cleanup;
1061
1061
      /* Check title. */
1062
 
      str = SDL_GetWindowTitle( wid );
 
1062
      str = SDL_GetWindowTitle( w );
1063
1063
      if (SDL_ATassert( "SDL_GetWindowTitle", SDL_strcmp(msg,str)==0))
1064
1064
         goto err_cleanup;
1065
1065
      /* Get renderers. */
1072
1072
 
1073
1073
         /* We have to recreate window each time, because opengl and opengles renderers */
1074
1074
         /* both add SDL_WINDOW_OPENGL flag for window, that was last used              */
1075
 
         SDL_DestroyWindow(wid);
1076
 
         wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
 
1075
         SDL_DestroyWindow(w);
 
1076
         w = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1077
1077
               80, 60, SDL_WINDOW_SHOWN );
1078
 
         if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
 
1078
         if (SDL_ATassert( "SDL_CreateWindow", w!=NULL ))
1079
1079
            goto err_cleanup;
1080
1080
 
1081
1081
         /* Get renderer info. */
1089
1089
         SDL_ATbegin( msg );
1090
1090
 
1091
1091
         /* Set renderer. */
1092
 
         ret = SDL_CreateRenderer( wid, j, 0 );
 
1092
         ret = SDL_CreateRenderer( w, j, 0 );
1093
1093
         if (SDL_ATassert( "SDL_CreateRenderer", ret==0 ))
1094
1094
            goto err_cleanup;
1095
1095