comparison src/video/SDL_surface.c @ 4929:aa8888658021

Use the enumerated type for blend and scale mode instead of int Renamed SDL_TextureScaleMode to SDL_ScaleMode
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Dec 2010 15:19:05 -0800
parents 2cd7bb613a83
children 68da5a234bba
comparison
equal deleted inserted replaced
4927:d716dff4b13e 4929:aa8888658021
436 } 436 }
437 return 0; 437 return 0;
438 } 438 }
439 439
440 int 440 int
441 SDL_SetSurfaceBlendMode(SDL_Surface * surface, int blendMode) 441 SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode)
442 { 442 {
443 int flags, status; 443 int flags, status;
444 444
445 if (!surface) { 445 if (!surface) {
446 return -1; 446 return -1;
484 484
485 return status; 485 return status;
486 } 486 }
487 487
488 int 488 int
489 SDL_GetSurfaceBlendMode(SDL_Surface * surface, int *blendMode) 489 SDL_GetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode *blendMode)
490 { 490 {
491 if (!surface) { 491 if (!surface) {
492 return -1; 492 return -1;
493 } 493 }
494 494
517 } 517 }
518 return 0; 518 return 0;
519 } 519 }
520 520
521 int 521 int
522 SDL_SetSurfaceScaleMode(SDL_Surface * surface, int scaleMode) 522 SDL_SetSurfaceScaleMode(SDL_Surface * surface, SDL_ScaleMode scaleMode)
523 { 523 {
524 int flags, status; 524 int flags, status;
525 525
526 if (!surface) { 526 if (!surface) {
527 return -1; 527 return -1;
529 529
530 status = 0; 530 status = 0;
531 flags = surface->map->info.flags; 531 flags = surface->map->info.flags;
532 surface->map->info.flags &= ~(SDL_COPY_NEAREST); 532 surface->map->info.flags &= ~(SDL_COPY_NEAREST);
533 switch (scaleMode) { 533 switch (scaleMode) {
534 case SDL_TEXTURESCALEMODE_NONE: 534 case SDL_SCALEMODE_NONE:
535 break; 535 break;
536 case SDL_TEXTURESCALEMODE_FAST: 536 case SDL_SCALEMODE_FAST:
537 surface->map->info.flags |= SDL_COPY_NEAREST; 537 surface->map->info.flags |= SDL_COPY_NEAREST;
538 break; 538 break;
539 case SDL_TEXTURESCALEMODE_SLOW: 539 case SDL_SCALEMODE_SLOW:
540 case SDL_TEXTURESCALEMODE_BEST: 540 case SDL_SCALEMODE_BEST:
541 SDL_Unsupported(); 541 SDL_Unsupported();
542 surface->map->info.flags |= SDL_COPY_NEAREST; 542 surface->map->info.flags |= SDL_COPY_NEAREST;
543 status = -1; 543 status = -1;
544 break; 544 break;
545 default: 545 default:
553 } 553 }
554 return status; 554 return status;
555 } 555 }
556 556
557 int 557 int
558 SDL_GetSurfaceScaleMode(SDL_Surface * surface, int *scaleMode) 558 SDL_GetSurfaceScaleMode(SDL_Surface * surface, SDL_ScaleMode *scaleMode)
559 { 559 {
560 if (!surface) { 560 if (!surface) {
561 return -1; 561 return -1;
562 } 562 }
563 563
565 return 0; 565 return 0;
566 } 566 }
567 567
568 switch (surface->map->info.flags & SDL_COPY_NEAREST) { 568 switch (surface->map->info.flags & SDL_COPY_NEAREST) {
569 case SDL_COPY_NEAREST: 569 case SDL_COPY_NEAREST:
570 *scaleMode = SDL_TEXTURESCALEMODE_FAST; 570 *scaleMode = SDL_SCALEMODE_FAST;
571 break; 571 break;
572 default: 572 default:
573 *scaleMode = SDL_TEXTURESCALEMODE_NONE; 573 *scaleMode = SDL_SCALEMODE_NONE;
574 break; 574 break;
575 } 575 }
576 return 0; 576 return 0;
577 } 577 }
578 578