Fix windows build
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c
index 0a8956a..e2e2e45 100644
--- a/src/video/SDL_blit_N.c
+++ b/src/video/SDL_blit_N.c
@@ -2997,21 +2997,27 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info)
while (height--) {
/* *INDENT-OFF* */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
DUFFS_LOOP(
{
Uint32 *dst32 = (Uint32*)dst;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
Uint32 *src32 = (Uint32*)src;
*dst32 = *src32 | mask;
+ dst += 4;
+ src += srcbpp;
+ }, width);
#else
+ DUFFS_LOOP(
+ {
+ Uint32 *dst32 = (Uint32*)dst;
Uint8 s0 = src[i0];
Uint8 s1 = src[i1];
Uint8 s2 = src[i2];
*dst32 = (s0) | (s1 << 8) | (s2 << 16) | mask;
-#endif
dst += 4;
src += srcbpp;
}, width);
+#endif
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
@@ -3065,21 +3071,28 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info)
while (height--) {
/* *INDENT-OFF* */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
DUFFS_LOOP(
{
Uint32 *dst32 = (Uint32*)dst;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+
Uint32 *src32 = (Uint32*)src;
*dst32 = *src32 & mask;
+ dst += dstbpp;
+ src += srcbpp;
+ }, width);
#else
+ DUFFS_LOOP(
+ {
+ Uint32 *dst32 = (Uint32*)dst;
Uint8 s0 = src[i0];
Uint8 s1 = src[i1];
Uint8 s2 = src[i2];
*dst32 = (s0 << shift0) | (s1 << shift1) | (s2 << shift2);
-#endif
dst += dstbpp;
src += srcbpp;
}, width);
+#endif
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
@@ -3130,21 +3143,19 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info)
/* COPY_ALPHA */
/* Only to switch ABGR8888 <-> ARGB8888 */
while (height--) {
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ int i0 = 0, i1 = 1, i2 = 2, i3 = 3;
+#else
+ int i0 = 3, i1 = 2, i2 = 1, i3 = 0;
+#endif
/* *INDENT-OFF* */
DUFFS_LOOP(
{
Uint32 *dst32 = (Uint32*)dst;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- Uint8 s0 = src[0];
- Uint8 s1 = src[1];
- Uint8 s2 = src[2];
- Uint32 alphashift = src[3] << dstfmt->Ashift;
-#else
- Uint8 s0 = src[3];
- Uint8 s1 = src[2];
- Uint8 s2 = src[1];
- Uint32 alphashift = src[0] << dstfmt->Ashift;
-#endif
+ Uint8 s0 = src[i0];
+ Uint8 s1 = src[i1];
+ Uint8 s2 = src[i2];
+ Uint32 alphashift = src[i3] << dstfmt->Ashift;
/* inversed, compared to Blit_3or4_to_3or4__same_rgb */
*dst32 = (s0 << 16) | (s1 << 8) | (s2) | alphashift;
dst += dstbpp;
@@ -3158,6 +3169,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info)
/* SET_ALPHA */
Uint32 mask = info->a << dstfmt->Ashift;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ int i0 = 0, i1 = 1, i2 = 2;
#else
int i0 = srcbpp - 1 - 0;
int i1 = srcbpp - 1 - 1;
@@ -3169,15 +3181,9 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info)
DUFFS_LOOP(
{
Uint32 *dst32 = (Uint32*)dst;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- Uint8 s0 = src[0];
- Uint8 s1 = src[1];
- Uint8 s2 = src[2];
-#else
Uint8 s0 = src[i0];
Uint8 s1 = src[i1];
Uint8 s2 = src[i2];
-#endif
/* inversed, compared to Blit_3or4_to_3or4__same_rgb */
*dst32 = (s0 << 16) | (s1 << 8) | (s2) | mask;
dst += dstbpp;
@@ -3192,6 +3198,8 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info)
/* NO_ALPHA */
int last_line = 0;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ int i0 = 0, i1 = 1, i2 = 2;
+ int shift0 = 16, shift1 = 8, shift2 = 0;
#else
int i0 = srcbpp - 1 - 0;
int i1 = srcbpp - 1 - 1;
@@ -3218,18 +3226,11 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info)
DUFFS_LOOP(
{
Uint32 *dst32 = (Uint32*)dst;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- Uint8 s0 = src[0];
- Uint8 s1 = src[1];
- Uint8 s2 = src[2];
- /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
- *dst32 = (s0 << 16) | (s1 << 8) | (s2);
-#else
Uint8 s0 = src[i0];
Uint8 s1 = src[i1];
Uint8 s2 = src[i2];
+ /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
*dst32 = (s0 << shift0) | (s1 << shift1) | (s2 << shift2);
-#endif
dst += dstbpp;
src += srcbpp;
}, width);