comparison test/automated/render/render.c @ 3471:da53c4046c65

Use 45 degree lines for the diagonal test to avoid aliasing errors in line drawing.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 21 Nov 2009 06:28:25 +0000
parents 383c2058d973
children 2c07bb579922
comparison
equal deleted inserted replaced
3470:419f459f2f38 3471:da53c4046c65
429 if (SDL_ATassert( "SDL_RenderLine", ret == 0)) 429 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
430 return -1; 430 return -1;
431 ret = SDL_SetRenderDrawColor( 5, 105, 105, SDL_ALPHA_OPAQUE ); 431 ret = SDL_SetRenderDrawColor( 5, 105, 105, SDL_ALPHA_OPAQUE );
432 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) 432 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
433 return -1; 433 return -1;
434 ret = SDL_RenderLine( 0, 60, 80, 0 ); 434 ret = SDL_RenderLine( 0, 0, 29, 29 );
435 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
436 return -1;
437 ret = SDL_RenderLine( 29, 30, 0, 59 );
438 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
439 return -1;
440 ret = SDL_RenderLine( 79, 0, 50, 29 );
441 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
442 return -1;
443 ret = SDL_RenderLine( 79, 59, 50, 30 );
435 if (SDL_ATassert( "SDL_RenderLine", ret == 0)) 444 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
436 return -1; 445 return -1;
437 446
438 /* See if it's the same. */ 447 /* See if it's the same. */
439 if (render_compare( "Primitives output not the same.", &img_primitives )) 448 if (render_compare( "Primitives output not the same.", &img_primitives ))
1011 str = SDL_GetCurrentVideoDriver(); 1020 str = SDL_GetCurrentVideoDriver();
1012 if (SDL_ATassert( "SDL_GetCurrentVideoDriver", strcmp(driver,str)==0)) 1021 if (SDL_ATassert( "SDL_GetCurrentVideoDriver", strcmp(driver,str)==0))
1013 goto err_cleanup; 1022 goto err_cleanup;
1014 /* Create window. */ 1023 /* Create window. */
1015 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1024 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1016 80, 60, 0 ); 1025 80, 60, SDL_WINDOW_SHOWN );
1017 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 )) 1026 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
1018 goto err_cleanup; 1027 goto err_cleanup;
1019 /* Check title. */ 1028 /* Check title. */
1020 str = SDL_GetWindowTitle( wid ); 1029 str = SDL_GetWindowTitle( wid );
1021 if (SDL_ATassert( "SDL_GetWindowTitle", strcmp(msg,str)==0)) 1030 if (SDL_ATassert( "SDL_GetWindowTitle", strcmp(msg,str)==0))
1030 1039
1031 /* We have to recreate window each time, because opengl and opengles renderers */ 1040 /* We have to recreate window each time, because opengl and opengles renderers */
1032 /* both add SDL_WINDOW_OPENGL flag for window, that was last used */ 1041 /* both add SDL_WINDOW_OPENGL flag for window, that was last used */
1033 SDL_DestroyWindow(wid); 1042 SDL_DestroyWindow(wid);
1034 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1043 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1035 80, 60, 0 ); 1044 80, 60, SDL_WINDOW_SHOWN );
1036 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 )) 1045 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
1037 goto err_cleanup; 1046 goto err_cleanup;
1038 1047
1039 /* Get renderer info. */ 1048 /* Get renderer info. */
1040 ret = SDL_GetRenderDriverInfo( j, &renderer ); 1049 ret = SDL_GetRenderDriverInfo( j, &renderer );
1041 if (ret != 0) 1050 if (ret != 0)
1042 goto err_cleanup; 1051 goto err_cleanup;
1052
1043 /* Set testcase name. */ 1053 /* Set testcase name. */
1044 snprintf( msg, sizeof(msg), "Renderer %s", renderer.name ); 1054 snprintf( msg, sizeof(msg), "Renderer %s", renderer.name );
1045 SDL_ATprintVerbose( 1, " %d) %s\n", j+1, renderer.name ); 1055 SDL_ATprintVerbose( 1, " %d) %s\n", j+1, renderer.name );
1046 SDL_ATbegin( msg ); 1056 SDL_ATbegin( msg );
1057
1047 /* Set renderer. */ 1058 /* Set renderer. */
1048 ret = SDL_CreateRenderer( wid, j, 0 ); 1059 ret = SDL_CreateRenderer( wid, j, 0 );
1049 if (SDL_ATassert( "SDL_CreateRenderer", ret==0 )) 1060 if (SDL_ATassert( "SDL_CreateRenderer", ret==0 ))
1050 goto err_cleanup; 1061 goto err_cleanup;
1051 1062