comparison test/automated/render/render.c @ 3558:5f038ec1a1af

Added a test to check the read/write pixels API
author Sam Lantinga <slouken@libsdl.org>
date Mon, 14 Dec 2009 06:35:59 +0000
parents 0267b8b1595c
children f638ded38b8a
comparison
equal deleted inserted replaced
3557:7184580ab756 3558:5f038ec1a1af
35 static int render_hasBlendModes (void); 35 static int render_hasBlendModes (void);
36 static int render_hasTexColor (void); 36 static int render_hasTexColor (void);
37 static int render_hasTexAlpha (void); 37 static int render_hasTexAlpha (void);
38 static int render_clearScreen (void); 38 static int render_clearScreen (void);
39 /* Testcases. */ 39 /* Testcases. */
40 static int render_testReadWrite (void);
40 static int render_testPrimitives (void); 41 static int render_testPrimitives (void);
41 static int render_testPrimitivesBlend (void); 42 static int render_testPrimitivesBlend (void);
42 static int render_testBlit (void); 43 static int render_testBlit (void);
43 static int render_testBlitColour (void); 44 static int render_testBlitColour (void);
44 static int render_testBlitAlpha (void); 45 static int render_testBlitAlpha (void);
355 ret = SDL_SetRenderDrawColor( 255, 255, 255, SDL_ALPHA_OPAQUE ); 356 ret = SDL_SetRenderDrawColor( 255, 255, 255, SDL_ALPHA_OPAQUE );
356 /* 357 /*
357 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) 358 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
358 return -1; 359 return -1;
359 */ 360 */
361
362 return 0;
363 }
364
365
366 /**
367 * @brief Test reading and writing framebuffer
368 */
369 static int render_testReadWrite (void)
370 {
371 int ret;
372 SDL_Rect rect;
373
374 /* Write pixels. */
375 rect.x = 0;
376 rect.y = 0;
377 rect.w = 80;
378 rect.h = 60;
379 ret = SDL_RenderWritePixels( &rect, SDL_PIXELFORMAT_RGB24, img_primitives.pixel_data, img_primitives.width*img_primitives.bytes_per_pixel );
380 if (SDL_ATassert( "SDL_RenderWritePixels", ret==0) )
381 return 1;
382
383 /* See if it's the same. */
384 if (render_compare( "Read/write output not the same.", &img_primitives, ALLOWABLE_ERROR_OPAQUE ))
385 return -1;
360 386
361 return 0; 387 return 0;
362 } 388 }
363 389
364 390
930 SDL_ATprintVerbose( 1, " Texture Color Mod supported\n" ); 956 SDL_ATprintVerbose( 1, " Texture Color Mod supported\n" );
931 if (render_hasTexAlpha()) 957 if (render_hasTexAlpha())
932 SDL_ATprintVerbose( 1, " Texture Alpha Mod supported\n" ); 958 SDL_ATprintVerbose( 1, " Texture Alpha Mod supported\n" );
933 959
934 /* Software surface blitting. */ 960 /* Software surface blitting. */
961 ret = render_testReadWrite();
962 if (ret)
963 return -1;
935 ret = render_testPrimitives(); 964 ret = render_testPrimitives();
936 if (ret) 965 if (ret)
937 return -1; 966 return -1;
938 ret = render_testPrimitivesBlend(); 967 ret = render_testPrimitivesBlend();
939 if (ret) 968 if (ret)