Mercurial > sdl-ios-xcode
comparison src/video/SDL_blit.c @ 3909:6832b00d3594 SDL-1.2
Patched to compile on BeOS and old, old GCC releases.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 05 Feb 2007 06:44:51 +0000 |
parents | d910939febfa |
children | a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
3908:6e41f5d80198 | 3909:6832b00d3594 |
---|---|
27 #include "SDL_RLEaccel_c.h" | 27 #include "SDL_RLEaccel_c.h" |
28 #include "SDL_pixels_c.h" | 28 #include "SDL_pixels_c.h" |
29 | 29 |
30 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && SDL_ASSEMBLY_ROUTINES | 30 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && SDL_ASSEMBLY_ROUTINES |
31 #define MMX_ASMBLIT | 31 #define MMX_ASMBLIT |
32 #if (__GNUC__ > 2) /* SSE instructions aren't in GCC 2. */ | |
33 #define SSE_ASMBLIT | |
34 #endif | |
32 #endif | 35 #endif |
33 | 36 |
34 #if defined(MMX_ASMBLIT) | 37 #if defined(MMX_ASMBLIT) |
35 #include "SDL_cpuinfo.h" | 38 #include "SDL_cpuinfo.h" |
36 #include "mmx.h" | 39 #include "mmx.h" |
120 } | 123 } |
121 if (len&7) | 124 if (len&7) |
122 SDL_memcpy(to, from, len&7); | 125 SDL_memcpy(to, from, len&7); |
123 } | 126 } |
124 | 127 |
128 #ifdef SSE_ASMBLIT | |
125 static __inline__ void SDL_memcpySSE(Uint8 *to, const Uint8 *from, int len) | 129 static __inline__ void SDL_memcpySSE(Uint8 *to, const Uint8 *from, int len) |
126 { | 130 { |
127 int i; | 131 int i; |
128 | 132 |
129 __asm__ __volatile__ ( | 133 __asm__ __volatile__ ( |
144 } | 148 } |
145 if (len&7) | 149 if (len&7) |
146 SDL_memcpy(to, from, len&7); | 150 SDL_memcpy(to, from, len&7); |
147 } | 151 } |
148 #endif | 152 #endif |
153 #endif | |
149 | 154 |
150 static void SDL_BlitCopy(SDL_BlitInfo *info) | 155 static void SDL_BlitCopy(SDL_BlitInfo *info) |
151 { | 156 { |
152 Uint8 *src, *dst; | 157 Uint8 *src, *dst; |
153 int w, h; | 158 int w, h; |
157 h = info->d_height; | 162 h = info->d_height; |
158 src = info->s_pixels; | 163 src = info->s_pixels; |
159 dst = info->d_pixels; | 164 dst = info->d_pixels; |
160 srcskip = w+info->s_skip; | 165 srcskip = w+info->s_skip; |
161 dstskip = w+info->d_skip; | 166 dstskip = w+info->d_skip; |
162 #ifdef MMX_ASMBLIT | 167 |
168 #ifdef SSE_ASMBLIT | |
163 if(SDL_HasSSE()) | 169 if(SDL_HasSSE()) |
164 { | 170 { |
165 while ( h-- ) { | 171 while ( h-- ) { |
166 SDL_memcpySSE(dst, src, w); | 172 SDL_memcpySSE(dst, src, w); |
167 src += srcskip; | 173 src += srcskip; |
170 __asm__ __volatile__ ( | 176 __asm__ __volatile__ ( |
171 " emms\n" | 177 " emms\n" |
172 ::); | 178 ::); |
173 } | 179 } |
174 else | 180 else |
181 #endif | |
182 #ifdef MMX_ASMBLIT | |
175 if(SDL_HasMMX()) | 183 if(SDL_HasMMX()) |
176 { | 184 { |
177 while ( h-- ) { | 185 while ( h-- ) { |
178 SDL_memcpyMMX(dst, src, w); | 186 SDL_memcpyMMX(dst, src, w); |
179 src += srcskip; | 187 src += srcskip; |