comparison test/automated/surface/surface.c @ 5143:e743b9c3f6d6

Making the API simpler, the blend modes are "none, blend, add" and are supported by all renderers.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 31 Jan 2011 23:23:57 -0800
parents 947201caa46e
children 3e4086b3bcd2
comparison
equal deleted inserted replaced
5142:57851a238c8f 5143:e743b9c3f6d6
478 return; 478 return;
479 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_NONE).", 479 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_NONE).",
480 surface_compare( testsur, &img_blendNone, 0 )==0 )) 480 surface_compare( testsur, &img_blendNone, 0 )==0 ))
481 return; 481 return;
482 482
483 /* Test Mask. */
484 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_MASK ))
485 return;
486 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_MASK).",
487 surface_compare( testsur, &img_blendMask, 0 )==0 ))
488 return;
489
490 /* Test Blend. */ 483 /* Test Blend. */
491 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND )) 484 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND ))
492 return; 485 return;
493 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_BLEND).", 486 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_BLEND).",
494 surface_compare( testsur, &img_blendBlend, 0 )==0 )) 487 surface_compare( testsur, &img_blendBlend, 0 )==0 ))
497 /* Test Add. */ 490 /* Test Add. */
498 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_ADD )) 491 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_ADD ))
499 return; 492 return;
500 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_ADD).", 493 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_ADD).",
501 surface_compare( testsur, &img_blendAdd, 0 )==0 )) 494 surface_compare( testsur, &img_blendAdd, 0 )==0 ))
502 return;
503
504 /* Test Mod. */
505 if (surface_testBlitBlendMode( testsur, face, SDL_BLENDMODE_MOD ))
506 return;
507 if (SDL_ATassert( "Blitting blending output not the same (using SDL_BLENDMODE_MOD).",
508 surface_compare( testsur, &img_blendMod, 0 )==0 ))
509 return; 495 return;
510 496
511 /* Clear surface. */ 497 /* Clear surface. */
512 ret = SDL_FillRect( testsur, NULL, 498 ret = SDL_FillRect( testsur, NULL,
513 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); 499 SDL_MapRGB( testsur->format, 0, 0, 0 ) );
528 if (SDL_ATassert( "SDL_SetSurfaceAlphaMod", ret == 0)) 514 if (SDL_ATassert( "SDL_SetSurfaceAlphaMod", ret == 0))
529 return; 515 return;
530 516
531 /* Crazy blending mode magic. */ 517 /* Crazy blending mode magic. */
532 mode = (i/4*j/4) % 4; 518 mode = (i/4*j/4) % 4;
533 if (mode==0) mode = SDL_BLENDMODE_MASK; 519 if (mode==0) mode = SDL_BLENDMODE_NONE;
534 else if (mode==1) mode = SDL_BLENDMODE_BLEND; 520 else if (mode==1) mode = SDL_BLENDMODE_BLEND;
535 else if (mode==2) mode = SDL_BLENDMODE_ADD; 521 else if (mode==2) mode = SDL_BLENDMODE_ADD;
536 else if (mode==3) mode = SDL_BLENDMODE_MOD; 522 else if (mode==3) mode = SDL_BLENDMODE_NONE;
537 ret = SDL_SetSurfaceBlendMode( face, mode ); 523 ret = SDL_SetSurfaceBlendMode( face, mode );
538 if (SDL_ATassert( "SDL_SetSurfaceBlendMode", ret == 0)) 524 if (SDL_ATassert( "SDL_SetSurfaceBlendMode", ret == 0))
539 return; 525 return;
540 526
541 /* Blitting. */ 527 /* Blitting. */