comparison test/automated/render/render.c @ 3444:50fca98abc24

Fixed endianness of the face image surface
author Sam Lantinga <slouken@libsdl.org>
date Wed, 18 Nov 2009 07:22:22 +0000
parents 204609180482
children de72b49bb695
comparison
equal deleted inserted replaced
3443:7f477a22dff5 3444:50fca98abc24
72 if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) ) 72 if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
73 return 1; 73 return 1;
74 74
75 /* Create surface. */ 75 /* Create surface. */
76 testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4, 76 testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4,
77 RMASK, GMASK, BMASK, AMASK ); 77 RMASK, GMASK, BMASK, AMASK);
78 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", testsur!=NULL )) 78 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", testsur!=NULL ))
79 return 1; 79 return 1;
80 80
81 /* Compare surface. */ 81 /* Compare surface. */
82 ret = surface_compare( testsur, s ); 82 ret = surface_compare( testsur, s );
202 SDL_TextureID tface; 202 SDL_TextureID tface;
203 203
204 /* Create face surface. */ 204 /* Create face surface. */
205 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, 205 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
206 img_face.width, img_face.height, 32, img_face.width*4, 206 img_face.width, img_face.height, 32, img_face.width*4,
207 RMASK, GMASK, BMASK, AMASK ); 207 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
208 0xff000000, /* Red bit mask. */
209 0x00ff0000, /* Green bit mask. */
210 0x0000ff00, /* Blue bit mask. */
211 0x000000ff /* Alpha bit mask. */
212 #else
213 0x000000ff, /* Red bit mask. */
214 0x0000ff00, /* Green bit mask. */
215 0x00ff0000, /* Blue bit mask. */
216 0xff000000 /* Alpha bit mask. */
217 #endif
218 );
208 if (face == NULL) 219 if (face == NULL)
209 return 0; 220 return 0;
210 tface = SDL_CreateTextureFromSurface( 0, face ); 221 tface = SDL_CreateTextureFromSurface( 0, face );
211 SDL_FreeSurface(face); 222 SDL_FreeSurface(face);
212 223
545 return 0; 556 return 0;
546 557
547 /* Create face surface. */ 558 /* Create face surface. */
548 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, 559 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
549 img_face.width, img_face.height, 32, img_face.width*4, 560 img_face.width, img_face.height, 32, img_face.width*4,
550 RMASK, GMASK, BMASK, AMASK ); 561 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
562 0xff000000, /* Red bit mask. */
563 0x00ff0000, /* Green bit mask. */
564 0x0000ff00, /* Blue bit mask. */
565 0x000000ff /* Alpha bit mask. */
566 #else
567 0x000000ff, /* Red bit mask. */
568 0x0000ff00, /* Green bit mask. */
569 0x00ff0000, /* Blue bit mask. */
570 0xff000000 /* Alpha bit mask. */
571 #endif
572 );
551 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) 573 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
552 return -1; 574 return -1;
553 tface = SDL_CreateTextureFromSurface( 0, face ); 575 tface = SDL_CreateTextureFromSurface( 0, face );
554 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) 576 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
555 return -1; 577 return -1;
606 return 0; 628 return 0;
607 629
608 /* Create face surface. */ 630 /* Create face surface. */
609 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, 631 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
610 img_face.width, img_face.height, 32, img_face.width*4, 632 img_face.width, img_face.height, 32, img_face.width*4,
611 RMASK, GMASK, BMASK, AMASK ); 633 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
634 0xff000000, /* Red bit mask. */
635 0x00ff0000, /* Green bit mask. */
636 0x0000ff00, /* Blue bit mask. */
637 0x000000ff /* Alpha bit mask. */
638 #else
639 0x000000ff, /* Red bit mask. */
640 0x0000ff00, /* Green bit mask. */
641 0x00ff0000, /* Blue bit mask. */
642 0xff000000 /* Alpha bit mask. */
643 #endif
644 );
612 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) 645 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
613 return -1; 646 return -1;
614 tface = SDL_CreateTextureFromSurface( 0, face ); 647 tface = SDL_CreateTextureFromSurface( 0, face );
615 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) 648 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
616 return -1; 649 return -1;
673 return 0; 706 return 0;
674 707
675 /* Create face surface. */ 708 /* Create face surface. */
676 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, 709 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
677 img_face.width, img_face.height, 32, img_face.width*4, 710 img_face.width, img_face.height, 32, img_face.width*4,
678 RMASK, GMASK, BMASK, AMASK ); 711 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
712 0xff000000, /* Red bit mask. */
713 0x00ff0000, /* Green bit mask. */
714 0x0000ff00, /* Blue bit mask. */
715 0x000000ff /* Alpha bit mask. */
716 #else
717 0x000000ff, /* Red bit mask. */
718 0x0000ff00, /* Green bit mask. */
719 0x00ff0000, /* Blue bit mask. */
720 0xff000000 /* Alpha bit mask. */
721 #endif
722 );
679 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) 723 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
680 return -1; 724 return -1;
681 tface = SDL_CreateTextureFromSurface( 0, face ); 725 tface = SDL_CreateTextureFromSurface( 0, face );
682 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) 726 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
683 return -1; 727 return -1;
787 return 0; 831 return 0;
788 832
789 /* Create face surface. */ 833 /* Create face surface. */
790 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, 834 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
791 img_face.width, img_face.height, 32, img_face.width*4, 835 img_face.width, img_face.height, 32, img_face.width*4,
792 RMASK, GMASK, BMASK, AMASK ); 836 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
837 0xff000000, /* Red bit mask. */
838 0x00ff0000, /* Green bit mask. */
839 0x0000ff00, /* Blue bit mask. */
840 0x000000ff /* Alpha bit mask. */
841 #else
842 0x000000ff, /* Red bit mask. */
843 0x0000ff00, /* Green bit mask. */
844 0x00ff0000, /* Blue bit mask. */
845 0xff000000 /* Alpha bit mask. */
846 #endif
847 );
793 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) 848 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
794 return -1; 849 return -1;
795 tface = SDL_CreateTextureFromSurface( 0, face ); 850 tface = SDL_CreateTextureFromSurface( 0, face );
796 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0)) 851 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
797 return -1; 852 return -1;