Fixed compiling with the latest API changes
This commit is contained in:
parent
3b68836c8d
commit
9623680313
3 changed files with 79 additions and 85 deletions
|
@ -9,8 +9,6 @@ LDFLAGS := `sdl-config --libs`
|
||||||
|
|
||||||
SRC := testsdl.c \
|
SRC := testsdl.c \
|
||||||
platform/platform.c \
|
platform/platform.c \
|
||||||
rwops/rwops.c \
|
|
||||||
rwops/TestSupportRWops.c \
|
|
||||||
rect/rect.c \
|
rect/rect.c \
|
||||||
surface/surface.c \
|
surface/surface.c \
|
||||||
render/render.c \
|
render/render.c \
|
||||||
|
@ -18,6 +16,8 @@ SRC := testsdl.c \
|
||||||
COMMON_SRC := SDL_at.c common/common.c
|
COMMON_SRC := SDL_at.c common/common.c
|
||||||
COMMON_INCLUDE := SDL_at.h
|
COMMON_INCLUDE := SDL_at.h
|
||||||
|
|
||||||
|
RWOPS_SRC := rwops/rwops.c rwops/TestSupportRWops_Generic.c
|
||||||
|
|
||||||
TESTS_ALL := testsdl \
|
TESTS_ALL := testsdl \
|
||||||
platform/platform \
|
platform/platform \
|
||||||
rwops/rwops \
|
rwops/rwops \
|
||||||
|
@ -35,14 +35,14 @@ all: $(TESTS_ALL)
|
||||||
test: all
|
test: all
|
||||||
@./testsdl
|
@./testsdl
|
||||||
|
|
||||||
testsdl: $(SRC) $(COMMON_SRC)
|
testsdl: $(SRC) $(RWOPS_SRC) $(COMMON_SRC)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(SRC) $(COMMON_SRC)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(SRC) $(RWOPS_SRC) $(COMMON_SRC)
|
||||||
|
|
||||||
platform/platform: platform/platform.c $(COMMON_INCLUDE) $(COMMON_SRC)
|
platform/platform: platform/platform.c $(COMMON_INCLUDE) $(COMMON_SRC)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ platform/platform.c $(COMMON_SRC) -DTEST_STANDALONE
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ platform/platform.c $(COMMON_SRC) -DTEST_STANDALONE
|
||||||
|
|
||||||
rwops/rwops: rwops/rwops.c $(COMMON_INCLUDE) $(COMMON_SRC)
|
rwops/rwops: $(RWOPS_SRC) $(COMMON_INCLUDE) $(COMMON_SRC)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rwops/rwops.c $(COMMON_SRC) -DTEST_STANDALONE
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(RWOPS_SRC) $(COMMON_SRC) -DTEST_STANDALONE
|
||||||
|
|
||||||
rect/rect: rect/rect.c $(COMMON_INCLUDE) $(COMMON_SRC)
|
rect/rect: rect/rect.c $(COMMON_INCLUDE) $(COMMON_SRC)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rect/rect.c $(COMMON_SRC) -DTEST_STANDALONE
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rect/rect.c $(COMMON_SRC) -DTEST_STANDALONE
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define FACE_W img_face.width
|
#define FACE_W img_face.width
|
||||||
#define FACE_H img_face.height
|
#define FACE_H img_face.height
|
||||||
|
|
||||||
|
static SDL_Renderer *renderer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prototypes.
|
* Prototypes.
|
||||||
|
@ -67,7 +68,7 @@ static int render_compare( const char *msg, const SurfaceImage_t *s, int allowab
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.w = 80;
|
rect.w = 80;
|
||||||
rect.h = 60;
|
rect.h = 60;
|
||||||
ret = SDL_RenderReadPixels( &rect, FORMAT, pix, 80*4 );
|
ret = SDL_RenderReadPixels(renderer, &rect, FORMAT, pix, 80*4 );
|
||||||
if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
|
if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ static int dump_screen( int index )
|
||||||
SDL_RendererInfo info;
|
SDL_RendererInfo info;
|
||||||
|
|
||||||
/* Read pixels. */
|
/* Read pixels. */
|
||||||
ret = SDL_RenderReadPixels( NULL, FORMAT, pix, 80*4 );
|
ret = SDL_RenderReadPixels(renderer, NULL, FORMAT, pix, 80*4 );
|
||||||
if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
|
if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ static int dump_screen( int index )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Dump surface. */
|
/* Dump surface. */
|
||||||
SDL_GetRendererInfo(&info);
|
SDL_GetRendererInfo(renderer,&info);
|
||||||
sprintf(name, "%s-%s-%d.bmp", SDL_GetCurrentVideoDriver(), info.name, index);
|
sprintf(name, "%s-%s-%d.bmp", SDL_GetCurrentVideoDriver(), info.name, index);
|
||||||
SDL_SaveBMP(testsur, name);
|
SDL_SaveBMP(testsur, name);
|
||||||
|
|
||||||
|
@ -140,14 +141,14 @@ static int render_hasDrawColor (void)
|
||||||
fail = 0;
|
fail = 0;
|
||||||
|
|
||||||
/* Set colour. */
|
/* Set colour. */
|
||||||
ret = SDL_SetRenderDrawColor( 100, 100, 100, 100 );
|
ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = SDL_GetRenderDrawColor( &r, &g, &b, &a );
|
ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
/* Restore natural. */
|
/* Restore natural. */
|
||||||
ret = SDL_SetRenderDrawColor( 0, 0, 0, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
|
|
||||||
|
@ -172,28 +173,28 @@ static int render_hasBlendModes (void)
|
||||||
|
|
||||||
fail = 0;
|
fail = 0;
|
||||||
|
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_BLEND );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = SDL_GetRenderDrawBlendMode( &mode );
|
ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = (mode != SDL_BLENDMODE_BLEND);
|
ret = (mode != SDL_BLENDMODE_BLEND);
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_ADD );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = SDL_GetRenderDrawBlendMode( &mode );
|
ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = (mode != SDL_BLENDMODE_ADD);
|
ret = (mode != SDL_BLENDMODE_ADD);
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = SDL_GetRenderDrawBlendMode( &mode );
|
ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
|
||||||
if (!render_isSupported(ret))
|
if (!render_isSupported(ret))
|
||||||
fail = 1;
|
fail = 1;
|
||||||
ret = (mode != SDL_BLENDMODE_NONE);
|
ret = (mode != SDL_BLENDMODE_NONE);
|
||||||
|
@ -229,7 +230,7 @@ static SDL_Texture * render_loadTestFace (void)
|
||||||
);
|
);
|
||||||
if (face == NULL)
|
if (face == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
tface = SDL_CreateTextureFromSurface( 0, face );
|
tface = SDL_CreateTextureFromSurface(renderer, 0, face );
|
||||||
SDL_FreeSurface(face);
|
SDL_FreeSurface(face);
|
||||||
|
|
||||||
return tface;
|
return tface;
|
||||||
|
@ -316,26 +317,26 @@ static int render_clearScreen (void)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Set colour. */
|
/* Set colour. */
|
||||||
ret = SDL_SetRenderDrawColor( 0, 0, 0, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
|
||||||
/*
|
/*
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Clear screen. */
|
/* Clear screen. */
|
||||||
ret = SDL_RenderFillRect( NULL );
|
ret = SDL_RenderFillRect(renderer, NULL );
|
||||||
/*
|
/*
|
||||||
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Set defaults. */
|
/* Set defaults. */
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
|
||||||
/*
|
/*
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
*/
|
*/
|
||||||
ret = SDL_SetRenderDrawColor( 255, 255, 255, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
|
||||||
/*
|
/*
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -358,7 +359,7 @@ static int render_testReadWrite (void)
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.w = 80;
|
rect.w = 80;
|
||||||
rect.h = 60;
|
rect.h = 60;
|
||||||
ret = SDL_RenderWritePixels( &rect, SDL_PIXELFORMAT_RGB24, img_primitives.pixel_data, img_primitives.width*img_primitives.bytes_per_pixel );
|
ret = SDL_RenderWritePixels(renderer, &rect, SDL_PIXELFORMAT_RGB24, img_primitives.pixel_data, img_primitives.width*img_primitives.bytes_per_pixel );
|
||||||
if (SDL_ATassert( "SDL_RenderWritePixels", ret==0) )
|
if (SDL_ATassert( "SDL_RenderWritePixels", ret==0) )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -392,10 +393,10 @@ static int render_testPrimitives (void)
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.w = 40;
|
rect.w = 40;
|
||||||
rect.h = 80;
|
rect.h = 80;
|
||||||
ret = SDL_SetRenderDrawColor( 13, 73, 200, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderFillRect( &rect );
|
ret = SDL_RenderFillRect(renderer, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -404,10 +405,10 @@ static int render_testPrimitives (void)
|
||||||
rect.y = 10;
|
rect.y = 10;
|
||||||
rect.w = 60;
|
rect.w = 60;
|
||||||
rect.h = 40;
|
rect.h = 40;
|
||||||
ret = SDL_SetRenderDrawColor( 200, 0, 100, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderFillRect( &rect );
|
ret = SDL_RenderFillRect(renderer, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -418,41 +419,41 @@ static int render_testPrimitives (void)
|
||||||
for (y=0; y<3; y++) {
|
for (y=0; y<3; y++) {
|
||||||
x = y % 2;
|
x = y % 2;
|
||||||
for (; x<80; x+=2) {
|
for (; x<80; x+=2) {
|
||||||
ret = SDL_SetRenderDrawColor( x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawPoint( x, y );
|
ret = SDL_RenderDrawPoint(renderer, x, y );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawPoint", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawPoint", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw some lines. */
|
/* Draw some lines. */
|
||||||
ret = SDL_SetRenderDrawColor( 0, 255, 0, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 0, 30, 80, 30 );
|
ret = SDL_RenderDrawLine(renderer, 0, 30, 80, 30 );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawColor( 55, 55, 5, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 40, 30, 40, 60 );
|
ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawColor( 5, 105, 105, SDL_ALPHA_OPAQUE );
|
ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 0, 0, 29, 29 );
|
ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 29, 30, 0, 59 );
|
ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 79, 0, 50, 29 );
|
ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 79, 59, 50, 30 );
|
ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -482,77 +483,77 @@ static int render_testPrimitivesBlend (void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Create some rectangles for each blend mode. */
|
/* Create some rectangles for each blend mode. */
|
||||||
ret = SDL_SetRenderDrawColor( 255, 255, 255, 0 );
|
ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderFillRect( NULL );
|
ret = SDL_RenderFillRect(renderer, NULL );
|
||||||
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
rect.x = 10;
|
rect.x = 10;
|
||||||
rect.y = 25;
|
rect.y = 25;
|
||||||
rect.w = 40;
|
rect.w = 40;
|
||||||
rect.h = 25;
|
rect.h = 25;
|
||||||
ret = SDL_SetRenderDrawColor( 240, 10, 10, 75 );
|
ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_ADD );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderFillRect( &rect );
|
ret = SDL_RenderFillRect(renderer, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
rect.x = 30;
|
rect.x = 30;
|
||||||
rect.y = 40;
|
rect.y = 40;
|
||||||
rect.w = 45;
|
rect.w = 45;
|
||||||
rect.h = 15;
|
rect.h = 15;
|
||||||
ret = SDL_SetRenderDrawColor( 10, 240, 10, 100 );
|
ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_BLEND );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderFillRect( &rect );
|
ret = SDL_RenderFillRect(renderer, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
rect.x = 25;
|
rect.x = 25;
|
||||||
rect.y = 25;
|
rect.y = 25;
|
||||||
rect.w = 25;
|
rect.w = 25;
|
||||||
rect.h = 25;
|
rect.h = 25;
|
||||||
ret = SDL_SetRenderDrawColor( 10, 10, 240, 125 );
|
ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_MOD );
|
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderFillRect( &rect );
|
ret = SDL_RenderFillRect(renderer, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_RenderFillRect", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Draw blended lines, lines for everyone. */
|
/* Draw blended lines, lines for everyone. */
|
||||||
for (i=0; i<SCREEN_W; i+=2) {
|
for (i=0; i<SCREEN_W; i+=2) {
|
||||||
ret = SDL_SetRenderDrawColor( 60+2*i, 240-2*i, 50, 3*i );
|
ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawBlendMode((((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
||||||
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD );
|
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 0, 0, i, 59 );
|
ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i=0; i<SCREEN_H; i+=2) {
|
for (i=0; i<SCREEN_H; i+=2) {
|
||||||
ret = SDL_SetRenderDrawColor( 60+2*i, 240-2*i, 50, 3*i );
|
ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawBlendMode((((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
||||||
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD );
|
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawLine( 0, 0, 79, i );
|
ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawLine", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -560,14 +561,14 @@ static int render_testPrimitivesBlend (void)
|
||||||
/* Draw points. */
|
/* Draw points. */
|
||||||
for (j=0; j<SCREEN_H; j+=3) {
|
for (j=0; j<SCREEN_H; j+=3) {
|
||||||
for (i=0; i<SCREEN_W; i+=3) {
|
for (i=0; i<SCREEN_W; i+=3) {
|
||||||
ret = SDL_SetRenderDrawColor( j*4, i*3, j*4, i*3 );
|
ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_SetRenderDrawBlendMode( ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
|
ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
|
||||||
((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD );
|
((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
|
||||||
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
ret = SDL_RenderDrawPoint( i, j );
|
ret = SDL_RenderDrawPoint(renderer, i, j );
|
||||||
if (SDL_ATassert( "SDL_RenderDrawPoint", ret == 0))
|
if (SDL_ATassert( "SDL_RenderDrawPoint", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -616,7 +617,7 @@ static int render_testBlit (void)
|
||||||
/* Blitting. */
|
/* Blitting. */
|
||||||
rect.x = i;
|
rect.x = i;
|
||||||
rect.y = j;
|
rect.y = j;
|
||||||
ret = SDL_RenderCopy( tface, NULL, &rect );
|
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -673,7 +674,7 @@ static int render_testBlitColour (void)
|
||||||
/* Blitting. */
|
/* Blitting. */
|
||||||
rect.x = i;
|
rect.x = i;
|
||||||
rect.y = j;
|
rect.y = j;
|
||||||
ret = SDL_RenderCopy( tface, NULL, &rect );
|
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -735,7 +736,7 @@ static int render_testBlitAlpha (void)
|
||||||
/* Blitting. */
|
/* Blitting. */
|
||||||
rect.x = i;
|
rect.x = i;
|
||||||
rect.y = j;
|
rect.y = j;
|
||||||
ret = SDL_RenderCopy( tface, NULL, &rect );
|
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -785,7 +786,7 @@ static int render_testBlitBlendMode( SDL_Texture * tface, int mode )
|
||||||
/* Blitting. */
|
/* Blitting. */
|
||||||
rect.x = i;
|
rect.x = i;
|
||||||
rect.y = j;
|
rect.y = j;
|
||||||
ret = SDL_RenderCopy( tface, NULL, &rect );
|
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -885,7 +886,7 @@ static int render_testBlitBlend (void)
|
||||||
/* Blitting. */
|
/* Blitting. */
|
||||||
rect.x = i;
|
rect.x = i;
|
||||||
rect.y = j;
|
rect.y = j;
|
||||||
ret = SDL_RenderCopy( tface, NULL, &rect );
|
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
|
||||||
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -973,7 +974,7 @@ int test_render (void)
|
||||||
const char *driver, *str;
|
const char *driver, *str;
|
||||||
char msg[256];
|
char msg[256];
|
||||||
SDL_Window *w;
|
SDL_Window *w;
|
||||||
SDL_RendererInfo renderer;
|
SDL_RendererInfo info;
|
||||||
|
|
||||||
/* Initializes the SDL subsystems. */
|
/* Initializes the SDL subsystems. */
|
||||||
ret = SDL_Init(0);
|
ret = SDL_Init(0);
|
||||||
|
@ -1014,7 +1015,7 @@ int test_render (void)
|
||||||
*/
|
*/
|
||||||
SDL_ATbegin( "Initializing video mode" );
|
SDL_ATbegin( "Initializing video mode" );
|
||||||
/* Initialize video mode. */
|
/* Initialize video mode. */
|
||||||
ret = SDL_VideoInit( driver, 0 );
|
ret = SDL_VideoInit( driver );
|
||||||
if (SDL_ATvassert( ret==0, "SDL_VideoInit( %s, 0 )", driver ))
|
if (SDL_ATvassert( ret==0, "SDL_VideoInit( %s, 0 )", driver ))
|
||||||
goto err_cleanup;
|
goto err_cleanup;
|
||||||
/* Check to see if it's the one we want. */
|
/* Check to see if it's the one we want. */
|
||||||
|
@ -1047,18 +1048,18 @@ int test_render (void)
|
||||||
goto err_cleanup;
|
goto err_cleanup;
|
||||||
|
|
||||||
/* Get renderer info. */
|
/* Get renderer info. */
|
||||||
ret = SDL_GetRenderDriverInfo( j, &renderer );
|
ret = SDL_GetRenderDriverInfo( j, &info );
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto err_cleanup;
|
goto err_cleanup;
|
||||||
|
|
||||||
/* Set testcase name. */
|
/* Set testcase name. */
|
||||||
SDL_snprintf( msg, sizeof(msg), "Renderer %s", renderer.name );
|
SDL_snprintf( msg, sizeof(msg), "Renderer %s", info.name );
|
||||||
SDL_ATprintVerbose( 1, " %d) %s\n", j+1, renderer.name );
|
SDL_ATprintVerbose( 1, " %d) %s\n", j+1, info.name );
|
||||||
SDL_ATbegin( msg );
|
SDL_ATbegin( msg );
|
||||||
|
|
||||||
/* Set renderer. */
|
/* Set renderer. */
|
||||||
ret = SDL_CreateRenderer( w, j, 0 );
|
renderer = SDL_CreateRenderer( w, j, 0 );
|
||||||
if (SDL_ATassert( "SDL_CreateRenderer", ret==0 ))
|
if (SDL_ATassert( "SDL_CreateRenderer", renderer!=0 ))
|
||||||
goto err_cleanup;
|
goto err_cleanup;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
13
test/automated/surface/surface.c
Normal file → Executable file
13
test/automated/surface/surface.c
Normal file → Executable file
|
@ -203,13 +203,6 @@ static void surface_testPrimitivesBlend( SDL_Surface *testsur )
|
||||||
rect.w = 45;
|
rect.w = 45;
|
||||||
rect.h = 15;
|
rect.h = 15;
|
||||||
ret = SDL_BlendFillRect( testsur, &rect, SDL_BLENDMODE_BLEND, 10, 240, 10, 100 );
|
ret = SDL_BlendFillRect( testsur, &rect, SDL_BLENDMODE_BLEND, 10, 240, 10, 100 );
|
||||||
if (SDL_ATassert( "SDL_BlendFillRect", ret == 0))
|
|
||||||
return;
|
|
||||||
rect.x = 25;
|
|
||||||
rect.y = 25;
|
|
||||||
rect.w = 25;
|
|
||||||
rect.h = 25;
|
|
||||||
ret = SDL_BlendFillRect( testsur, &rect, SDL_BLENDMODE_MOD, 10, 10, 240, 125 );
|
|
||||||
if (SDL_ATassert( "SDL_BlendFillRect", ret == 0))
|
if (SDL_ATassert( "SDL_BlendFillRect", ret == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -217,7 +210,7 @@ static void surface_testPrimitivesBlend( SDL_Surface *testsur )
|
||||||
for (i=0; i<testsur->w; i+=2) {
|
for (i=0; i<testsur->w; i+=2) {
|
||||||
ret = SDL_BlendLine( testsur, 0, 0, i, 59,
|
ret = SDL_BlendLine( testsur, 0, 0, i, 59,
|
||||||
(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
||||||
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD,
|
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE,
|
||||||
60+2*i, 240-2*i, 50, 3*i );
|
60+2*i, 240-2*i, 50, 3*i );
|
||||||
if (SDL_ATassert( "SDL_BlendLine", ret == 0))
|
if (SDL_ATassert( "SDL_BlendLine", ret == 0))
|
||||||
return;
|
return;
|
||||||
|
@ -225,7 +218,7 @@ static void surface_testPrimitivesBlend( SDL_Surface *testsur )
|
||||||
for (i=0; i<testsur->h; i+=2) {
|
for (i=0; i<testsur->h; i+=2) {
|
||||||
ret = SDL_BlendLine( testsur, 0, 0, 79, i,
|
ret = SDL_BlendLine( testsur, 0, 0, 79, i,
|
||||||
(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
|
||||||
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD,
|
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE,
|
||||||
60+2*i, 240-2*i, 50, 3*i );
|
60+2*i, 240-2*i, 50, 3*i );
|
||||||
if (SDL_ATassert( "SDL_BlendLine", ret == 0))
|
if (SDL_ATassert( "SDL_BlendLine", ret == 0))
|
||||||
return;
|
return;
|
||||||
|
@ -236,7 +229,7 @@ static void surface_testPrimitivesBlend( SDL_Surface *testsur )
|
||||||
for (i=0; i<testsur->w; i+=3) {
|
for (i=0; i<testsur->w; i+=3) {
|
||||||
ret = SDL_BlendPoint( testsur, i, j,
|
ret = SDL_BlendPoint( testsur, i, j,
|
||||||
((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
|
((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
|
||||||
((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD,
|
((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE,
|
||||||
j*4, i*3, j*4, i*3 );
|
j*4, i*3, j*4, i*3 );
|
||||||
if (SDL_ATassert( "SDL_BlendPoint", ret == 0))
|
if (SDL_ATassert( "SDL_BlendPoint", ret == 0))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue