comparison test/automated/render/render.c @ 3453:bb35055cb101

Fixed a bunch of bugs in the blit blend mode tests
author Sam Lantinga <slouken@libsdl.org>
date Wed, 18 Nov 2009 09:39:32 +0000
parents 7bd010656baf
children 09136f534198
comparison
equal deleted inserted replaced
3452:1f1a41879fe4 3453:bb35055cb101
730 730
731 /* Test blend mode. */ 731 /* Test blend mode. */
732 for (j=0; j <= nj; j+=4) { 732 for (j=0; j <= nj; j+=4) {
733 for (i=0; i <= ni; i+=4) { 733 for (i=0; i <= ni; i+=4) {
734 /* Set blend mode. */ 734 /* Set blend mode. */
735 ret = SDL_SetRenderDrawBlendMode( mode ); 735 ret = SDL_SetTextureBlendMode( tface, mode );
736 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) 736 if (SDL_ATassert( "SDL_SetTextureBlendMode", ret == 0))
737 return -1; 737 return -1;
738 738
739 /* Blitting. */ 739 /* Blitting. */
740 rect.x = i; 740 rect.x = i;
741 rect.y = j; 741 rect.y = j;
780 /* Constant values. */ 780 /* Constant values. */
781 rect.w = img_face.width; 781 rect.w = img_face.width;
782 rect.h = img_face.height; 782 rect.h = img_face.height;
783 783
784 /* Set alpha mod. */ 784 /* Set alpha mod. */
785 ret = SDL_SetRenderDrawColor( 255, 255, 255, 100 ); 785 ret = SDL_SetTextureAlphaMod( tface, 100 );
786 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) 786 if (SDL_ATassert( "SDL_SetTextureAlphaMod", ret == 0))
787 return -1; 787 return -1;
788 788
789 /* Test None. */ 789 /* Test None. */
790 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE )) 790 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE ))
791 return -1; 791 return -1;
829 /* Loop blit. */ 829 /* Loop blit. */
830 for (j=0; j <= nj; j+=4) { 830 for (j=0; j <= nj; j+=4) {
831 for (i=0; i <= ni; i+=4) { 831 for (i=0; i <= ni; i+=4) {
832 832
833 /* Set colour mod. */ 833 /* Set colour mod. */
834 ret = SDL_SetRenderDrawColor( (255/nj)*j, (255/ni)*i, (255/nj)*j, (100/ni)*i ); 834 ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
835 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) 835 if (SDL_ATassert( "SDL_SetTextureColorMod", ret == 0))
836 return -1;
837
838 /* Set alpha mod. */
839 ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
840 if (SDL_ATassert( "SDL_SetTextureAlphaMod", ret == 0))
836 return -1; 841 return -1;
837 842
838 /* Crazy blending mode magic. */ 843 /* Crazy blending mode magic. */
839 mode = (i/4*j/4) % 4; 844 mode = (i/4*j/4) % 4;
840 if (mode==0) mode = SDL_BLENDMODE_MASK; 845 if (mode==0) mode = SDL_BLENDMODE_MASK;
841 else if (mode==1) mode = SDL_BLENDMODE_BLEND; 846 else if (mode==1) mode = SDL_BLENDMODE_BLEND;
842 else if (mode==2) mode = SDL_BLENDMODE_ADD; 847 else if (mode==2) mode = SDL_BLENDMODE_ADD;
843 else if (mode==3) mode = SDL_BLENDMODE_MOD; 848 else if (mode==3) mode = SDL_BLENDMODE_MOD;
844 ret = SDL_SetRenderDrawBlendMode( mode ); 849 ret = SDL_SetTextureBlendMode( tface, mode );
845 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) 850 if (SDL_ATassert( "SDL_SetTextureBlendMode", ret == 0))
846 return -1; 851 return -1;
847 852
848 /* Blitting. */ 853 /* Blitting. */
849 rect.x = i; 854 rect.x = i;
850 rect.y = j; 855 rect.y = j;