~ubuntu-branches/ubuntu/vivid/libsdl2/vivid

« back to all changes in this revision

Viewing changes to src/video/SDL_fillrect.c

  • Committer: Package Import Robot
  • Author(s): Manuel A. Fernandez Montecelo, Felix Geyer
  • Date: 2013-12-28 12:31:19 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20131228123119-e0k27gckmnzskfgb
Tags: 2.0.1+dfsg1-1
* New upstream release (Closes: #728974)
  - Remove patch applied upstream:
    bug-723797-false_positives_in_mouse_wheel_code.patch
* Bump Standards-Version to 3.9.5, no changes needed.

[ Felix Geyer ]
* Import upstream gpg key for uscan to verify the orig tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    c128.m128_u32[3] = color;
37
37
#else
38
38
#define SSE_BEGIN \
 
39
    __m128 c128; \
39
40
    DECLARE_ALIGNED(Uint32, cccc[4], 16); \
40
41
    cccc[0] = color; \
41
42
    cccc[1] = color; \
42
43
    cccc[2] = color; \
43
44
    cccc[3] = color; \
44
 
    __m128 c128 = *(__m128 *)cccc;
 
45
    c128 = *(__m128 *)cccc;
45
46
#endif
46
47
 
47
48
#define SSE_WORK \
59
60
static void \
60
61
SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
61
62
{ \
 
63
    int i, n; \
 
64
    Uint8 *p = NULL; \
 
65
 \
62
66
    SSE_BEGIN; \
63
67
 \
64
68
    while (h--) { \
65
 
        int i, n = w * bpp; \
66
 
        Uint8 *p = pixels; \
 
69
        n = w * bpp; \
 
70
        p = pixels; \
67
71
 \
68
72
        if (n > 63) { \
69
73
            int adjust = 16 - ((uintptr_t)p & 15); \
94
98
static void
95
99
SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
96
100
{
 
101
    int i, n;
 
102
    Uint8 *p = NULL;
 
103
    
97
104
    SSE_BEGIN;
98
 
 
99
105
    while (h--) {
100
 
        int i, n = w;
101
 
        Uint8 *p = pixels;
 
106
        n = w;
 
107
        p = pixels;
102
108
 
103
109
        if (n > 63) {
104
110
            int adjust = 16 - ((uintptr_t)p & 15);
119
125
 
120
126
    SSE_END;
121
127
}
122
 
/*DEFINE_SSE_FILLRECT(1, Uint8)*/
 
128
/* DEFINE_SSE_FILLRECT(1, Uint8) */
123
129
DEFINE_SSE_FILLRECT(2, Uint16)
124
130
DEFINE_SSE_FILLRECT(4, Uint32)
125
131
 
152
158
static void \
153
159
SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
154
160
{ \
 
161
    int i, n; \
 
162
    Uint8 *p = NULL; \
 
163
 \
155
164
    MMX_BEGIN; \
156
165
 \
157
166
    while (h--) { \
158
 
        int i, n = w * bpp; \
159
 
        Uint8 *p = pixels; \
 
167
        n = w * bpp; \
 
168
        p = pixels; \
160
169
 \
161
170
        if (n > 63) { \
162
171
            int adjust = 8 - ((uintptr_t)p & 7); \
187
196
static void
188
197
SDL_FillRect1MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
189
198
{
 
199
    int i, n;
 
200
    Uint8 *p = NULL;
 
201
    
190
202
    MMX_BEGIN;
191
203
 
192
204
    while (h--) {
193
 
        int i, n = w;
194
 
        Uint8 *p = pixels;
 
205
        n = w;
 
206
        p = pixels;
195
207
 
196
208
        if (n > 63) {
197
209
            int adjust = 8 - ((uintptr_t)p & 7);
212
224
 
213
225
    MMX_END;
214
226
}
215
 
/*DEFINE_MMX_FILLRECT(1, Uint8)*/
 
227
/* DEFINE_MMX_FILLRECT(1, Uint8) */
216
228
DEFINE_MMX_FILLRECT(2, Uint16)
217
229
DEFINE_MMX_FILLRECT(4, Uint32)
218
230
 
222
234
static void
223
235
SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
224
236
{
 
237
    int n;
 
238
    Uint8 *p = NULL;
 
239
    
225
240
    while (h--) {
226
 
        int n = w;
227
 
        Uint8 *p = pixels;
 
241
        n = w;
 
242
        p = pixels;
228
243
 
229
244
        if (n > 3) {
230
245
            switch ((uintptr_t) p & 3) {
258
273
static void
259
274
SDL_FillRect2(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
260
275
{
 
276
    int n;
 
277
    Uint16 *p = NULL;
 
278
    
261
279
    while (h--) {
262
 
        int n = w;
263
 
        Uint16 *p = (Uint16 *) pixels;
 
280
        n = w;
 
281
        p = (Uint16 *) pixels;
264
282
 
265
283
        if (n > 1) {
266
284
            if ((uintptr_t) p & 2) {
282
300
    Uint8 r = (Uint8) ((color >> 16) & 0xFF);
283
301
    Uint8 g = (Uint8) ((color >> 8) & 0xFF);
284
302
    Uint8 b = (Uint8) (color & 0xFF);
 
303
    int n;
 
304
    Uint8 *p = NULL;
285
305
 
286
306
    while (h--) {
287
 
        int n = w;
288
 
        Uint8 *p = pixels;
 
307
        n = w;
 
308
        p = pixels;
289
309
 
290
310
        while (n--) {
291
311
            *p++ = r;