Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Refactored to use render_loadTestFace()
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Nov 18, 2009
1 parent 78c8da2 commit e81d4aa
Showing 1 changed file with 22 additions and 102 deletions.
124 changes: 22 additions & 102 deletions test/automated/render/render.c
Expand Up @@ -543,7 +543,6 @@ static int render_testBlit (void)
{
int ret;
SDL_Rect rect;
SDL_Surface *face;
SDL_TextureID tface;
int i, j, ni, nj;

Expand All @@ -556,34 +555,15 @@ static int render_testBlit (void)
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) {
Expand Down Expand Up @@ -615,7 +595,6 @@ static int render_testBlitColour (void)
{
int ret;
SDL_Rect rect;
SDL_Surface *face;
SDL_TextureID tface;
int i, j, ni, nj;

Expand All @@ -628,34 +607,15 @@ static int render_testBlitColour (void)
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) {
Expand Down Expand Up @@ -693,7 +653,6 @@ static int render_testBlitAlpha (void)
{
int ret;
SDL_Rect rect;
SDL_Surface *face;
SDL_TextureID tface;
int i, j, ni, nj;

Expand All @@ -706,34 +665,15 @@ static int render_testBlitAlpha (void)
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())
Expand Down Expand Up @@ -817,7 +757,6 @@ static int render_testBlitBlend (void)
{
int ret;
SDL_Rect rect;
SDL_Surface *face;
SDL_TextureID tface;
int i, j, ni, nj;
int mode;
Expand All @@ -831,36 +770,17 @@ static int render_testBlitBlend (void)
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. */
ni = SCREEN_W - FACE_W;
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 );
Expand Down

0 comments on commit e81d4aa

Please sign in to comment.