Mercurial > sdl-ios-xcode
comparison test/automated/render/render.c @ 3747:f7a3a47e6b50 gsoc2009_unit_tests
Fixed errors detected by valgrind.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Tue, 04 Aug 2009 16:39:15 +0000 |
parents | 848b5263ab05 |
children | 5b48a529fd8a |
comparison
equal
deleted
inserted
replaced
3746:be037e51f080 | 3747:f7a3a47e6b50 |
---|---|
568 return -1; | 568 return -1; |
569 tface = SDL_CreateTextureFromSurface( 0, face ); | 569 tface = SDL_CreateTextureFromSurface( 0, face ); |
570 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) | 570 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) |
571 return -1; | 571 return -1; |
572 | 572 |
573 /* Clean up. */ | |
574 SDL_FreeSurface( face ); | |
575 | |
576 /* Constant values. */ | 573 /* Constant values. */ |
577 rect.w = face->w; | 574 rect.w = face->w; |
578 rect.h = face->h; | 575 rect.h = face->h; |
579 ni = SCREEN_W - face->w; | 576 ni = SCREEN_W - face->w; |
580 nj = SCREEN_H - face->h; | 577 nj = SCREEN_H - face->h; |
578 | |
579 /* Clean up. */ | |
580 SDL_FreeSurface( face ); | |
581 | 581 |
582 /* Loop blit. */ | 582 /* Loop blit. */ |
583 for (j=0; j <= nj; j+=4) { | 583 for (j=0; j <= nj; j+=4) { |
584 for (i=0; i <= ni; i+=4) { | 584 for (i=0; i <= ni; i+=4) { |
585 /* Blitting. */ | 585 /* Blitting. */ |
629 return -1; | 629 return -1; |
630 tface = SDL_CreateTextureFromSurface( 0, face ); | 630 tface = SDL_CreateTextureFromSurface( 0, face ); |
631 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) | 631 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) |
632 return -1; | 632 return -1; |
633 | 633 |
634 /* Clean up. */ | |
635 SDL_FreeSurface( face ); | |
636 | |
637 /* Constant values. */ | 634 /* Constant values. */ |
638 rect.w = face->w; | 635 rect.w = face->w; |
639 rect.h = face->h; | 636 rect.h = face->h; |
640 ni = SCREEN_W - face->w; | 637 ni = SCREEN_W - face->w; |
641 nj = SCREEN_H - face->h; | 638 nj = SCREEN_H - face->h; |
639 | |
640 /* Clean up. */ | |
641 SDL_FreeSurface( face ); | |
642 | 642 |
643 /* Test blitting with colour mod. */ | 643 /* Test blitting with colour mod. */ |
644 for (j=0; j <= nj; j+=4) { | 644 for (j=0; j <= nj; j+=4) { |
645 for (i=0; i <= ni; i+=4) { | 645 for (i=0; i <= ni; i+=4) { |
646 /* Set colour mod. */ | 646 /* Set colour mod. */ |
696 return -1; | 696 return -1; |
697 tface = SDL_CreateTextureFromSurface( 0, face ); | 697 tface = SDL_CreateTextureFromSurface( 0, face ); |
698 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) | 698 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) |
699 return -1; | 699 return -1; |
700 | 700 |
701 /* Clean up. */ | |
702 SDL_FreeSurface( face ); | |
703 | |
704 /* Constant values. */ | 701 /* Constant values. */ |
705 rect.w = face->w; | 702 rect.w = face->w; |
706 rect.h = face->h; | 703 rect.h = face->h; |
707 ni = SCREEN_W - face->w; | 704 ni = SCREEN_W - face->w; |
708 nj = SCREEN_H - face->h; | 705 nj = SCREEN_H - face->h; |
706 | |
707 /* Clean up. */ | |
708 SDL_FreeSurface( face ); | |
709 | 709 |
710 /* Clear surface. */ | 710 /* Clear surface. */ |
711 if (render_clearScreen()) | 711 if (render_clearScreen()) |
712 return -1; | 712 return -1; |
713 | 713 |
810 return -1; | 810 return -1; |
811 tface = SDL_CreateTextureFromSurface( 0, face ); | 811 tface = SDL_CreateTextureFromSurface( 0, face ); |
812 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) | 812 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) |
813 return -1; | 813 return -1; |
814 | 814 |
815 /* Clean up. */ | |
816 SDL_FreeSurface( face ); | |
817 | |
818 /* Set alpha mod. */ | |
819 ret = SDL_SetRenderDrawColor( 255, 255, 255, 100 ); | |
820 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | |
821 return -1; | |
822 | |
823 /* Steps to take. */ | 815 /* Steps to take. */ |
824 ni = SCREEN_W - FACE_W; | 816 ni = SCREEN_W - FACE_W; |
825 nj = SCREEN_H - FACE_H; | 817 nj = SCREEN_H - FACE_H; |
826 | 818 |
827 /* Constant values. */ | 819 /* Constant values. */ |
828 rect.w = face->w; | 820 rect.w = face->w; |
829 rect.h = face->h; | 821 rect.h = face->h; |
822 | |
823 /* Clean up. */ | |
824 SDL_FreeSurface( face ); | |
825 | |
826 /* Set alpha mod. */ | |
827 ret = SDL_SetRenderDrawColor( 255, 255, 255, 100 ); | |
828 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | |
829 return -1; | |
830 | 830 |
831 /* Test None. */ | 831 /* Test None. */ |
832 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE )) | 832 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE )) |
833 return -1; | 833 return -1; |
834 /* See if it's the same. */ | 834 /* See if it's the same. */ |