Mercurial > sdl-ios-xcode
comparison src/video/SDL_fillrect.c @ 3012:7e30c2dc7783
Fixed Visual C++ release build for Visual C++ 2005
* Some math functions become intrinsic in release mode, so we need to
convert all the math functions into SDL math functions, like we did
with the stdlib functions.
* Constant initializers of 8-bit values become calls to memset() in
release mode, but memset() itself is an intrinsic when explicitly
called. So we'll just explicitly call memset() in those cases.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 10 Jan 2009 18:32:24 +0000 |
parents | ffae53de58f4 |
children | 0267b8b1595c |
comparison
equal
deleted
inserted
replaced
3011:8f4ed5ec2b06 | 3012:7e30c2dc7783 |
---|---|
64 \ | 64 \ |
65 while (h--) { \ | 65 while (h--) { \ |
66 int i, n = w * bpp; \ | 66 int i, n = w * bpp; \ |
67 Uint8 *p = pixels; \ | 67 Uint8 *p = pixels; \ |
68 \ | 68 \ |
69 if (n > 15) { \ | 69 if (n > 63) { \ |
70 int adjust = 16 - ((uintptr_t)p & 15); \ | 70 int adjust = 16 - ((uintptr_t)p & 15); \ |
71 if (adjust < 16) { \ | 71 if (adjust < 16) { \ |
72 n -= adjust; \ | 72 n -= adjust; \ |
73 adjust /= bpp; \ | 73 adjust /= bpp; \ |
74 while (adjust--) { \ | 74 while (adjust--) { \ |
90 } \ | 90 } \ |
91 \ | 91 \ |
92 SSE_END; \ | 92 SSE_END; \ |
93 } | 93 } |
94 | 94 |
95 DEFINE_SSE_FILLRECT(1, Uint8) | 95 static void |
96 SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) | |
97 { | |
98 SSE_BEGIN; | |
99 | |
100 while (h--) { | |
101 int i, n = w; | |
102 Uint8 *p = pixels; | |
103 | |
104 if (n > 63) { | |
105 int adjust = 16 - ((uintptr_t)p & 15); | |
106 if (adjust) { | |
107 n -= adjust; | |
108 SDL_memset(p, color, adjust); | |
109 p += adjust; | |
110 } | |
111 SSE_WORK; | |
112 } | |
113 if (n & 63) { | |
114 int remainder = (n & 63); | |
115 SDL_memset(p, color, remainder); | |
116 p += remainder; | |
117 } | |
118 pixels += pitch; | |
119 } | |
120 | |
121 SSE_END; | |
122 } | |
123 /*DEFINE_SSE_FILLRECT(1, Uint8)*/ | |
96 DEFINE_SSE_FILLRECT(2, Uint16) | 124 DEFINE_SSE_FILLRECT(2, Uint16) |
97 DEFINE_SSE_FILLRECT(4, Uint32) | 125 DEFINE_SSE_FILLRECT(4, Uint32) |
98 | 126 |
99 /* *INDENT-ON* */ | 127 /* *INDENT-ON* */ |
100 #endif /* __SSE__ */ | 128 #endif /* __SSE__ */ |
129 \ | 157 \ |
130 while (h--) { \ | 158 while (h--) { \ |
131 int i, n = w * bpp; \ | 159 int i, n = w * bpp; \ |
132 Uint8 *p = pixels; \ | 160 Uint8 *p = pixels; \ |
133 \ | 161 \ |
134 if (n > 7) { \ | 162 if (n > 63) { \ |
135 int adjust = 8 - ((uintptr_t)p & 7); \ | 163 int adjust = 8 - ((uintptr_t)p & 7); \ |
136 if (adjust < 8) { \ | 164 if (adjust < 8) { \ |
137 n -= adjust; \ | 165 n -= adjust; \ |
138 adjust /= bpp; \ | 166 adjust /= bpp; \ |
139 while (adjust--) { \ | 167 while (adjust--) { \ |
155 } \ | 183 } \ |
156 \ | 184 \ |
157 MMX_END; \ | 185 MMX_END; \ |
158 } | 186 } |
159 | 187 |
160 DEFINE_MMX_FILLRECT(1, Uint8) | 188 static void |
189 SDL_FillRect1MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) | |
190 { | |
191 MMX_BEGIN; | |
192 | |
193 while (h--) { | |
194 int i, n = w; | |
195 Uint8 *p = pixels; | |
196 | |
197 if (n > 63) { | |
198 int adjust = 8 - ((uintptr_t)p & 7); | |
199 if (adjust) { | |
200 n -= adjust; | |
201 SDL_memset(p, color, adjust); | |
202 p += adjust; | |
203 } | |
204 MMX_WORK; | |
205 } | |
206 if (n & 63) { | |
207 int remainder = (n & 63); | |
208 SDL_memset(p, color, remainder); | |
209 p += remainder; | |
210 } | |
211 pixels += pitch; | |
212 } | |
213 | |
214 MMX_END; | |
215 } | |
216 /*DEFINE_MMX_FILLRECT(1, Uint8)*/ | |
161 DEFINE_MMX_FILLRECT(2, Uint16) | 217 DEFINE_MMX_FILLRECT(2, Uint16) |
162 DEFINE_MMX_FILLRECT(4, Uint32) | 218 DEFINE_MMX_FILLRECT(4, Uint32) |
163 | 219 |
164 /* *INDENT-ON* */ | 220 /* *INDENT-ON* */ |
165 #endif /* __MMX__ */ | 221 #endif /* __MMX__ */ |