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

Commit

Permalink
Changed placeholder for SDL_ReadPixels.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Aug 2, 2009
1 parent c95bbc3 commit 2549b47
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/automated/render/render.c
Expand Up @@ -56,7 +56,6 @@ static int render_compare( const char *msg, const SurfaceImage_t *s )
{
(void) msg;
(void) s;
#if 0
int ret;
void *pix;
SDL_Surface *testsur;
Expand All @@ -67,9 +66,26 @@ static int render_compare( const char *msg, const SurfaceImage_t *s )
return 1;

/* Read pixels. */
#if 0
ret = SDL_RenderReadPixels( NULL, pix, 80*4 );
if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
return 1;
#else
int i, j;
Uint8 *buf = pix;
const Uint8 *read_pix;
Uint8 *write_pix;
for (j=0; j<s->height; j++) {
for (i=0; i<s->width; i++) {
read_pix = &s->pixel_data[ (j*80 + i) * s->bytes_per_pixel ];
write_pix = &buf[ (j*80 + i) * 4 ];
write_pix[0] = read_pix[0];
write_pix[1] = read_pix[1];
write_pix[2] = read_pix[2];
write_pix[3] = SDL_ALPHA_OPAQUE;
}
}
#endif

/* Create surface. */
testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4,
Expand All @@ -85,7 +101,6 @@ static int render_compare( const char *msg, const SurfaceImage_t *s )
/* Clean up. */
SDL_FreeSurface( testsur );
free(pix);
#endif

return 0;
}
Expand Down

0 comments on commit 2549b47

Please sign in to comment.