Mercurial > sdl-ios-xcode
changeset 3445:de72b49bb695
Refactored to use render_loadTestFace()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 18 Nov 2009 07:34:05 +0000 |
parents | 50fca98abc24 |
children | 0f969d273f65 |
files | test/automated/render/render.c |
diffstat | 1 files changed, 22 insertions(+), 102 deletions(-) [+] |
line wrap: on
line diff
--- a/test/automated/render/render.c Wed Nov 18 07:22:22 2009 +0000 +++ b/test/automated/render/render.c Wed Nov 18 07:34:05 2009 +0000 @@ -543,7 +543,6 @@ { int ret; SDL_Rect rect; - SDL_Surface *face; SDL_TextureID tface; int i, j, ni, nj; @@ -556,34 +555,15 @@ return 0; /* Create face surface. */ - face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, - img_face.width, img_face.height, 32, img_face.width*4, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); - if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) - return -1; - tface = SDL_CreateTextureFromSurface( 0, face ); - if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) + tface = render_loadTestFace(); + if (SDL_ATassert( "render_loadTestFace()", tface != 0)) return -1; /* Constant values. */ - rect.w = face->w; - rect.h = face->h; - ni = SCREEN_W - face->w; - nj = SCREEN_H - face->h; - - /* Clean up. */ - SDL_FreeSurface( face ); + rect.w = img_face.width; + rect.h = img_face.height; + ni = SCREEN_W - img_face.width; + nj = SCREEN_H - img_face.height; /* Loop blit. */ for (j=0; j <= nj; j+=4) { @@ -615,7 +595,6 @@ { int ret; SDL_Rect rect; - SDL_Surface *face; SDL_TextureID tface; int i, j, ni, nj; @@ -628,34 +607,15 @@ return 0; /* Create face surface. */ - face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, - img_face.width, img_face.height, 32, img_face.width*4, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); - if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) - return -1; - tface = SDL_CreateTextureFromSurface( 0, face ); - if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) + tface = render_loadTestFace(); + if (SDL_ATassert( "render_loadTestFace()", tface != 0)) return -1; /* Constant values. */ - rect.w = face->w; - rect.h = face->h; - ni = SCREEN_W - face->w; - nj = SCREEN_H - face->h; - - /* Clean up. */ - SDL_FreeSurface( face ); + rect.w = img_face.width; + rect.h = img_face.height; + ni = SCREEN_W - img_face.width; + nj = SCREEN_H - img_face.height; /* Test blitting with colour mod. */ for (j=0; j <= nj; j+=4) { @@ -693,7 +653,6 @@ { int ret; SDL_Rect rect; - SDL_Surface *face; SDL_TextureID tface; int i, j, ni, nj; @@ -706,34 +665,15 @@ return 0; /* Create face surface. */ - face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, - img_face.width, img_face.height, 32, img_face.width*4, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); - if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) - return -1; - tface = SDL_CreateTextureFromSurface( 0, face ); - if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) + tface = render_loadTestFace(); + if (SDL_ATassert( "render_loadTestFace()", tface != 0)) return -1; /* Constant values. */ - rect.w = face->w; - rect.h = face->h; - ni = SCREEN_W - face->w; - nj = SCREEN_H - face->h; - - /* Clean up. */ - SDL_FreeSurface( face ); + rect.w = img_face.width; + rect.h = img_face.height; + ni = SCREEN_W - img_face.width; + nj = SCREEN_H - img_face.height; /* Clear surface. */ if (render_clearScreen()) @@ -817,7 +757,6 @@ { int ret; SDL_Rect rect; - SDL_Surface *face; SDL_TextureID tface; int i, j, ni, nj; int mode; @@ -831,24 +770,8 @@ return 0; /* Create face surface. */ - face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, - img_face.width, img_face.height, 32, img_face.width*4, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); - if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) - return -1; - tface = SDL_CreateTextureFromSurface( 0, face ); - if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) + tface = render_loadTestFace(); + if (SDL_ATassert( "render_loadTestFace()", tface != 0)) return -1; /* Steps to take. */ @@ -856,11 +779,8 @@ nj = SCREEN_H - FACE_H; /* Constant values. */ - rect.w = face->w; - rect.h = face->h; - - /* Clean up. */ - SDL_FreeSurface( face ); + rect.w = img_face.width; + rect.h = img_face.height; /* Set alpha mod. */ ret = SDL_SetRenderDrawColor( 255, 255, 255, 100 );