comparison test/automated/render/render.c @ 5165:e2b3f003e085

Updated for API changes
author Sam Lantinga <slouken@libsdl.org>
date Thu, 03 Feb 2011 02:42:50 -0800
parents 3e4086b3bcd2
children d976b67150c5
comparison
equal deleted inserted replaced
5164:1bd1e62e648d 5165:e2b3f003e085
36 static int render_hasBlendModes (void); 36 static int render_hasBlendModes (void);
37 static int render_hasTexColor (void); 37 static int render_hasTexColor (void);
38 static int render_hasTexAlpha (void); 38 static int render_hasTexAlpha (void);
39 static int render_clearScreen (void); 39 static int render_clearScreen (void);
40 /* Testcases. */ 40 /* Testcases. */
41 static int render_testReadWrite (void);
42 static int render_testPrimitives (void); 41 static int render_testPrimitives (void);
43 static int render_testPrimitivesBlend (void); 42 static int render_testPrimitivesBlend (void);
44 static int render_testBlit (void); 43 static int render_testBlit (void);
45 static int render_testBlitColour (void); 44 static int render_testBlitColour (void);
46 static int render_testBlitAlpha (void); 45 static int render_testBlitAlpha (void);
228 0xff000000 /* Alpha bit mask. */ 227 0xff000000 /* Alpha bit mask. */
229 #endif 228 #endif
230 ); 229 );
231 if (face == NULL) 230 if (face == NULL)
232 return 0; 231 return 0;
233 tface = SDL_CreateTextureFromSurface(renderer, 0, face ); 232 tface = SDL_CreateTextureFromSurface(renderer, face);
234 SDL_FreeSurface(face); 233 SDL_FreeSurface(face);
235 234
236 return tface; 235 return tface;
237 } 236 }
238 237
339 ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE ); 338 ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
340 /* 339 /*
341 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) 340 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
342 return -1; 341 return -1;
343 */ 342 */
344
345 return 0;
346 }
347
348
349 /**
350 * @brief Test reading and writing framebuffer
351 */
352 static int render_testReadWrite (void)
353 {
354 int ret;
355 SDL_Rect rect;
356
357 /* Write pixels. */
358 rect.x = 0;
359 rect.y = 0;
360 rect.w = 80;
361 rect.h = 60;
362 ret = SDL_RenderWritePixels(renderer, &rect, SDL_PIXELFORMAT_RGB24, img_primitives.pixel_data, img_primitives.width*img_primitives.bytes_per_pixel );
363 if (SDL_ATassert( "SDL_RenderWritePixels", ret==0) )
364 return 1;
365
366 /* See if it's the same. */
367 if (render_compare( "Read/write output not the same.", &img_primitives, ALLOWABLE_ERROR_OPAQUE ))
368 return -1;
369 343
370 return 0; 344 return 0;
371 } 345 }
372 346
373 347
925 SDL_ATprintVerbose( 1, " Texture Color Mod supported\n" ); 899 SDL_ATprintVerbose( 1, " Texture Color Mod supported\n" );
926 if (render_hasTexAlpha()) 900 if (render_hasTexAlpha())
927 SDL_ATprintVerbose( 1, " Texture Alpha Mod supported\n" ); 901 SDL_ATprintVerbose( 1, " Texture Alpha Mod supported\n" );
928 902
929 /* Software surface blitting. */ 903 /* Software surface blitting. */
930 ret = render_testReadWrite();
931 if (ret)
932 return -1;
933 ret = render_testPrimitives(); 904 ret = render_testPrimitives();
934 if (ret) 905 if (ret)
935 return -1; 906 return -1;
936 ret = render_testPrimitivesBlend(); 907 ret = render_testPrimitivesBlend();
937 if (ret) 908 if (ret)