Mercurial > sdl-ios-xcode
comparison src/video/dga/SDL_dgavideo.c @ 105:2136ea8953f9
Some minor name changes to clean up
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Fri, 13 Jul 2001 10:15:52 +0000 |
parents | 9162d62280b5 |
children | 401f0134f4f9 |
comparison
equal
deleted
inserted
replaced
104:a746656b7599 | 105:2136ea8953f9 |
---|---|
629 free(freeable); | 629 free(freeable); |
630 } | 630 } |
631 surfaces.next = NULL; | 631 surfaces.next = NULL; |
632 } | 632 } |
633 | 633 |
634 static __inline__ void DGA_AddDirtySurface(SDL_Surface *surface) | 634 static __inline__ void DGA_AddBusySurface(SDL_Surface *surface) |
635 { | 635 { |
636 ((vidmem_bucket *)surface->hwdata)->dirty = 1; | 636 ((vidmem_bucket *)surface->hwdata)->dirty = 1; |
637 } | 637 } |
638 | 638 |
639 static __inline__ int DGA_IsSurfaceDirty(SDL_Surface *surface) | 639 static __inline__ int DGA_IsSurfaceBusy(SDL_Surface *surface) |
640 { | 640 { |
641 return ((vidmem_bucket *)surface->hwdata)->dirty; | 641 return ((vidmem_bucket *)surface->hwdata)->dirty; |
642 } | 642 } |
643 | 643 |
644 static __inline__ void DGA_WaitDirtySurfaces(_THIS) | 644 static __inline__ void DGA_WaitBusySurfaces(_THIS) |
645 { | 645 { |
646 vidmem_bucket *bucket; | 646 vidmem_bucket *bucket; |
647 | 647 |
648 /* Wait for graphic operations to complete */ | 648 /* Wait for graphic operations to complete */ |
649 XDGASync(DGA_Display, DGA_Screen); | 649 XDGASync(DGA_Display, DGA_Screen); |
781 } | 781 } |
782 surface->pixels = NULL; | 782 surface->pixels = NULL; |
783 surface->hwdata = NULL; | 783 surface->hwdata = NULL; |
784 } | 784 } |
785 | 785 |
786 static __inline__ void dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y) | 786 static __inline__ void DGA_dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y) |
787 { | 787 { |
788 *x = (long)((Uint8 *)dst->pixels - memory_base)%memory_pitch; | 788 *x = (long)((Uint8 *)dst->pixels - memory_base)%memory_pitch; |
789 *y = (long)((Uint8 *)dst->pixels - memory_base)/memory_pitch; | 789 *y = (long)((Uint8 *)dst->pixels - memory_base)/memory_pitch; |
790 if ( dst == this->screen ) { | 790 if ( dst == this->screen ) { |
791 *x += this->offset_x; | 791 *x += this->offset_x; |
803 if ( was_flipped && (dst == this->screen) ) { | 803 if ( was_flipped && (dst == this->screen) ) { |
804 while ( XDGAGetViewportStatus(DGA_Display, DGA_Screen) ) | 804 while ( XDGAGetViewportStatus(DGA_Display, DGA_Screen) ) |
805 /* Keep waiting for the hardware ... */ ; | 805 /* Keep waiting for the hardware ... */ ; |
806 was_flipped = 0; | 806 was_flipped = 0; |
807 } | 807 } |
808 dst_to_xy(this, dst, &x, &y); | 808 DGA_dst_to_xy(this, dst, &x, &y); |
809 x += rect->x; | 809 x += rect->x; |
810 y += rect->y; | 810 y += rect->y; |
811 w = rect->w; | 811 w = rect->w; |
812 h = rect->h; | 812 h = rect->h; |
813 #if 0 | 813 #if 0 |
814 printf("Hardware accelerated rectangle fill: %dx%d at %d,%d\n", w, h, x, y); | 814 printf("Hardware accelerated rectangle fill: %dx%d at %d,%d\n", w, h, x, y); |
815 #endif | 815 #endif |
816 XDGAFillRectangle(DGA_Display, DGA_Screen, x, y, w, h, color); | 816 XDGAFillRectangle(DGA_Display, DGA_Screen, x, y, w, h, color); |
817 XFlush(DGA_Display); | 817 XFlush(DGA_Display); |
818 DGA_AddDirtySurface(dst); | 818 DGA_AddBusySurface(dst); |
819 UNLOCK_DISPLAY(); | 819 UNLOCK_DISPLAY(); |
820 return(0); | 820 return(0); |
821 } | 821 } |
822 | 822 |
823 static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, | 823 static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, |
834 if ( was_flipped && (dst == this->screen) ) { | 834 if ( was_flipped && (dst == this->screen) ) { |
835 while ( XDGAGetViewportStatus(DGA_Display, DGA_Screen) ) | 835 while ( XDGAGetViewportStatus(DGA_Display, DGA_Screen) ) |
836 /* Keep waiting for the hardware ... */ ; | 836 /* Keep waiting for the hardware ... */ ; |
837 was_flipped = 0; | 837 was_flipped = 0; |
838 } | 838 } |
839 dst_to_xy(this, src, &srcx, &srcy); | 839 DGA_dst_to_xy(this, src, &srcx, &srcy); |
840 srcx += srcrect->x; | 840 srcx += srcrect->x; |
841 srcy += srcrect->y; | 841 srcy += srcrect->y; |
842 dst_to_xy(this, dst, &dstx, &dsty); | 842 DGA_dst_to_xy(this, dst, &dstx, &dsty); |
843 dstx += dstrect->x; | 843 dstx += dstrect->x; |
844 dsty += dstrect->y; | 844 dsty += dstrect->y; |
845 w = srcrect->w; | 845 w = srcrect->w; |
846 h = srcrect->h; | 846 h = srcrect->h; |
847 #if 0 | 847 #if 0 |
853 } else { | 853 } else { |
854 XDGACopyArea(DGA_Display, DGA_Screen, | 854 XDGACopyArea(DGA_Display, DGA_Screen, |
855 srcx, srcy, w, h, dstx, dsty); | 855 srcx, srcy, w, h, dstx, dsty); |
856 } | 856 } |
857 XFlush(DGA_Display); | 857 XFlush(DGA_Display); |
858 DGA_AddDirtySurface(src); | 858 DGA_AddBusySurface(src); |
859 DGA_AddDirtySurface(dst); | 859 DGA_AddBusySurface(dst); |
860 UNLOCK_DISPLAY(); | 860 UNLOCK_DISPLAY(); |
861 return(0); | 861 return(0); |
862 } | 862 } |
863 | 863 |
864 static int DGA_CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst) | 864 static int DGA_CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst) |
900 static int DGA_LockHWSurface(_THIS, SDL_Surface *surface) | 900 static int DGA_LockHWSurface(_THIS, SDL_Surface *surface) |
901 { | 901 { |
902 if ( surface == this->screen ) { | 902 if ( surface == this->screen ) { |
903 SDL_mutexP(hw_lock); | 903 SDL_mutexP(hw_lock); |
904 LOCK_DISPLAY(); | 904 LOCK_DISPLAY(); |
905 if ( DGA_IsSurfaceDirty(surface) ) { | 905 if ( DGA_IsSurfaceBusy(surface) ) { |
906 DGA_WaitDirtySurfaces(this); | 906 DGA_WaitBusySurfaces(this); |
907 } | 907 } |
908 DGA_WaitFlip(this); | 908 DGA_WaitFlip(this); |
909 UNLOCK_DISPLAY(); | 909 UNLOCK_DISPLAY(); |
910 } else { | 910 } else { |
911 if ( DGA_IsSurfaceDirty(surface) ) { | 911 if ( DGA_IsSurfaceBusy(surface) ) { |
912 LOCK_DISPLAY(); | 912 LOCK_DISPLAY(); |
913 DGA_WaitDirtySurfaces(this); | 913 DGA_WaitBusySurfaces(this); |
914 UNLOCK_DISPLAY(); | 914 UNLOCK_DISPLAY(); |
915 } | 915 } |
916 } | 916 } |
917 return(0); | 917 return(0); |
918 } | 918 } |
925 | 925 |
926 static int DGA_FlipHWSurface(_THIS, SDL_Surface *surface) | 926 static int DGA_FlipHWSurface(_THIS, SDL_Surface *surface) |
927 { | 927 { |
928 /* Wait for vertical retrace and then flip display */ | 928 /* Wait for vertical retrace and then flip display */ |
929 LOCK_DISPLAY(); | 929 LOCK_DISPLAY(); |
930 if ( DGA_IsSurfaceDirty(this->screen) ) { | 930 if ( DGA_IsSurfaceBusy(this->screen) ) { |
931 DGA_WaitDirtySurfaces(this); | 931 DGA_WaitBusySurfaces(this); |
932 } | 932 } |
933 DGA_WaitFlip(this); | 933 DGA_WaitFlip(this); |
934 XDGASetViewport(DGA_Display, DGA_Screen, | 934 XDGASetViewport(DGA_Display, DGA_Screen, |
935 0, flip_yoffset[flip_page], XDGAFlipRetrace); | 935 0, flip_yoffset[flip_page], XDGAFlipRetrace); |
936 XFlush(DGA_Display); | 936 XFlush(DGA_Display); |