Mercurial > sdl-ios-xcode
comparison src/video/SDL_surface.c @ 5141:da10636e5eca
Making the API simpler, scaling is always defined as linear interpolation and should be supported as much as possible on all renderers.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 31 Jan 2011 22:44:43 -0800 |
parents | a130bc2f0a18 |
children | e743b9c3f6d6 |
comparison
equal
deleted
inserted
replaced
5140:e594f07297a9 | 5141:da10636e5eca |
---|---|
516 break; | 516 break; |
517 } | 517 } |
518 return 0; | 518 return 0; |
519 } | 519 } |
520 | 520 |
521 int | |
522 SDL_SetSurfaceScaleMode(SDL_Surface * surface, SDL_ScaleMode scaleMode) | |
523 { | |
524 int flags, status; | |
525 | |
526 if (!surface) { | |
527 return -1; | |
528 } | |
529 | |
530 status = 0; | |
531 flags = surface->map->info.flags; | |
532 surface->map->info.flags &= ~(SDL_COPY_NEAREST); | |
533 switch (scaleMode) { | |
534 case SDL_SCALEMODE_NONE: | |
535 break; | |
536 case SDL_SCALEMODE_FAST: | |
537 surface->map->info.flags |= SDL_COPY_NEAREST; | |
538 break; | |
539 case SDL_SCALEMODE_SLOW: | |
540 case SDL_SCALEMODE_BEST: | |
541 SDL_Unsupported(); | |
542 surface->map->info.flags |= SDL_COPY_NEAREST; | |
543 status = -1; | |
544 break; | |
545 default: | |
546 SDL_Unsupported(); | |
547 status = -1; | |
548 break; | |
549 } | |
550 | |
551 if (surface->map->info.flags != flags) { | |
552 SDL_InvalidateMap(surface->map); | |
553 } | |
554 return status; | |
555 } | |
556 | |
557 int | |
558 SDL_GetSurfaceScaleMode(SDL_Surface * surface, SDL_ScaleMode *scaleMode) | |
559 { | |
560 if (!surface) { | |
561 return -1; | |
562 } | |
563 | |
564 if (!scaleMode) { | |
565 return 0; | |
566 } | |
567 | |
568 switch (surface->map->info.flags & SDL_COPY_NEAREST) { | |
569 case SDL_COPY_NEAREST: | |
570 *scaleMode = SDL_SCALEMODE_FAST; | |
571 break; | |
572 default: | |
573 *scaleMode = SDL_SCALEMODE_NONE; | |
574 break; | |
575 } | |
576 return 0; | |
577 } | |
578 | |
579 SDL_bool | 521 SDL_bool |
580 SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect) | 522 SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect) |
581 { | 523 { |
582 SDL_Rect full_rect; | 524 SDL_Rect full_rect; |
583 | 525 |