annotate dmblitfunc.h @ 81:ba1987562a73

Fix 8to8 saturated scaled blit function.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Oct 2012 09:44:18 +0300
parents 49cc9a173427
children c257d73cf790
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * DMLib
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * -- Sprite / surface blitting functions
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * Programmed and designed by Matti 'ccr' Hamalainen
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 * (C) Copyright 2011-2012 Tecnic Software productions (TNSP)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 // =======================================================================
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 // DMD_NONE
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 // =======================================================================
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #define DM_SCALED_NAME dmScaledBlitSurface8to8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 #define DM_SCALED_SRC_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 #define DM_SCALED_DST_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #define DM_SCALED_SRC_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 #define DM_SCALED_DST_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 #define DM_SCALED_INNER *dp++ = sp[FP_GETH(xv)];
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 // -----------------------------------------------------------------------
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #define DM_SCALED_NAME dmScaledBlitSurface8to32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #define DM_SCALED_SRC_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 #define DM_SCALED_DST_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 #define DM_SCALED_SRC_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 #define DM_SCALED_DST_TYPE Uint32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 #define DM_SCALED_VARS const Uint32 *pal;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #define DM_SCALED_INIT \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 if (src->format->palette == NULL || src->format->palette->ncolors < 256) return -2; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 pal = (Uint32 *) src->format->palette->colors;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 #define DM_SCALED_INNER *dp++ = pal[sp[FP_GETH(xv)]];
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 // -----------------------------------------------------------------------
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 #define DM_SCALED_NAME dmScaledBlitSurface32to32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 #define DM_SCALED_SRC_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 #define DM_SCALED_DST_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 #define DM_SCALED_SRC_TYPE Uint32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 #define DM_SCALED_DST_TYPE Uint32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 #define DM_SCALED_INIT
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 #define DM_SCALED_INNER *dp++ = sp[FP_GETH(xv)];
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 // =======================================================================
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 // DMD_TRANSPARENT
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 // =======================================================================
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 #define DM_SCALED_NAME dmScaledBlitSurface8to8Transparent
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 #define DM_SCALED_SRC_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 #define DM_SCALED_DST_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 #define DM_SCALED_SRC_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 #define DM_SCALED_DST_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 *dp = sp[FP_GETH(xv)] ? sp[FP_GETH(xv)] : *dp; dp++;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 // -----------------------------------------------------------------------
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 #define DM_SCALED_NAME dmScaledBlitSurface8to32Transparent
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 #define DM_SCALED_SRC_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 #define DM_SCALED_DST_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 #define DM_SCALED_SRC_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 #define DM_SCALED_DST_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 #define DM_SCALED_VARS const DMRGBA32 *pal;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 #define DM_SCALED_INIT \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 if (src->format->palette == NULL || src->format->palette->ncolors < 256) return -2; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 pal = (DMRGBA32 *) src->format->palette->colors;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 const DMRGBA32 q = pal[sp[FP_GETH(xv)]]; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 dp->r += ((q.r - dp->r) * q.a) >> 8; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 dp->g += ((q.g - dp->g) * q.a) >> 8; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 dp->b += ((q.b - dp->b) * q.a) >> 8; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 dp->a = q.a; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 dp++;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 // -----------------------------------------------------------------------
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 #define DM_SCALED_NAME dmScaledBlitSurface32to32Transparent
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 #define DM_SCALED_SRC_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 #define DM_SCALED_DST_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 #ifdef DM_USE_SIMD
21
49cc9a173427 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 18
diff changeset
97 #define DM_SCALED_VARS \
49cc9a173427 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 18
diff changeset
98 const Uint32 qpdmask = 0xff000000; \
12
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
99 const Uint64 qpdrm = 0xff00ff00ff00ffULL;
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 #define DM_SCALED_SRC_TYPE Uint32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 #define DM_SCALED_DST_TYPE Uint32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 asm( \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 "movd %2, %%mm1\n" \
12
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
106 \
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
107 "movd %3, %%mm2\n" \
13
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
108 "movq %%mm1, %%mm5\n" \
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
109 "pand %%mm2, %%mm5\n" \
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
110 "psrlw $8, %%mm5\n" \
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
111 "punpcklwd %%mm5, %%mm5\n" \
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
112 "punpckhwd %%mm5, %%mm5\n" \
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 \
13
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
114 "pxor %%mm2, %%mm2\n" \
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 "movd %1, %%mm3\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 "punpcklbw %%mm2, %%mm1\n" \
13
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
117 "punpcklbw %%mm2, %%mm3\n" \
12
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
118 \
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 "psubw %%mm3, %%mm1\n" \
12
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
120 "pmullw %%mm5, %%mm1\n" \
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
121 "psraw $8, %%mm1\n" \
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
122 "paddw %%mm3, %%mm1\n" \
13
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
123 "pand %4, %%mm1\n" \
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 "packuswb %%mm2, %%mm1\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 "movd %%mm1, %0\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 : "=m" (*dp) \
12
35b0c83af3ca MMX-version of scaled 32-bit RGBA alpha blending blit works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
127 : "m" (*dp), "m" (sp[FP_GETH(xv)]), "m" (qpdmask), "m" (qpdrm) \
17
a60fe802636a Add register clobbers to SIMD inline asm.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
128 : "memory", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5" ); dp++;
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 #define DM_SCALED_FINISH asm("emms\n");
13
07bace8425d9 Optimize the scaled RGBA alpha blit MMX version further.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
131
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 #else
21
49cc9a173427 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 18
diff changeset
133
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 #define DM_SCALED_SRC_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 #define DM_SCALED_DST_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 const DMRGBA32 q = sp[FP_GETH(xv)]; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 dp->r += ((q.r - dp->r) * q.a) >> 8; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 dp->g += ((q.g - dp->g) * q.a) >> 8; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 dp->b += ((q.b - dp->b) * q.a) >> 8; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 dp->a = q.a; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 dp++;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 #endif
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 // -----------------------------------------------------------------------
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 #define DM_SCALED_NAME dmScaledBlitSurface32to32TransparentX
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 #define DM_SCALED_SRC_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 #define DM_SCALED_DST_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 #define DM_SCALED_SRC_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 #define DM_SCALED_DST_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 #define DM_SCALED_INIT
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 const DMRGBA32 q = sp[FP_GETH(xv)]; \
14
a40c266a71a2 Bitshift less in dmScaledBlitSurface32to32TransparentX()
Matti Hamalainen <ccr@tnsp.org>
parents: 13
diff changeset
158 dp->r = (q.r * q.a + dp->r * dp->a) >> 8; \
a40c266a71a2 Bitshift less in dmScaledBlitSurface32to32TransparentX()
Matti Hamalainen <ccr@tnsp.org>
parents: 13
diff changeset
159 dp->g = (q.g * q.a + dp->g * dp->a) >> 8; \
a40c266a71a2 Bitshift less in dmScaledBlitSurface32to32TransparentX()
Matti Hamalainen <ccr@tnsp.org>
parents: 13
diff changeset
160 dp->b = (q.b * q.a + dp->b * dp->a) >> 8; \
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 dp->a = q.a ? q.a : dp->a; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 dp++;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166
18
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
167 // -----------------------------------------------------------------------
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
168
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
169 #define DM_SCALED_NAME dmScaledBlitSurface32to32TransparentGA
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
170 #define DM_SCALED_SRC_BYTES 4
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
171 #define DM_SCALED_DST_BYTES 4
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
172 #define DM_SCALED_ARGS , Uint32 alpha
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
173
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
174 #ifdef DM_USE_SIMD
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
175 #define DM_SCALED_VARS \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
176 const Uint64 qpdrm = 0xff00ff00ff00ffULL;
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
177
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
178 #define DM_SCALED_SRC_TYPE Uint32
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
179 #define DM_SCALED_DST_TYPE Uint32
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
180 #define DM_SCALED_INNER_INIT \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
181 asm( \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
182 "movd %0, %%mm4\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
183 "punpcklwd %%mm4, %%mm4\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
184 "punpckldq %%mm4, %%mm4\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
185 : \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
186 : "m" (alpha) \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
187 : "%mm4" );
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
188
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
189 #define DM_SCALED_INNER \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
190 asm( \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
191 "movd %2, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
192 "pxor %%mm2, %%mm2\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
193 "movd %1, %%mm3\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
194 "punpcklbw %%mm2, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
195 "punpcklbw %%mm2, %%mm3\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
196 \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
197 "psubw %%mm3, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
198 "pmullw %%mm4, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
199 "psraw $8, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
200 "paddw %%mm3, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
201 "pand %3, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
202 "packuswb %%mm2, %%mm1\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
203 "movd %%mm1, %0\n" \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
204 : "=m" (*dp) \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
205 : "m" (*dp), "m" (sp[FP_GETH(xv)]), "m" (qpdrm) \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
206 : "memory", "%mm1", "%mm2", "%mm3", "%mm4" ); dp++;
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
207
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
208 #define DM_SCALED_FINISH asm("emms\n");
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
209
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
210 #else
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
211
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
212 #define DM_SCALED_SRC_TYPE DMRGBA32
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
213 #define DM_SCALED_DST_TYPE DMRGBA32
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
214 #define DM_SCALED_INNER \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
215 const DMRGBA32 q = sp[FP_GETH(xv)]; \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
216 dp->r += ((q.r - dp->r) * alpha) >> 8; \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
217 dp->g += ((q.g - dp->g) * alpha) >> 8; \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
218 dp->b += ((q.b - dp->b) * alpha) >> 8; \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
219 dp->a = alpha; \
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
220 dp++;
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
221 #endif
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
222
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
223 #include "dmscaledblit.h"
022eee2e7de6 Add dmScaledBlitSurface32to32TransparentGA().
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
224
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 // =======================================================================
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 // DMD_SATURATE
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 // =======================================================================
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 #define DM_SCALED_NAME dmScaledBlitSurface8to8Saturate
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 #define DM_SCALED_SRC_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 #define DM_SCALED_DST_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 #define DM_SCALED_SRC_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 #define DM_SCALED_DST_TYPE Uint8
81
ba1987562a73 Fix 8to8 saturated scaled blit function.
Matti Hamalainen <ccr@tnsp.org>
parents: 21
diff changeset
234 #define DM_SCALED_INNER \
ba1987562a73 Fix 8to8 saturated scaled blit function.
Matti Hamalainen <ccr@tnsp.org>
parents: 21
diff changeset
235 const Uint8 q = sp[FP_GETH(xv)] + *dp; \
ba1987562a73 Fix 8to8 saturated scaled blit function.
Matti Hamalainen <ccr@tnsp.org>
parents: 21
diff changeset
236 *(dp++) = q < 256 ? q : 255;
ba1987562a73 Fix 8to8 saturated scaled blit function.
Matti Hamalainen <ccr@tnsp.org>
parents: 21
diff changeset
237
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240 // -----------------------------------------------------------------------
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 #define DM_SCALED_NAME dmScaledBlitSurface8to32Saturate
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 #define DM_SCALED_SRC_BYTES 1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 #define DM_SCALED_DST_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 #define DM_SCALED_SRC_TYPE Uint8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 #define DM_SCALED_DST_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 #define DM_SCALED_VARS const DMRGBA32 *pal;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 #define DM_SCALED_INIT \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 if (src->format->palette == NULL || src->format->palette->ncolors < 256) return -2; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 pal = (DMRGBA32 *) src->format->palette->colors;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 #ifdef DM_USE_SIMD
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 asm("movd %2, %%mm1\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 "movd %1, %%mm2\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 "paddusb %%mm2, %%mm1\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 "movd %%mm1, %0\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 : "=m" (*dp) \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 : "m" (*dp), "m" (pal[sp[FP_GETH(xv)]]) \
17
a60fe802636a Add register clobbers to SIMD inline asm.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
260 : "memory", "%mm1", "%mm2" ); dp++;
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 #define DM_SCALED_FINISH asm("emms\n");
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 #else
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 const DMRGBA32 q = pal[sp[FP_GETH(xv)]]; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 const int qr = dp->r + q.r, qg = dp->g + q.g, qb = dp->b + q.b; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 dp->r = qr < 256 ? qr : 255; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 dp->g = qg < 256 ? qg : 255; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 dp->b = qb < 256 ? qb : 255; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 dp->a = q.a; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 dp++;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 #endif
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 // -----------------------------------------------------------------------
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 #define DM_SCALED_NAME dmScaledBlitSurface32to32Saturate
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 #define DM_SCALED_SRC_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 #define DM_SCALED_DST_BYTES 4
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 #define DM_SCALED_INIT
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 #ifdef DM_USE_SIMD
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 #define DM_SCALED_SRC_TYPE Uint32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 #define DM_SCALED_DST_TYPE Uint32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 asm("movd %2, %%mm1\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 "movd %1, %%mm2\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 "paddusb %%mm2, %%mm1\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 "movd %%mm1, %0\n" \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 : "=m" (*dp) \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 : "m" (*dp), "m" (sp[FP_GETH(xv)]) \
17
a60fe802636a Add register clobbers to SIMD inline asm.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
293 : "memory", "%mm1", "%mm2" ); dp++;
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 #define DM_SCALED_FINISH asm("emms\n");
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 #else
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 #define DM_SCALED_SRC_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 #define DM_SCALED_DST_TYPE DMRGBA32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 #define DM_SCALED_INNER \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300 const DMRGBA32 q = sp[FP_GETH(xv)]; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 const int qr = dp->r + q.r, qg = dp->g + q.g, qb = dp->b + q.b; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 dp->r = qr < 256 ? qr : 255; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 dp->g = qg < 256 ? qg : 255; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 dp->b = qb < 256 ? qb : 255; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 dp->a = q.a; \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 dp++;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 #endif
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 #include "dmscaledblit.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 // =======================================================================
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 // =======================================================================