comparison src/video/SDL_blit_auto.c @ 2800:8969da2ef606

Added ARGB8888 destination format (used on Mac OS X)
author Sam Lantinga <slouken@libsdl.org>
date Sat, 29 Nov 2008 00:08:29 +0000
parents c785543d1843
children 99210400e8b9
comparison
equal deleted inserted replaced
2799:bbf3aac2672a 2800:8969da2ef606
895 posy += incy; 895 posy += incy;
896 info->dst += info->dst_pitch; 896 info->dst += info->dst_pitch;
897 } 897 }
898 } 898 }
899 899
900 static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) 900 static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info)
901 { 901 {
902 const int flags = info->flags; 902 const int flags = info->flags;
903 Uint32 pixel; 903 Uint32 pixel;
904 Uint32 R, G, B, A; 904 Uint32 R, G, B, A;
905 int srcy, srcx; 905 int srcy, srcx;
928 posx -= 0x10000L; 928 posx -= 0x10000L;
929 } 929 }
930 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 930 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
931 } 931 }
932 pixel = *src; 932 pixel = *src;
933 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; 933 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
934 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 934 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
935 *dst = pixel; 935 *dst = pixel;
936 posx += incx; 936 posx += incx;
937 ++dst; 937 ++dst;
938 } 938 }
939 posy += incy; 939 posy += incy;
940 info->dst += info->dst_pitch; 940 info->dst += info->dst_pitch;
941 } 941 }
942 } 942 }
943 943
944 static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info) 944 static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info)
945 { 945 {
946 const int flags = info->flags; 946 const int flags = info->flags;
947 Uint32 srcpixel; 947 Uint32 srcpixel;
948 Uint32 srcR, srcG, srcB, srcA; 948 Uint32 srcR, srcG, srcB, srcA;
949 Uint32 dstpixel; 949 Uint32 dstpixel;
953 Uint32 *src = (Uint32 *)info->src; 953 Uint32 *src = (Uint32 *)info->src;
954 Uint32 *dst = (Uint32 *)info->dst; 954 Uint32 *dst = (Uint32 *)info->dst;
955 int n = info->dst_w; 955 int n = info->dst_w;
956 while (n--) { 956 while (n--) {
957 srcpixel = *src; 957 srcpixel = *src;
958 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 958 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
959 dstpixel = *dst; 959 dstpixel = *dst;
960 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 960 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
961 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 961 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
962 /* This goes away if we ever use premultiplied alpha */ 962 /* This goes away if we ever use premultiplied alpha */
963 if (srcA < 255) { 963 if (srcA < 255) {
964 srcR = (srcR * srcA) / 255; 964 srcR = (srcR * srcA) / 255;
965 srcG = (srcG * srcA) / 255; 965 srcG = (srcG * srcA) / 255;
988 dstR = (srcR * dstR) / 255; 988 dstR = (srcR * dstR) / 255;
989 dstG = (srcG * dstG) / 255; 989 dstG = (srcG * dstG) / 255;
990 dstB = (srcB * dstB) / 255; 990 dstB = (srcB * dstB) / 255;
991 break; 991 break;
992 } 992 }
993 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 993 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
994 *dst = dstpixel; 994 *dst = dstpixel;
995 ++src; 995 ++src;
996 ++dst; 996 ++dst;
997 } 997 }
998 info->src += info->src_pitch; 998 info->src += info->src_pitch;
999 info->dst += info->dst_pitch; 999 info->dst += info->dst_pitch;
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) 1003 static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
1004 { 1004 {
1005 const int flags = info->flags; 1005 const int flags = info->flags;
1006 Uint32 srcpixel; 1006 Uint32 srcpixel;
1007 Uint32 srcR, srcG, srcB, srcA; 1007 Uint32 srcR, srcG, srcB, srcA;
1008 Uint32 dstpixel; 1008 Uint32 dstpixel;
1033 posx -= 0x10000L; 1033 posx -= 0x10000L;
1034 } 1034 }
1035 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1035 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1036 } 1036 }
1037 srcpixel = *src; 1037 srcpixel = *src;
1038 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 1038 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
1039 dstpixel = *dst; 1039 dstpixel = *dst;
1040 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 1040 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
1041 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 1041 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1042 /* This goes away if we ever use premultiplied alpha */ 1042 /* This goes away if we ever use premultiplied alpha */
1043 if (srcA < 255) { 1043 if (srcA < 255) {
1044 srcR = (srcR * srcA) / 255; 1044 srcR = (srcR * srcA) / 255;
1045 srcG = (srcG * srcA) / 255; 1045 srcG = (srcG * srcA) / 255;
1068 dstR = (srcR * dstR) / 255; 1068 dstR = (srcR * dstR) / 255;
1069 dstG = (srcG * dstG) / 255; 1069 dstG = (srcG * dstG) / 255;
1070 dstB = (srcB * dstB) / 255; 1070 dstB = (srcB * dstB) / 255;
1071 break; 1071 break;
1072 } 1072 }
1073 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 1073 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
1074 *dst = dstpixel; 1074 *dst = dstpixel;
1075 posx += incx; 1075 posx += incx;
1076 ++dst; 1076 ++dst;
1077 } 1077 }
1078 posy += incy; 1078 posy += incy;
1079 info->dst += info->dst_pitch; 1079 info->dst += info->dst_pitch;
1080 } 1080 }
1081 } 1081 }
1082 1082
1083 static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info) 1083 static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info)
1084 { 1084 {
1085 const int flags = info->flags; 1085 const int flags = info->flags;
1086 const Uint32 modulateR = info->r; 1086 const Uint32 modulateR = info->r;
1087 const Uint32 modulateG = info->g; 1087 const Uint32 modulateG = info->g;
1088 const Uint32 modulateB = info->b; 1088 const Uint32 modulateB = info->b;
1094 Uint32 *src = (Uint32 *)info->src; 1094 Uint32 *src = (Uint32 *)info->src;
1095 Uint32 *dst = (Uint32 *)info->dst; 1095 Uint32 *dst = (Uint32 *)info->dst;
1096 int n = info->dst_w; 1096 int n = info->dst_w;
1097 while (n--) { 1097 while (n--) {
1098 pixel = *src; 1098 pixel = *src;
1099 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; 1099 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
1100 if (flags & SDL_COPY_MODULATE_COLOR) { 1100 if (flags & SDL_COPY_MODULATE_COLOR) {
1101 R = (R * modulateR) / 255; 1101 R = (R * modulateR) / 255;
1102 G = (G * modulateG) / 255; 1102 G = (G * modulateG) / 255;
1103 B = (B * modulateB) / 255; 1103 B = (B * modulateB) / 255;
1104 } 1104 }
1105 if (flags & SDL_COPY_MODULATE_ALPHA) { 1105 if (flags & SDL_COPY_MODULATE_ALPHA) {
1106 A = (A * modulateA) / 255; 1106 A = (A * modulateA) / 255;
1107 } 1107 }
1108 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 1108 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
1109 *dst = pixel; 1109 *dst = pixel;
1110 ++src; 1110 ++src;
1111 ++dst; 1111 ++dst;
1112 } 1112 }
1113 info->src += info->src_pitch; 1113 info->src += info->src_pitch;
1114 info->dst += info->dst_pitch; 1114 info->dst += info->dst_pitch;
1115 } 1115 }
1116 } 1116 }
1117 1117
1118 static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) 1118 static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
1119 { 1119 {
1120 const int flags = info->flags; 1120 const int flags = info->flags;
1121 const Uint32 modulateR = info->r; 1121 const Uint32 modulateR = info->r;
1122 const Uint32 modulateG = info->g; 1122 const Uint32 modulateG = info->g;
1123 const Uint32 modulateB = info->b; 1123 const Uint32 modulateB = info->b;
1150 posx -= 0x10000L; 1150 posx -= 0x10000L;
1151 } 1151 }
1152 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1152 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1153 } 1153 }
1154 pixel = *src; 1154 pixel = *src;
1155 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF; 1155 R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
1156 if (flags & SDL_COPY_MODULATE_COLOR) { 1156 if (flags & SDL_COPY_MODULATE_COLOR) {
1157 R = (R * modulateR) / 255; 1157 R = (R * modulateR) / 255;
1158 G = (G * modulateG) / 255; 1158 G = (G * modulateG) / 255;
1159 B = (B * modulateB) / 255; 1159 B = (B * modulateB) / 255;
1160 } 1160 }
1161 if (flags & SDL_COPY_MODULATE_ALPHA) { 1161 if (flags & SDL_COPY_MODULATE_ALPHA) {
1162 A = (A * modulateA) / 255; 1162 A = (A * modulateA) / 255;
1163 } 1163 }
1164 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 1164 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
1165 *dst = pixel; 1165 *dst = pixel;
1166 posx += incx; 1166 posx += incx;
1167 ++dst; 1167 ++dst;
1168 } 1168 }
1169 posy += incy; 1169 posy += incy;
1170 info->dst += info->dst_pitch; 1170 info->dst += info->dst_pitch;
1171 } 1171 }
1172 } 1172 }
1173 1173
1174 static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info) 1174 static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
1175 { 1175 {
1176 const int flags = info->flags; 1176 const int flags = info->flags;
1177 const Uint32 modulateR = info->r; 1177 const Uint32 modulateR = info->r;
1178 const Uint32 modulateG = info->g; 1178 const Uint32 modulateG = info->g;
1179 const Uint32 modulateB = info->b; 1179 const Uint32 modulateB = info->b;
1187 Uint32 *src = (Uint32 *)info->src; 1187 Uint32 *src = (Uint32 *)info->src;
1188 Uint32 *dst = (Uint32 *)info->dst; 1188 Uint32 *dst = (Uint32 *)info->dst;
1189 int n = info->dst_w; 1189 int n = info->dst_w;
1190 while (n--) { 1190 while (n--) {
1191 srcpixel = *src; 1191 srcpixel = *src;
1192 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 1192 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
1193 dstpixel = *dst; 1193 dstpixel = *dst;
1194 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 1194 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
1195 if (flags & SDL_COPY_MODULATE_COLOR) { 1195 if (flags & SDL_COPY_MODULATE_COLOR) {
1196 srcR = (srcR * modulateR) / 255; 1196 srcR = (srcR * modulateR) / 255;
1197 srcG = (srcG * modulateG) / 255; 1197 srcG = (srcG * modulateG) / 255;
1198 srcB = (srcB * modulateB) / 255; 1198 srcB = (srcB * modulateB) / 255;
1199 } 1199 }
1230 dstR = (srcR * dstR) / 255; 1230 dstR = (srcR * dstR) / 255;
1231 dstG = (srcG * dstG) / 255; 1231 dstG = (srcG * dstG) / 255;
1232 dstB = (srcB * dstB) / 255; 1232 dstB = (srcB * dstB) / 255;
1233 break; 1233 break;
1234 } 1234 }
1235 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 1235 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
1236 *dst = dstpixel; 1236 *dst = dstpixel;
1237 ++src; 1237 ++src;
1238 ++dst; 1238 ++dst;
1239 } 1239 }
1240 info->src += info->src_pitch; 1240 info->src += info->src_pitch;
1241 info->dst += info->dst_pitch; 1241 info->dst += info->dst_pitch;
1242 } 1242 }
1243 } 1243 }
1244 1244
1245 static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) 1245 static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
1246 { 1246 {
1247 const int flags = info->flags; 1247 const int flags = info->flags;
1248 const Uint32 modulateR = info->r; 1248 const Uint32 modulateR = info->r;
1249 const Uint32 modulateG = info->g; 1249 const Uint32 modulateG = info->g;
1250 const Uint32 modulateB = info->b; 1250 const Uint32 modulateB = info->b;
1279 posx -= 0x10000L; 1279 posx -= 0x10000L;
1280 } 1280 }
1281 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1281 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1282 } 1282 }
1283 srcpixel = *src; 1283 srcpixel = *src;
1284 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 1284 srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
1285 dstpixel = *dst; 1285 dstpixel = *dst;
1286 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 1286 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
1287 if (flags & SDL_COPY_MODULATE_COLOR) { 1287 if (flags & SDL_COPY_MODULATE_COLOR) {
1288 srcR = (srcR * modulateR) / 255; 1288 srcR = (srcR * modulateR) / 255;
1289 srcG = (srcG * modulateG) / 255; 1289 srcG = (srcG * modulateG) / 255;
1290 srcB = (srcB * modulateB) / 255; 1290 srcB = (srcB * modulateB) / 255;
1291 } 1291 }
1322 dstR = (srcR * dstR) / 255; 1322 dstR = (srcR * dstR) / 255;
1323 dstG = (srcG * dstG) / 255; 1323 dstG = (srcG * dstG) / 255;
1324 dstB = (srcB * dstB) / 255; 1324 dstB = (srcB * dstB) / 255;
1325 break; 1325 break;
1326 } 1326 }
1327 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 1327 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
1328 *dst = dstpixel; 1328 *dst = dstpixel;
1329 posx += incx; 1329 posx += incx;
1330 ++dst; 1330 ++dst;
1331 } 1331 }
1332 posy += incy; 1332 posy += incy;
1333 info->dst += info->dst_pitch; 1333 info->dst += info->dst_pitch;
1334 } 1334 }
1335 } 1335 }
1336 1336
1337 static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) 1337 static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info)
1338 { 1338 {
1339 const int flags = info->flags; 1339 const int flags = info->flags;
1340 Uint32 pixel;
1341 Uint32 R, G, B, A;
1340 int srcy, srcx; 1342 int srcy, srcx;
1341 int posy, posx; 1343 int posy, posx;
1342 int incy, incx; 1344 int incy, incx;
1343 1345
1344 srcy = 0; 1346 srcy = 0;
1362 ++srcx; 1364 ++srcx;
1363 posx -= 0x10000L; 1365 posx -= 0x10000L;
1364 } 1366 }
1365 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1367 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1366 } 1368 }
1367 *dst = *src; 1369 pixel = *src;
1370 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
1371 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
1372 *dst = pixel;
1368 posx += incx; 1373 posx += incx;
1369 ++dst; 1374 ++dst;
1370 } 1375 }
1371 posy += incy; 1376 posy += incy;
1372 info->dst += info->dst_pitch; 1377 info->dst += info->dst_pitch;
1373 } 1378 }
1374 } 1379 }
1375 1380
1376 static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info) 1381 static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
1377 { 1382 {
1378 const int flags = info->flags; 1383 const int flags = info->flags;
1379 Uint32 srcpixel; 1384 Uint32 srcpixel;
1380 Uint32 srcR, srcG, srcB, srcA; 1385 Uint32 srcR, srcG, srcB, srcA;
1381 Uint32 dstpixel; 1386 Uint32 dstpixel;
1387 int n = info->dst_w; 1392 int n = info->dst_w;
1388 while (n--) { 1393 while (n--) {
1389 srcpixel = *src; 1394 srcpixel = *src;
1390 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 1395 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
1391 dstpixel = *dst; 1396 dstpixel = *dst;
1392 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 1397 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
1393 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 1398 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1394 /* This goes away if we ever use premultiplied alpha */ 1399 /* This goes away if we ever use premultiplied alpha */
1395 if (srcA < 255) { 1400 if (srcA < 255) {
1396 srcR = (srcR * srcA) / 255; 1401 srcR = (srcR * srcA) / 255;
1397 srcG = (srcG * srcA) / 255; 1402 srcG = (srcG * srcA) / 255;
1420 dstR = (srcR * dstR) / 255; 1425 dstR = (srcR * dstR) / 255;
1421 dstG = (srcG * dstG) / 255; 1426 dstG = (srcG * dstG) / 255;
1422 dstB = (srcB * dstB) / 255; 1427 dstB = (srcB * dstB) / 255;
1423 break; 1428 break;
1424 } 1429 }
1425 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 1430 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
1426 *dst = dstpixel; 1431 *dst = dstpixel;
1427 ++src; 1432 ++src;
1428 ++dst; 1433 ++dst;
1429 } 1434 }
1430 info->src += info->src_pitch; 1435 info->src += info->src_pitch;
1431 info->dst += info->dst_pitch; 1436 info->dst += info->dst_pitch;
1432 } 1437 }
1433 } 1438 }
1434 1439
1435 static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) 1440 static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
1436 { 1441 {
1437 const int flags = info->flags; 1442 const int flags = info->flags;
1438 Uint32 srcpixel; 1443 Uint32 srcpixel;
1439 Uint32 srcR, srcG, srcB, srcA; 1444 Uint32 srcR, srcG, srcB, srcA;
1440 Uint32 dstpixel; 1445 Uint32 dstpixel;
1467 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1472 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1468 } 1473 }
1469 srcpixel = *src; 1474 srcpixel = *src;
1470 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 1475 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
1471 dstpixel = *dst; 1476 dstpixel = *dst;
1472 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 1477 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
1473 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 1478 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1474 /* This goes away if we ever use premultiplied alpha */ 1479 /* This goes away if we ever use premultiplied alpha */
1475 if (srcA < 255) { 1480 if (srcA < 255) {
1476 srcR = (srcR * srcA) / 255; 1481 srcR = (srcR * srcA) / 255;
1477 srcG = (srcG * srcA) / 255; 1482 srcG = (srcG * srcA) / 255;
1500 dstR = (srcR * dstR) / 255; 1505 dstR = (srcR * dstR) / 255;
1501 dstG = (srcG * dstG) / 255; 1506 dstG = (srcG * dstG) / 255;
1502 dstB = (srcB * dstB) / 255; 1507 dstB = (srcB * dstB) / 255;
1503 break; 1508 break;
1504 } 1509 }
1505 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 1510 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
1506 *dst = dstpixel; 1511 *dst = dstpixel;
1507 posx += incx; 1512 posx += incx;
1508 ++dst; 1513 ++dst;
1509 } 1514 }
1510 posy += incy; 1515 posy += incy;
1511 info->dst += info->dst_pitch; 1516 info->dst += info->dst_pitch;
1512 } 1517 }
1513 } 1518 }
1514 1519
1515 static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info) 1520 static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info)
1516 { 1521 {
1517 const int flags = info->flags; 1522 const int flags = info->flags;
1518 const Uint32 modulateR = info->r; 1523 const Uint32 modulateR = info->r;
1519 const Uint32 modulateG = info->g; 1524 const Uint32 modulateG = info->g;
1520 const Uint32 modulateB = info->b; 1525 const Uint32 modulateB = info->b;
1535 B = (B * modulateB) / 255; 1540 B = (B * modulateB) / 255;
1536 } 1541 }
1537 if (flags & SDL_COPY_MODULATE_ALPHA) { 1542 if (flags & SDL_COPY_MODULATE_ALPHA) {
1538 A = (A * modulateA) / 255; 1543 A = (A * modulateA) / 255;
1539 } 1544 }
1540 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 1545 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
1541 *dst = pixel; 1546 *dst = pixel;
1542 ++src; 1547 ++src;
1543 ++dst; 1548 ++dst;
1544 } 1549 }
1545 info->src += info->src_pitch; 1550 info->src += info->src_pitch;
1546 info->dst += info->dst_pitch; 1551 info->dst += info->dst_pitch;
1547 } 1552 }
1548 } 1553 }
1549 1554
1550 static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) 1555 static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
1551 { 1556 {
1552 const int flags = info->flags; 1557 const int flags = info->flags;
1553 const Uint32 modulateR = info->r; 1558 const Uint32 modulateR = info->r;
1554 const Uint32 modulateG = info->g; 1559 const Uint32 modulateG = info->g;
1555 const Uint32 modulateB = info->b; 1560 const Uint32 modulateB = info->b;
1591 B = (B * modulateB) / 255; 1596 B = (B * modulateB) / 255;
1592 } 1597 }
1593 if (flags & SDL_COPY_MODULATE_ALPHA) { 1598 if (flags & SDL_COPY_MODULATE_ALPHA) {
1594 A = (A * modulateA) / 255; 1599 A = (A * modulateA) / 255;
1595 } 1600 }
1596 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 1601 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
1597 *dst = pixel; 1602 *dst = pixel;
1598 posx += incx; 1603 posx += incx;
1599 ++dst; 1604 ++dst;
1600 } 1605 }
1601 posy += incy; 1606 posy += incy;
1602 info->dst += info->dst_pitch; 1607 info->dst += info->dst_pitch;
1603 } 1608 }
1604 } 1609 }
1605 1610
1606 static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info) 1611 static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
1607 { 1612 {
1608 const int flags = info->flags; 1613 const int flags = info->flags;
1609 const Uint32 modulateR = info->r; 1614 const Uint32 modulateR = info->r;
1610 const Uint32 modulateG = info->g; 1615 const Uint32 modulateG = info->g;
1611 const Uint32 modulateB = info->b; 1616 const Uint32 modulateB = info->b;
1621 int n = info->dst_w; 1626 int n = info->dst_w;
1622 while (n--) { 1627 while (n--) {
1623 srcpixel = *src; 1628 srcpixel = *src;
1624 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 1629 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
1625 dstpixel = *dst; 1630 dstpixel = *dst;
1626 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 1631 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
1627 if (flags & SDL_COPY_MODULATE_COLOR) { 1632 if (flags & SDL_COPY_MODULATE_COLOR) {
1628 srcR = (srcR * modulateR) / 255; 1633 srcR = (srcR * modulateR) / 255;
1629 srcG = (srcG * modulateG) / 255; 1634 srcG = (srcG * modulateG) / 255;
1630 srcB = (srcB * modulateB) / 255; 1635 srcB = (srcB * modulateB) / 255;
1631 } 1636 }
1662 dstR = (srcR * dstR) / 255; 1667 dstR = (srcR * dstR) / 255;
1663 dstG = (srcG * dstG) / 255; 1668 dstG = (srcG * dstG) / 255;
1664 dstB = (srcB * dstB) / 255; 1669 dstB = (srcB * dstB) / 255;
1665 break; 1670 break;
1666 } 1671 }
1667 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 1672 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
1668 *dst = dstpixel; 1673 *dst = dstpixel;
1669 ++src; 1674 ++src;
1670 ++dst; 1675 ++dst;
1671 } 1676 }
1672 info->src += info->src_pitch; 1677 info->src += info->src_pitch;
1673 info->dst += info->dst_pitch; 1678 info->dst += info->dst_pitch;
1674 } 1679 }
1675 } 1680 }
1676 1681
1677 static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) 1682 static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
1678 { 1683 {
1679 const int flags = info->flags; 1684 const int flags = info->flags;
1680 const Uint32 modulateR = info->r; 1685 const Uint32 modulateR = info->r;
1681 const Uint32 modulateG = info->g; 1686 const Uint32 modulateG = info->g;
1682 const Uint32 modulateB = info->b; 1687 const Uint32 modulateB = info->b;
1713 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1718 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1714 } 1719 }
1715 srcpixel = *src; 1720 srcpixel = *src;
1716 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF; 1721 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
1717 dstpixel = *dst; 1722 dstpixel = *dst;
1718 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 1723 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
1719 if (flags & SDL_COPY_MODULATE_COLOR) { 1724 if (flags & SDL_COPY_MODULATE_COLOR) {
1720 srcR = (srcR * modulateR) / 255; 1725 srcR = (srcR * modulateR) / 255;
1721 srcG = (srcG * modulateG) / 255; 1726 srcG = (srcG * modulateG) / 255;
1722 srcB = (srcB * modulateB) / 255; 1727 srcB = (srcB * modulateB) / 255;
1723 } 1728 }
1754 dstR = (srcR * dstR) / 255; 1759 dstR = (srcR * dstR) / 255;
1755 dstG = (srcG * dstG) / 255; 1760 dstG = (srcG * dstG) / 255;
1756 dstB = (srcB * dstB) / 255; 1761 dstB = (srcB * dstB) / 255;
1757 break; 1762 break;
1758 } 1763 }
1759 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 1764 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
1760 *dst = dstpixel; 1765 *dst = dstpixel;
1761 posx += incx; 1766 posx += incx;
1762 ++dst; 1767 ++dst;
1763 } 1768 }
1764 posy += incy; 1769 posy += incy;
1765 info->dst += info->dst_pitch; 1770 info->dst += info->dst_pitch;
1766 } 1771 }
1767 } 1772 }
1768 1773
1769 static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) 1774 static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info)
1770 { 1775 {
1771 const int flags = info->flags; 1776 const int flags = info->flags;
1772 Uint32 pixel;
1773 Uint32 R, G, B, A;
1774 int srcy, srcx; 1777 int srcy, srcx;
1775 int posy, posx; 1778 int posy, posx;
1776 int incy, incx; 1779 int incy, incx;
1777 1780
1778 srcy = 0; 1781 srcy = 0;
1796 ++srcx; 1799 ++srcx;
1797 posx -= 0x10000L; 1800 posx -= 0x10000L;
1798 } 1801 }
1799 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1802 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1800 } 1803 }
1801 pixel = *src; 1804 *dst = *src;
1802 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
1803 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
1804 *dst = pixel;
1805 posx += incx; 1805 posx += incx;
1806 ++dst; 1806 ++dst;
1807 } 1807 }
1808 posy += incy; 1808 posy += incy;
1809 info->dst += info->dst_pitch; 1809 info->dst += info->dst_pitch;
1810 } 1810 }
1811 } 1811 }
1812 1812
1813 static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info) 1813 static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
1814 { 1814 {
1815 const int flags = info->flags; 1815 const int flags = info->flags;
1816 Uint32 srcpixel; 1816 Uint32 srcpixel;
1817 Uint32 srcR, srcG, srcB, srcA; 1817 Uint32 srcR, srcG, srcB, srcA;
1818 Uint32 dstpixel; 1818 Uint32 dstpixel;
1822 Uint32 *src = (Uint32 *)info->src; 1822 Uint32 *src = (Uint32 *)info->src;
1823 Uint32 *dst = (Uint32 *)info->dst; 1823 Uint32 *dst = (Uint32 *)info->dst;
1824 int n = info->dst_w; 1824 int n = info->dst_w;
1825 while (n--) { 1825 while (n--) {
1826 srcpixel = *src; 1826 srcpixel = *src;
1827 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 1827 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
1828 dstpixel = *dst; 1828 dstpixel = *dst;
1829 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 1829 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
1830 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 1830 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1831 /* This goes away if we ever use premultiplied alpha */ 1831 /* This goes away if we ever use premultiplied alpha */
1832 if (srcA < 255) { 1832 if (srcA < 255) {
1833 srcR = (srcR * srcA) / 255; 1833 srcR = (srcR * srcA) / 255;
1834 srcG = (srcG * srcA) / 255; 1834 srcG = (srcG * srcA) / 255;
1857 dstR = (srcR * dstR) / 255; 1857 dstR = (srcR * dstR) / 255;
1858 dstG = (srcG * dstG) / 255; 1858 dstG = (srcG * dstG) / 255;
1859 dstB = (srcB * dstB) / 255; 1859 dstB = (srcB * dstB) / 255;
1860 break; 1860 break;
1861 } 1861 }
1862 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 1862 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
1863 *dst = dstpixel; 1863 *dst = dstpixel;
1864 ++src; 1864 ++src;
1865 ++dst; 1865 ++dst;
1866 } 1866 }
1867 info->src += info->src_pitch; 1867 info->src += info->src_pitch;
1868 info->dst += info->dst_pitch; 1868 info->dst += info->dst_pitch;
1869 } 1869 }
1870 } 1870 }
1871 1871
1872 static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) 1872 static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
1873 { 1873 {
1874 const int flags = info->flags; 1874 const int flags = info->flags;
1875 Uint32 srcpixel; 1875 Uint32 srcpixel;
1876 Uint32 srcR, srcG, srcB, srcA; 1876 Uint32 srcR, srcG, srcB, srcA;
1877 Uint32 dstpixel; 1877 Uint32 dstpixel;
1902 posx -= 0x10000L; 1902 posx -= 0x10000L;
1903 } 1903 }
1904 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 1904 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
1905 } 1905 }
1906 srcpixel = *src; 1906 srcpixel = *src;
1907 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 1907 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
1908 dstpixel = *dst; 1908 dstpixel = *dst;
1909 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 1909 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
1910 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 1910 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
1911 /* This goes away if we ever use premultiplied alpha */ 1911 /* This goes away if we ever use premultiplied alpha */
1912 if (srcA < 255) { 1912 if (srcA < 255) {
1913 srcR = (srcR * srcA) / 255; 1913 srcR = (srcR * srcA) / 255;
1914 srcG = (srcG * srcA) / 255; 1914 srcG = (srcG * srcA) / 255;
1937 dstR = (srcR * dstR) / 255; 1937 dstR = (srcR * dstR) / 255;
1938 dstG = (srcG * dstG) / 255; 1938 dstG = (srcG * dstG) / 255;
1939 dstB = (srcB * dstB) / 255; 1939 dstB = (srcB * dstB) / 255;
1940 break; 1940 break;
1941 } 1941 }
1942 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 1942 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
1943 *dst = dstpixel; 1943 *dst = dstpixel;
1944 posx += incx; 1944 posx += incx;
1945 ++dst; 1945 ++dst;
1946 } 1946 }
1947 posy += incy; 1947 posy += incy;
1948 info->dst += info->dst_pitch; 1948 info->dst += info->dst_pitch;
1949 } 1949 }
1950 } 1950 }
1951 1951
1952 static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info) 1952 static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info)
1953 { 1953 {
1954 const int flags = info->flags; 1954 const int flags = info->flags;
1955 const Uint32 modulateR = info->r; 1955 const Uint32 modulateR = info->r;
1956 const Uint32 modulateG = info->g; 1956 const Uint32 modulateG = info->g;
1957 const Uint32 modulateB = info->b; 1957 const Uint32 modulateB = info->b;
1963 Uint32 *src = (Uint32 *)info->src; 1963 Uint32 *src = (Uint32 *)info->src;
1964 Uint32 *dst = (Uint32 *)info->dst; 1964 Uint32 *dst = (Uint32 *)info->dst;
1965 int n = info->dst_w; 1965 int n = info->dst_w;
1966 while (n--) { 1966 while (n--) {
1967 pixel = *src; 1967 pixel = *src;
1968 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; 1968 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
1969 if (flags & SDL_COPY_MODULATE_COLOR) { 1969 if (flags & SDL_COPY_MODULATE_COLOR) {
1970 R = (R * modulateR) / 255; 1970 R = (R * modulateR) / 255;
1971 G = (G * modulateG) / 255; 1971 G = (G * modulateG) / 255;
1972 B = (B * modulateB) / 255; 1972 B = (B * modulateB) / 255;
1973 } 1973 }
1974 if (flags & SDL_COPY_MODULATE_ALPHA) { 1974 if (flags & SDL_COPY_MODULATE_ALPHA) {
1975 A = (A * modulateA) / 255; 1975 A = (A * modulateA) / 255;
1976 } 1976 }
1977 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 1977 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
1978 *dst = pixel; 1978 *dst = pixel;
1979 ++src; 1979 ++src;
1980 ++dst; 1980 ++dst;
1981 } 1981 }
1982 info->src += info->src_pitch; 1982 info->src += info->src_pitch;
1983 info->dst += info->dst_pitch; 1983 info->dst += info->dst_pitch;
1984 } 1984 }
1985 } 1985 }
1986 1986
1987 static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) 1987 static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
1988 { 1988 {
1989 const int flags = info->flags; 1989 const int flags = info->flags;
1990 const Uint32 modulateR = info->r; 1990 const Uint32 modulateR = info->r;
1991 const Uint32 modulateG = info->g; 1991 const Uint32 modulateG = info->g;
1992 const Uint32 modulateB = info->b; 1992 const Uint32 modulateB = info->b;
2019 posx -= 0x10000L; 2019 posx -= 0x10000L;
2020 } 2020 }
2021 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2021 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2022 } 2022 }
2023 pixel = *src; 2023 pixel = *src;
2024 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; 2024 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
2025 if (flags & SDL_COPY_MODULATE_COLOR) { 2025 if (flags & SDL_COPY_MODULATE_COLOR) {
2026 R = (R * modulateR) / 255; 2026 R = (R * modulateR) / 255;
2027 G = (G * modulateG) / 255; 2027 G = (G * modulateG) / 255;
2028 B = (B * modulateB) / 255; 2028 B = (B * modulateB) / 255;
2029 } 2029 }
2030 if (flags & SDL_COPY_MODULATE_ALPHA) { 2030 if (flags & SDL_COPY_MODULATE_ALPHA) {
2031 A = (A * modulateA) / 255; 2031 A = (A * modulateA) / 255;
2032 } 2032 }
2033 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 2033 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
2034 *dst = pixel; 2034 *dst = pixel;
2035 posx += incx; 2035 posx += incx;
2036 ++dst; 2036 ++dst;
2037 } 2037 }
2038 posy += incy; 2038 posy += incy;
2039 info->dst += info->dst_pitch; 2039 info->dst += info->dst_pitch;
2040 } 2040 }
2041 } 2041 }
2042 2042
2043 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) 2043 static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
2044 { 2044 {
2045 const int flags = info->flags; 2045 const int flags = info->flags;
2046 const Uint32 modulateR = info->r; 2046 const Uint32 modulateR = info->r;
2047 const Uint32 modulateG = info->g; 2047 const Uint32 modulateG = info->g;
2048 const Uint32 modulateB = info->b; 2048 const Uint32 modulateB = info->b;
2056 Uint32 *src = (Uint32 *)info->src; 2056 Uint32 *src = (Uint32 *)info->src;
2057 Uint32 *dst = (Uint32 *)info->dst; 2057 Uint32 *dst = (Uint32 *)info->dst;
2058 int n = info->dst_w; 2058 int n = info->dst_w;
2059 while (n--) { 2059 while (n--) {
2060 srcpixel = *src; 2060 srcpixel = *src;
2061 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 2061 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
2062 dstpixel = *dst; 2062 dstpixel = *dst;
2063 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 2063 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
2064 if (flags & SDL_COPY_MODULATE_COLOR) { 2064 if (flags & SDL_COPY_MODULATE_COLOR) {
2065 srcR = (srcR * modulateR) / 255; 2065 srcR = (srcR * modulateR) / 255;
2066 srcG = (srcG * modulateG) / 255; 2066 srcG = (srcG * modulateG) / 255;
2067 srcB = (srcB * modulateB) / 255; 2067 srcB = (srcB * modulateB) / 255;
2068 } 2068 }
2099 dstR = (srcR * dstR) / 255; 2099 dstR = (srcR * dstR) / 255;
2100 dstG = (srcG * dstG) / 255; 2100 dstG = (srcG * dstG) / 255;
2101 dstB = (srcB * dstB) / 255; 2101 dstB = (srcB * dstB) / 255;
2102 break; 2102 break;
2103 } 2103 }
2104 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 2104 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
2105 *dst = dstpixel; 2105 *dst = dstpixel;
2106 ++src; 2106 ++src;
2107 ++dst; 2107 ++dst;
2108 } 2108 }
2109 info->src += info->src_pitch; 2109 info->src += info->src_pitch;
2110 info->dst += info->dst_pitch; 2110 info->dst += info->dst_pitch;
2111 } 2111 }
2112 } 2112 }
2113 2113
2114 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) 2114 static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
2115 { 2115 {
2116 const int flags = info->flags; 2116 const int flags = info->flags;
2117 const Uint32 modulateR = info->r; 2117 const Uint32 modulateR = info->r;
2118 const Uint32 modulateG = info->g; 2118 const Uint32 modulateG = info->g;
2119 const Uint32 modulateB = info->b; 2119 const Uint32 modulateB = info->b;
2148 posx -= 0x10000L; 2148 posx -= 0x10000L;
2149 } 2149 }
2150 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2150 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2151 } 2151 }
2152 srcpixel = *src; 2152 srcpixel = *src;
2153 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 2153 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
2154 dstpixel = *dst; 2154 dstpixel = *dst;
2155 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 2155 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
2156 if (flags & SDL_COPY_MODULATE_COLOR) { 2156 if (flags & SDL_COPY_MODULATE_COLOR) {
2157 srcR = (srcR * modulateR) / 255; 2157 srcR = (srcR * modulateR) / 255;
2158 srcG = (srcG * modulateG) / 255; 2158 srcG = (srcG * modulateG) / 255;
2159 srcB = (srcB * modulateB) / 255; 2159 srcB = (srcB * modulateB) / 255;
2160 } 2160 }
2191 dstR = (srcR * dstR) / 255; 2191 dstR = (srcR * dstR) / 255;
2192 dstG = (srcG * dstG) / 255; 2192 dstG = (srcG * dstG) / 255;
2193 dstB = (srcB * dstB) / 255; 2193 dstB = (srcB * dstB) / 255;
2194 break; 2194 break;
2195 } 2195 }
2196 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 2196 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
2197 *dst = dstpixel; 2197 *dst = dstpixel;
2198 posx += incx; 2198 posx += incx;
2199 ++dst; 2199 ++dst;
2200 } 2200 }
2201 posy += incy; 2201 posy += incy;
2202 info->dst += info->dst_pitch; 2202 info->dst += info->dst_pitch;
2203 } 2203 }
2204 } 2204 }
2205 2205
2206 static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) 2206 static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info)
2207 { 2207 {
2208 const int flags = info->flags; 2208 const int flags = info->flags;
2209 Uint32 pixel; 2209 Uint32 pixel;
2210 Uint32 R, G, B, A; 2210 Uint32 R, G, B, A;
2211 int srcy, srcx; 2211 int srcy, srcx;
2234 posx -= 0x10000L; 2234 posx -= 0x10000L;
2235 } 2235 }
2236 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2236 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2237 } 2237 }
2238 pixel = *src; 2238 pixel = *src;
2239 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; 2239 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
2240 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 2240 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
2241 *dst = pixel; 2241 *dst = pixel;
2242 posx += incx; 2242 posx += incx;
2243 ++dst; 2243 ++dst;
2244 } 2244 }
2245 posy += incy; 2245 posy += incy;
2246 info->dst += info->dst_pitch; 2246 info->dst += info->dst_pitch;
2247 } 2247 }
2248 } 2248 }
2249 2249
2250 static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info) 2250 static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info)
2251 { 2251 {
2252 const int flags = info->flags; 2252 const int flags = info->flags;
2253 Uint32 srcpixel; 2253 Uint32 srcpixel;
2254 Uint32 srcR, srcG, srcB, srcA; 2254 Uint32 srcR, srcG, srcB, srcA;
2255 Uint32 dstpixel; 2255 Uint32 dstpixel;
2259 Uint32 *src = (Uint32 *)info->src; 2259 Uint32 *src = (Uint32 *)info->src;
2260 Uint32 *dst = (Uint32 *)info->dst; 2260 Uint32 *dst = (Uint32 *)info->dst;
2261 int n = info->dst_w; 2261 int n = info->dst_w;
2262 while (n--) { 2262 while (n--) {
2263 srcpixel = *src; 2263 srcpixel = *src;
2264 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 2264 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
2265 dstpixel = *dst; 2265 dstpixel = *dst;
2266 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 2266 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2267 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 2267 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2268 /* This goes away if we ever use premultiplied alpha */ 2268 /* This goes away if we ever use premultiplied alpha */
2269 if (srcA < 255) { 2269 if (srcA < 255) {
2270 srcR = (srcR * srcA) / 255; 2270 srcR = (srcR * srcA) / 255;
2271 srcG = (srcG * srcA) / 255; 2271 srcG = (srcG * srcA) / 255;
2294 dstR = (srcR * dstR) / 255; 2294 dstR = (srcR * dstR) / 255;
2295 dstG = (srcG * dstG) / 255; 2295 dstG = (srcG * dstG) / 255;
2296 dstB = (srcB * dstB) / 255; 2296 dstB = (srcB * dstB) / 255;
2297 break; 2297 break;
2298 } 2298 }
2299 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 2299 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
2300 *dst = dstpixel; 2300 *dst = dstpixel;
2301 ++src; 2301 ++src;
2302 ++dst; 2302 ++dst;
2303 } 2303 }
2304 info->src += info->src_pitch; 2304 info->src += info->src_pitch;
2305 info->dst += info->dst_pitch; 2305 info->dst += info->dst_pitch;
2306 } 2306 }
2307 } 2307 }
2308 2308
2309 static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) 2309 static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
2310 { 2310 {
2311 const int flags = info->flags; 2311 const int flags = info->flags;
2312 Uint32 srcpixel; 2312 Uint32 srcpixel;
2313 Uint32 srcR, srcG, srcB, srcA; 2313 Uint32 srcR, srcG, srcB, srcA;
2314 Uint32 dstpixel; 2314 Uint32 dstpixel;
2339 posx -= 0x10000L; 2339 posx -= 0x10000L;
2340 } 2340 }
2341 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2341 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2342 } 2342 }
2343 srcpixel = *src; 2343 srcpixel = *src;
2344 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 2344 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
2345 dstpixel = *dst; 2345 dstpixel = *dst;
2346 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 2346 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2347 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 2347 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2348 /* This goes away if we ever use premultiplied alpha */ 2348 /* This goes away if we ever use premultiplied alpha */
2349 if (srcA < 255) { 2349 if (srcA < 255) {
2350 srcR = (srcR * srcA) / 255; 2350 srcR = (srcR * srcA) / 255;
2351 srcG = (srcG * srcA) / 255; 2351 srcG = (srcG * srcA) / 255;
2374 dstR = (srcR * dstR) / 255; 2374 dstR = (srcR * dstR) / 255;
2375 dstG = (srcG * dstG) / 255; 2375 dstG = (srcG * dstG) / 255;
2376 dstB = (srcB * dstB) / 255; 2376 dstB = (srcB * dstB) / 255;
2377 break; 2377 break;
2378 } 2378 }
2379 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 2379 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
2380 *dst = dstpixel; 2380 *dst = dstpixel;
2381 posx += incx; 2381 posx += incx;
2382 ++dst; 2382 ++dst;
2383 } 2383 }
2384 posy += incy; 2384 posy += incy;
2385 info->dst += info->dst_pitch; 2385 info->dst += info->dst_pitch;
2386 } 2386 }
2387 } 2387 }
2388 2388
2389 static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info) 2389 static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info)
2390 { 2390 {
2391 const int flags = info->flags; 2391 const int flags = info->flags;
2392 const Uint32 modulateR = info->r; 2392 const Uint32 modulateR = info->r;
2393 const Uint32 modulateG = info->g; 2393 const Uint32 modulateG = info->g;
2394 const Uint32 modulateB = info->b; 2394 const Uint32 modulateB = info->b;
2400 Uint32 *src = (Uint32 *)info->src; 2400 Uint32 *src = (Uint32 *)info->src;
2401 Uint32 *dst = (Uint32 *)info->dst; 2401 Uint32 *dst = (Uint32 *)info->dst;
2402 int n = info->dst_w; 2402 int n = info->dst_w;
2403 while (n--) { 2403 while (n--) {
2404 pixel = *src; 2404 pixel = *src;
2405 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; 2405 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
2406 if (flags & SDL_COPY_MODULATE_COLOR) { 2406 if (flags & SDL_COPY_MODULATE_COLOR) {
2407 R = (R * modulateR) / 255; 2407 R = (R * modulateR) / 255;
2408 G = (G * modulateG) / 255; 2408 G = (G * modulateG) / 255;
2409 B = (B * modulateB) / 255; 2409 B = (B * modulateB) / 255;
2410 } 2410 }
2411 if (flags & SDL_COPY_MODULATE_ALPHA) { 2411 if (flags & SDL_COPY_MODULATE_ALPHA) {
2412 A = (A * modulateA) / 255; 2412 A = (A * modulateA) / 255;
2413 } 2413 }
2414 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 2414 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
2415 *dst = pixel; 2415 *dst = pixel;
2416 ++src; 2416 ++src;
2417 ++dst; 2417 ++dst;
2418 } 2418 }
2419 info->src += info->src_pitch; 2419 info->src += info->src_pitch;
2420 info->dst += info->dst_pitch; 2420 info->dst += info->dst_pitch;
2421 } 2421 }
2422 } 2422 }
2423 2423
2424 static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) 2424 static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
2425 { 2425 {
2426 const int flags = info->flags; 2426 const int flags = info->flags;
2427 const Uint32 modulateR = info->r; 2427 const Uint32 modulateR = info->r;
2428 const Uint32 modulateG = info->g; 2428 const Uint32 modulateG = info->g;
2429 const Uint32 modulateB = info->b; 2429 const Uint32 modulateB = info->b;
2456 posx -= 0x10000L; 2456 posx -= 0x10000L;
2457 } 2457 }
2458 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2458 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2459 } 2459 }
2460 pixel = *src; 2460 pixel = *src;
2461 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; 2461 B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
2462 if (flags & SDL_COPY_MODULATE_COLOR) { 2462 if (flags & SDL_COPY_MODULATE_COLOR) {
2463 R = (R * modulateR) / 255; 2463 R = (R * modulateR) / 255;
2464 G = (G * modulateG) / 255; 2464 G = (G * modulateG) / 255;
2465 B = (B * modulateB) / 255; 2465 B = (B * modulateB) / 255;
2466 } 2466 }
2467 if (flags & SDL_COPY_MODULATE_ALPHA) { 2467 if (flags & SDL_COPY_MODULATE_ALPHA) {
2468 A = (A * modulateA) / 255; 2468 A = (A * modulateA) / 255;
2469 } 2469 }
2470 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 2470 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
2471 *dst = pixel; 2471 *dst = pixel;
2472 posx += incx; 2472 posx += incx;
2473 ++dst; 2473 ++dst;
2474 } 2474 }
2475 posy += incy; 2475 posy += incy;
2476 info->dst += info->dst_pitch; 2476 info->dst += info->dst_pitch;
2477 } 2477 }
2478 } 2478 }
2479 2479
2480 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) 2480 static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
2481 { 2481 {
2482 const int flags = info->flags; 2482 const int flags = info->flags;
2483 const Uint32 modulateR = info->r; 2483 const Uint32 modulateR = info->r;
2484 const Uint32 modulateG = info->g; 2484 const Uint32 modulateG = info->g;
2485 const Uint32 modulateB = info->b; 2485 const Uint32 modulateB = info->b;
2493 Uint32 *src = (Uint32 *)info->src; 2493 Uint32 *src = (Uint32 *)info->src;
2494 Uint32 *dst = (Uint32 *)info->dst; 2494 Uint32 *dst = (Uint32 *)info->dst;
2495 int n = info->dst_w; 2495 int n = info->dst_w;
2496 while (n--) { 2496 while (n--) {
2497 srcpixel = *src; 2497 srcpixel = *src;
2498 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 2498 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
2499 dstpixel = *dst; 2499 dstpixel = *dst;
2500 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 2500 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2501 if (flags & SDL_COPY_MODULATE_COLOR) { 2501 if (flags & SDL_COPY_MODULATE_COLOR) {
2502 srcR = (srcR * modulateR) / 255; 2502 srcR = (srcR * modulateR) / 255;
2503 srcG = (srcG * modulateG) / 255; 2503 srcG = (srcG * modulateG) / 255;
2504 srcB = (srcB * modulateB) / 255; 2504 srcB = (srcB * modulateB) / 255;
2505 } 2505 }
2536 dstR = (srcR * dstR) / 255; 2536 dstR = (srcR * dstR) / 255;
2537 dstG = (srcG * dstG) / 255; 2537 dstG = (srcG * dstG) / 255;
2538 dstB = (srcB * dstB) / 255; 2538 dstB = (srcB * dstB) / 255;
2539 break; 2539 break;
2540 } 2540 }
2541 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 2541 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
2542 *dst = dstpixel; 2542 *dst = dstpixel;
2543 ++src; 2543 ++src;
2544 ++dst; 2544 ++dst;
2545 } 2545 }
2546 info->src += info->src_pitch; 2546 info->src += info->src_pitch;
2547 info->dst += info->dst_pitch; 2547 info->dst += info->dst_pitch;
2548 } 2548 }
2549 } 2549 }
2550 2550
2551 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) 2551 static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
2552 { 2552 {
2553 const int flags = info->flags; 2553 const int flags = info->flags;
2554 const Uint32 modulateR = info->r; 2554 const Uint32 modulateR = info->r;
2555 const Uint32 modulateG = info->g; 2555 const Uint32 modulateG = info->g;
2556 const Uint32 modulateB = info->b; 2556 const Uint32 modulateB = info->b;
2585 posx -= 0x10000L; 2585 posx -= 0x10000L;
2586 } 2586 }
2587 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2587 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2588 } 2588 }
2589 srcpixel = *src; 2589 srcpixel = *src;
2590 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; 2590 srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
2591 dstpixel = *dst; 2591 dstpixel = *dst;
2592 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 2592 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
2593 if (flags & SDL_COPY_MODULATE_COLOR) { 2593 if (flags & SDL_COPY_MODULATE_COLOR) {
2594 srcR = (srcR * modulateR) / 255; 2594 srcR = (srcR * modulateR) / 255;
2595 srcG = (srcG * modulateG) / 255; 2595 srcG = (srcG * modulateG) / 255;
2596 srcB = (srcB * modulateB) / 255; 2596 srcB = (srcB * modulateB) / 255;
2597 } 2597 }
2628 dstR = (srcR * dstR) / 255; 2628 dstR = (srcR * dstR) / 255;
2629 dstG = (srcG * dstG) / 255; 2629 dstG = (srcG * dstG) / 255;
2630 dstB = (srcB * dstB) / 255; 2630 dstB = (srcB * dstB) / 255;
2631 break; 2631 break;
2632 } 2632 }
2633 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 2633 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
2634 *dst = dstpixel; 2634 *dst = dstpixel;
2635 posx += incx; 2635 posx += incx;
2636 ++dst; 2636 ++dst;
2637 } 2637 }
2638 posy += incy; 2638 posy += incy;
2639 info->dst += info->dst_pitch; 2639 info->dst += info->dst_pitch;
2640 } 2640 }
2641 } 2641 }
2642 2642
2643 static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) 2643 static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info)
2644 { 2644 {
2645 const int flags = info->flags; 2645 const int flags = info->flags;
2646 Uint32 pixel; 2646 Uint32 pixel;
2647 Uint32 R, G, B, A; 2647 Uint32 R, G, B, A;
2648 int srcy, srcx; 2648 int srcy, srcx;
2671 posx -= 0x10000L; 2671 posx -= 0x10000L;
2672 } 2672 }
2673 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2673 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2674 } 2674 }
2675 pixel = *src; 2675 pixel = *src;
2676 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; 2676 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
2677 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 2677 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
2678 *dst = pixel; 2678 *dst = pixel;
2679 posx += incx; 2679 posx += incx;
2680 ++dst; 2680 ++dst;
2681 } 2681 }
2682 posy += incy; 2682 posy += incy;
2683 info->dst += info->dst_pitch; 2683 info->dst += info->dst_pitch;
2684 } 2684 }
2685 } 2685 }
2686 2686
2687 static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info) 2687 static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info)
2688 { 2688 {
2689 const int flags = info->flags; 2689 const int flags = info->flags;
2690 Uint32 srcpixel; 2690 Uint32 srcpixel;
2691 Uint32 srcR, srcG, srcB, srcA; 2691 Uint32 srcR, srcG, srcB, srcA;
2692 Uint32 dstpixel; 2692 Uint32 dstpixel;
2696 Uint32 *src = (Uint32 *)info->src; 2696 Uint32 *src = (Uint32 *)info->src;
2697 Uint32 *dst = (Uint32 *)info->dst; 2697 Uint32 *dst = (Uint32 *)info->dst;
2698 int n = info->dst_w; 2698 int n = info->dst_w;
2699 while (n--) { 2699 while (n--) {
2700 srcpixel = *src; 2700 srcpixel = *src;
2701 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 2701 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
2702 dstpixel = *dst; 2702 dstpixel = *dst;
2703 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 2703 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
2704 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 2704 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2705 /* This goes away if we ever use premultiplied alpha */ 2705 /* This goes away if we ever use premultiplied alpha */
2706 if (srcA < 255) { 2706 if (srcA < 255) {
2741 info->src += info->src_pitch; 2741 info->src += info->src_pitch;
2742 info->dst += info->dst_pitch; 2742 info->dst += info->dst_pitch;
2743 } 2743 }
2744 } 2744 }
2745 2745
2746 static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) 2746 static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
2747 { 2747 {
2748 const int flags = info->flags; 2748 const int flags = info->flags;
2749 Uint32 srcpixel; 2749 Uint32 srcpixel;
2750 Uint32 srcR, srcG, srcB, srcA; 2750 Uint32 srcR, srcG, srcB, srcA;
2751 Uint32 dstpixel; 2751 Uint32 dstpixel;
2776 posx -= 0x10000L; 2776 posx -= 0x10000L;
2777 } 2777 }
2778 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2778 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2779 } 2779 }
2780 srcpixel = *src; 2780 srcpixel = *src;
2781 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 2781 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
2782 dstpixel = *dst; 2782 dstpixel = *dst;
2783 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 2783 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
2784 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 2784 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
2785 /* This goes away if we ever use premultiplied alpha */ 2785 /* This goes away if we ever use premultiplied alpha */
2786 if (srcA < 255) { 2786 if (srcA < 255) {
2821 posy += incy; 2821 posy += incy;
2822 info->dst += info->dst_pitch; 2822 info->dst += info->dst_pitch;
2823 } 2823 }
2824 } 2824 }
2825 2825
2826 static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info) 2826 static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info)
2827 { 2827 {
2828 const int flags = info->flags; 2828 const int flags = info->flags;
2829 const Uint32 modulateR = info->r; 2829 const Uint32 modulateR = info->r;
2830 const Uint32 modulateG = info->g; 2830 const Uint32 modulateG = info->g;
2831 const Uint32 modulateB = info->b; 2831 const Uint32 modulateB = info->b;
2837 Uint32 *src = (Uint32 *)info->src; 2837 Uint32 *src = (Uint32 *)info->src;
2838 Uint32 *dst = (Uint32 *)info->dst; 2838 Uint32 *dst = (Uint32 *)info->dst;
2839 int n = info->dst_w; 2839 int n = info->dst_w;
2840 while (n--) { 2840 while (n--) {
2841 pixel = *src; 2841 pixel = *src;
2842 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; 2842 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
2843 if (flags & SDL_COPY_MODULATE_COLOR) { 2843 if (flags & SDL_COPY_MODULATE_COLOR) {
2844 R = (R * modulateR) / 255; 2844 R = (R * modulateR) / 255;
2845 G = (G * modulateG) / 255; 2845 G = (G * modulateG) / 255;
2846 B = (B * modulateB) / 255; 2846 B = (B * modulateB) / 255;
2847 } 2847 }
2856 info->src += info->src_pitch; 2856 info->src += info->src_pitch;
2857 info->dst += info->dst_pitch; 2857 info->dst += info->dst_pitch;
2858 } 2858 }
2859 } 2859 }
2860 2860
2861 static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) 2861 static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
2862 { 2862 {
2863 const int flags = info->flags; 2863 const int flags = info->flags;
2864 const Uint32 modulateR = info->r; 2864 const Uint32 modulateR = info->r;
2865 const Uint32 modulateG = info->g; 2865 const Uint32 modulateG = info->g;
2866 const Uint32 modulateB = info->b; 2866 const Uint32 modulateB = info->b;
2893 posx -= 0x10000L; 2893 posx -= 0x10000L;
2894 } 2894 }
2895 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 2895 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
2896 } 2896 }
2897 pixel = *src; 2897 pixel = *src;
2898 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; 2898 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
2899 if (flags & SDL_COPY_MODULATE_COLOR) { 2899 if (flags & SDL_COPY_MODULATE_COLOR) {
2900 R = (R * modulateR) / 255; 2900 R = (R * modulateR) / 255;
2901 G = (G * modulateG) / 255; 2901 G = (G * modulateG) / 255;
2902 B = (B * modulateB) / 255; 2902 B = (B * modulateB) / 255;
2903 } 2903 }
2912 posy += incy; 2912 posy += incy;
2913 info->dst += info->dst_pitch; 2913 info->dst += info->dst_pitch;
2914 } 2914 }
2915 } 2915 }
2916 2916
2917 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) 2917 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
2918 { 2918 {
2919 const int flags = info->flags; 2919 const int flags = info->flags;
2920 const Uint32 modulateR = info->r; 2920 const Uint32 modulateR = info->r;
2921 const Uint32 modulateG = info->g; 2921 const Uint32 modulateG = info->g;
2922 const Uint32 modulateB = info->b; 2922 const Uint32 modulateB = info->b;
2930 Uint32 *src = (Uint32 *)info->src; 2930 Uint32 *src = (Uint32 *)info->src;
2931 Uint32 *dst = (Uint32 *)info->dst; 2931 Uint32 *dst = (Uint32 *)info->dst;
2932 int n = info->dst_w; 2932 int n = info->dst_w;
2933 while (n--) { 2933 while (n--) {
2934 srcpixel = *src; 2934 srcpixel = *src;
2935 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 2935 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
2936 dstpixel = *dst; 2936 dstpixel = *dst;
2937 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 2937 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
2938 if (flags & SDL_COPY_MODULATE_COLOR) { 2938 if (flags & SDL_COPY_MODULATE_COLOR) {
2939 srcR = (srcR * modulateR) / 255; 2939 srcR = (srcR * modulateR) / 255;
2940 srcG = (srcG * modulateG) / 255; 2940 srcG = (srcG * modulateG) / 255;
2983 info->src += info->src_pitch; 2983 info->src += info->src_pitch;
2984 info->dst += info->dst_pitch; 2984 info->dst += info->dst_pitch;
2985 } 2985 }
2986 } 2986 }
2987 2987
2988 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) 2988 static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
2989 { 2989 {
2990 const int flags = info->flags; 2990 const int flags = info->flags;
2991 const Uint32 modulateR = info->r; 2991 const Uint32 modulateR = info->r;
2992 const Uint32 modulateG = info->g; 2992 const Uint32 modulateG = info->g;
2993 const Uint32 modulateB = info->b; 2993 const Uint32 modulateB = info->b;
3022 posx -= 0x10000L; 3022 posx -= 0x10000L;
3023 } 3023 }
3024 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3024 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3025 } 3025 }
3026 srcpixel = *src; 3026 srcpixel = *src;
3027 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 3027 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3028 dstpixel = *dst; 3028 dstpixel = *dst;
3029 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 3029 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
3030 if (flags & SDL_COPY_MODULATE_COLOR) { 3030 if (flags & SDL_COPY_MODULATE_COLOR) {
3031 srcR = (srcR * modulateR) / 255; 3031 srcR = (srcR * modulateR) / 255;
3032 srcG = (srcG * modulateG) / 255; 3032 srcG = (srcG * modulateG) / 255;
3075 posy += incy; 3075 posy += incy;
3076 info->dst += info->dst_pitch; 3076 info->dst += info->dst_pitch;
3077 } 3077 }
3078 } 3078 }
3079 3079
3080 static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) 3080 static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info)
3081 { 3081 {
3082 const int flags = info->flags; 3082 const int flags = info->flags;
3083 Uint32 pixel; 3083 Uint32 pixel;
3084 Uint32 R, G, B, A; 3084 Uint32 R, G, B, A;
3085 int srcy, srcx; 3085 int srcy, srcx;
3108 posx -= 0x10000L; 3108 posx -= 0x10000L;
3109 } 3109 }
3110 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3110 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3111 } 3111 }
3112 pixel = *src; 3112 pixel = *src;
3113 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; 3113 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
3114 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 3114 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
3115 *dst = pixel; 3115 *dst = pixel;
3116 posx += incx; 3116 posx += incx;
3117 ++dst; 3117 ++dst;
3118 } 3118 }
3119 posy += incy; 3119 posy += incy;
3120 info->dst += info->dst_pitch; 3120 info->dst += info->dst_pitch;
3121 } 3121 }
3122 } 3122 }
3123 3123
3124 static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info) 3124 static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info)
3125 { 3125 {
3126 const int flags = info->flags; 3126 const int flags = info->flags;
3127 Uint32 srcpixel; 3127 Uint32 srcpixel;
3128 Uint32 srcR, srcG, srcB, srcA; 3128 Uint32 srcR, srcG, srcB, srcA;
3129 Uint32 dstpixel; 3129 Uint32 dstpixel;
3133 Uint32 *src = (Uint32 *)info->src; 3133 Uint32 *src = (Uint32 *)info->src;
3134 Uint32 *dst = (Uint32 *)info->dst; 3134 Uint32 *dst = (Uint32 *)info->dst;
3135 int n = info->dst_w; 3135 int n = info->dst_w;
3136 while (n--) { 3136 while (n--) {
3137 srcpixel = *src; 3137 srcpixel = *src;
3138 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 3138 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3139 dstpixel = *dst; 3139 dstpixel = *dst;
3140 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 3140 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
3141 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 3141 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3142 /* This goes away if we ever use premultiplied alpha */ 3142 /* This goes away if we ever use premultiplied alpha */
3143 if (srcA < 255) { 3143 if (srcA < 255) {
3178 info->src += info->src_pitch; 3178 info->src += info->src_pitch;
3179 info->dst += info->dst_pitch; 3179 info->dst += info->dst_pitch;
3180 } 3180 }
3181 } 3181 }
3182 3182
3183 static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) 3183 static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
3184 { 3184 {
3185 const int flags = info->flags; 3185 const int flags = info->flags;
3186 Uint32 srcpixel; 3186 Uint32 srcpixel;
3187 Uint32 srcR, srcG, srcB, srcA; 3187 Uint32 srcR, srcG, srcB, srcA;
3188 Uint32 dstpixel; 3188 Uint32 dstpixel;
3213 posx -= 0x10000L; 3213 posx -= 0x10000L;
3214 } 3214 }
3215 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3215 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3216 } 3216 }
3217 srcpixel = *src; 3217 srcpixel = *src;
3218 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 3218 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3219 dstpixel = *dst; 3219 dstpixel = *dst;
3220 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 3220 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
3221 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 3221 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3222 /* This goes away if we ever use premultiplied alpha */ 3222 /* This goes away if we ever use premultiplied alpha */
3223 if (srcA < 255) { 3223 if (srcA < 255) {
3258 posy += incy; 3258 posy += incy;
3259 info->dst += info->dst_pitch; 3259 info->dst += info->dst_pitch;
3260 } 3260 }
3261 } 3261 }
3262 3262
3263 static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info) 3263 static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info)
3264 { 3264 {
3265 const int flags = info->flags; 3265 const int flags = info->flags;
3266 const Uint32 modulateR = info->r; 3266 const Uint32 modulateR = info->r;
3267 const Uint32 modulateG = info->g; 3267 const Uint32 modulateG = info->g;
3268 const Uint32 modulateB = info->b; 3268 const Uint32 modulateB = info->b;
3274 Uint32 *src = (Uint32 *)info->src; 3274 Uint32 *src = (Uint32 *)info->src;
3275 Uint32 *dst = (Uint32 *)info->dst; 3275 Uint32 *dst = (Uint32 *)info->dst;
3276 int n = info->dst_w; 3276 int n = info->dst_w;
3277 while (n--) { 3277 while (n--) {
3278 pixel = *src; 3278 pixel = *src;
3279 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; 3279 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
3280 if (flags & SDL_COPY_MODULATE_COLOR) { 3280 if (flags & SDL_COPY_MODULATE_COLOR) {
3281 R = (R * modulateR) / 255; 3281 R = (R * modulateR) / 255;
3282 G = (G * modulateG) / 255; 3282 G = (G * modulateG) / 255;
3283 B = (B * modulateB) / 255; 3283 B = (B * modulateB) / 255;
3284 } 3284 }
3293 info->src += info->src_pitch; 3293 info->src += info->src_pitch;
3294 info->dst += info->dst_pitch; 3294 info->dst += info->dst_pitch;
3295 } 3295 }
3296 } 3296 }
3297 3297
3298 static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) 3298 static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
3299 { 3299 {
3300 const int flags = info->flags; 3300 const int flags = info->flags;
3301 const Uint32 modulateR = info->r; 3301 const Uint32 modulateR = info->r;
3302 const Uint32 modulateG = info->g; 3302 const Uint32 modulateG = info->g;
3303 const Uint32 modulateB = info->b; 3303 const Uint32 modulateB = info->b;
3330 posx -= 0x10000L; 3330 posx -= 0x10000L;
3331 } 3331 }
3332 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3332 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3333 } 3333 }
3334 pixel = *src; 3334 pixel = *src;
3335 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; 3335 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
3336 if (flags & SDL_COPY_MODULATE_COLOR) { 3336 if (flags & SDL_COPY_MODULATE_COLOR) {
3337 R = (R * modulateR) / 255; 3337 R = (R * modulateR) / 255;
3338 G = (G * modulateG) / 255; 3338 G = (G * modulateG) / 255;
3339 B = (B * modulateB) / 255; 3339 B = (B * modulateB) / 255;
3340 } 3340 }
3349 posy += incy; 3349 posy += incy;
3350 info->dst += info->dst_pitch; 3350 info->dst += info->dst_pitch;
3351 } 3351 }
3352 } 3352 }
3353 3353
3354 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) 3354 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
3355 { 3355 {
3356 const int flags = info->flags; 3356 const int flags = info->flags;
3357 const Uint32 modulateR = info->r; 3357 const Uint32 modulateR = info->r;
3358 const Uint32 modulateG = info->g; 3358 const Uint32 modulateG = info->g;
3359 const Uint32 modulateB = info->b; 3359 const Uint32 modulateB = info->b;
3367 Uint32 *src = (Uint32 *)info->src; 3367 Uint32 *src = (Uint32 *)info->src;
3368 Uint32 *dst = (Uint32 *)info->dst; 3368 Uint32 *dst = (Uint32 *)info->dst;
3369 int n = info->dst_w; 3369 int n = info->dst_w;
3370 while (n--) { 3370 while (n--) {
3371 srcpixel = *src; 3371 srcpixel = *src;
3372 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 3372 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3373 dstpixel = *dst; 3373 dstpixel = *dst;
3374 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 3374 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
3375 if (flags & SDL_COPY_MODULATE_COLOR) { 3375 if (flags & SDL_COPY_MODULATE_COLOR) {
3376 srcR = (srcR * modulateR) / 255; 3376 srcR = (srcR * modulateR) / 255;
3377 srcG = (srcG * modulateG) / 255; 3377 srcG = (srcG * modulateG) / 255;
3420 info->src += info->src_pitch; 3420 info->src += info->src_pitch;
3421 info->dst += info->dst_pitch; 3421 info->dst += info->dst_pitch;
3422 } 3422 }
3423 } 3423 }
3424 3424
3425 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) 3425 static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
3426 { 3426 {
3427 const int flags = info->flags; 3427 const int flags = info->flags;
3428 const Uint32 modulateR = info->r; 3428 const Uint32 modulateR = info->r;
3429 const Uint32 modulateG = info->g; 3429 const Uint32 modulateG = info->g;
3430 const Uint32 modulateB = info->b; 3430 const Uint32 modulateB = info->b;
3459 posx -= 0x10000L; 3459 posx -= 0x10000L;
3460 } 3460 }
3461 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3461 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3462 } 3462 }
3463 srcpixel = *src; 3463 srcpixel = *src;
3464 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 3464 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3465 dstpixel = *dst; 3465 dstpixel = *dst;
3466 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 3466 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
3467 if (flags & SDL_COPY_MODULATE_COLOR) { 3467 if (flags & SDL_COPY_MODULATE_COLOR) {
3468 srcR = (srcR * modulateR) / 255; 3468 srcR = (srcR * modulateR) / 255;
3469 srcG = (srcG * modulateG) / 255; 3469 srcG = (srcG * modulateG) / 255;
3512 posy += incy; 3512 posy += incy;
3513 info->dst += info->dst_pitch; 3513 info->dst += info->dst_pitch;
3514 } 3514 }
3515 } 3515 }
3516 3516
3517 static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) 3517 static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info)
3518 { 3518 {
3519 const int flags = info->flags; 3519 const int flags = info->flags;
3520 Uint32 pixel;
3521 Uint32 R, G, B, A;
3522 int srcy, srcx; 3520 int srcy, srcx;
3523 int posy, posx; 3521 int posy, posx;
3524 int incy, incx; 3522 int incy, incx;
3525 3523
3526 srcy = 0; 3524 srcy = 0;
3544 ++srcx; 3542 ++srcx;
3545 posx -= 0x10000L; 3543 posx -= 0x10000L;
3546 } 3544 }
3547 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3545 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3548 } 3546 }
3549 pixel = *src; 3547 *dst = *src;
3550 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
3551 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
3552 *dst = pixel;
3553 posx += incx; 3548 posx += incx;
3554 ++dst; 3549 ++dst;
3555 } 3550 }
3556 posy += incy; 3551 posy += incy;
3557 info->dst += info->dst_pitch; 3552 info->dst += info->dst_pitch;
3558 } 3553 }
3559 } 3554 }
3560 3555
3561 static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info) 3556 static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info)
3562 { 3557 {
3563 const int flags = info->flags; 3558 const int flags = info->flags;
3564 Uint32 srcpixel; 3559 Uint32 srcpixel;
3565 Uint32 srcR, srcG, srcB, srcA; 3560 Uint32 srcR, srcG, srcB, srcA;
3566 Uint32 dstpixel; 3561 Uint32 dstpixel;
3570 Uint32 *src = (Uint32 *)info->src; 3565 Uint32 *src = (Uint32 *)info->src;
3571 Uint32 *dst = (Uint32 *)info->dst; 3566 Uint32 *dst = (Uint32 *)info->dst;
3572 int n = info->dst_w; 3567 int n = info->dst_w;
3573 while (n--) { 3568 while (n--) {
3574 srcpixel = *src; 3569 srcpixel = *src;
3575 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 3570 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3576 dstpixel = *dst; 3571 dstpixel = *dst;
3577 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 3572 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
3578 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 3573 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3579 /* This goes away if we ever use premultiplied alpha */ 3574 /* This goes away if we ever use premultiplied alpha */
3580 if (srcA < 255) { 3575 if (srcA < 255) {
3581 srcR = (srcR * srcA) / 255; 3576 srcR = (srcR * srcA) / 255;
3582 srcG = (srcG * srcA) / 255; 3577 srcG = (srcG * srcA) / 255;
3605 dstR = (srcR * dstR) / 255; 3600 dstR = (srcR * dstR) / 255;
3606 dstG = (srcG * dstG) / 255; 3601 dstG = (srcG * dstG) / 255;
3607 dstB = (srcB * dstB) / 255; 3602 dstB = (srcB * dstB) / 255;
3608 break; 3603 break;
3609 } 3604 }
3610 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 3605 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
3611 *dst = dstpixel; 3606 *dst = dstpixel;
3612 ++src; 3607 ++src;
3613 ++dst; 3608 ++dst;
3614 } 3609 }
3615 info->src += info->src_pitch; 3610 info->src += info->src_pitch;
3616 info->dst += info->dst_pitch; 3611 info->dst += info->dst_pitch;
3617 } 3612 }
3618 } 3613 }
3619 3614
3620 static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) 3615 static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
3621 { 3616 {
3622 const int flags = info->flags; 3617 const int flags = info->flags;
3623 Uint32 srcpixel; 3618 Uint32 srcpixel;
3624 Uint32 srcR, srcG, srcB, srcA; 3619 Uint32 srcR, srcG, srcB, srcA;
3625 Uint32 dstpixel; 3620 Uint32 dstpixel;
3650 posx -= 0x10000L; 3645 posx -= 0x10000L;
3651 } 3646 }
3652 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3647 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3653 } 3648 }
3654 srcpixel = *src; 3649 srcpixel = *src;
3655 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 3650 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3656 dstpixel = *dst; 3651 dstpixel = *dst;
3657 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 3652 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
3658 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 3653 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
3659 /* This goes away if we ever use premultiplied alpha */ 3654 /* This goes away if we ever use premultiplied alpha */
3660 if (srcA < 255) { 3655 if (srcA < 255) {
3661 srcR = (srcR * srcA) / 255; 3656 srcR = (srcR * srcA) / 255;
3662 srcG = (srcG * srcA) / 255; 3657 srcG = (srcG * srcA) / 255;
3685 dstR = (srcR * dstR) / 255; 3680 dstR = (srcR * dstR) / 255;
3686 dstG = (srcG * dstG) / 255; 3681 dstG = (srcG * dstG) / 255;
3687 dstB = (srcB * dstB) / 255; 3682 dstB = (srcB * dstB) / 255;
3688 break; 3683 break;
3689 } 3684 }
3690 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 3685 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
3691 *dst = dstpixel; 3686 *dst = dstpixel;
3692 posx += incx; 3687 posx += incx;
3693 ++dst; 3688 ++dst;
3694 } 3689 }
3695 posy += incy; 3690 posy += incy;
3696 info->dst += info->dst_pitch; 3691 info->dst += info->dst_pitch;
3697 } 3692 }
3698 } 3693 }
3699 3694
3700 static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info) 3695 static void SDL_Blit_ARGB8888_ARGB8888_Modulate(SDL_BlitInfo *info)
3701 { 3696 {
3702 const int flags = info->flags; 3697 const int flags = info->flags;
3703 const Uint32 modulateR = info->r; 3698 const Uint32 modulateR = info->r;
3704 const Uint32 modulateG = info->g; 3699 const Uint32 modulateG = info->g;
3705 const Uint32 modulateB = info->b; 3700 const Uint32 modulateB = info->b;
3711 Uint32 *src = (Uint32 *)info->src; 3706 Uint32 *src = (Uint32 *)info->src;
3712 Uint32 *dst = (Uint32 *)info->dst; 3707 Uint32 *dst = (Uint32 *)info->dst;
3713 int n = info->dst_w; 3708 int n = info->dst_w;
3714 while (n--) { 3709 while (n--) {
3715 pixel = *src; 3710 pixel = *src;
3716 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; 3711 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
3717 if (flags & SDL_COPY_MODULATE_COLOR) { 3712 if (flags & SDL_COPY_MODULATE_COLOR) {
3718 R = (R * modulateR) / 255; 3713 R = (R * modulateR) / 255;
3719 G = (G * modulateG) / 255; 3714 G = (G * modulateG) / 255;
3720 B = (B * modulateB) / 255; 3715 B = (B * modulateB) / 255;
3721 } 3716 }
3722 if (flags & SDL_COPY_MODULATE_ALPHA) { 3717 if (flags & SDL_COPY_MODULATE_ALPHA) {
3723 A = (A * modulateA) / 255; 3718 A = (A * modulateA) / 255;
3724 } 3719 }
3725 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 3720 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
3726 *dst = pixel; 3721 *dst = pixel;
3727 ++src; 3722 ++src;
3728 ++dst; 3723 ++dst;
3729 } 3724 }
3730 info->src += info->src_pitch; 3725 info->src += info->src_pitch;
3731 info->dst += info->dst_pitch; 3726 info->dst += info->dst_pitch;
3732 } 3727 }
3733 } 3728 }
3734 3729
3735 static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) 3730 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
3736 { 3731 {
3737 const int flags = info->flags; 3732 const int flags = info->flags;
3738 const Uint32 modulateR = info->r; 3733 const Uint32 modulateR = info->r;
3739 const Uint32 modulateG = info->g; 3734 const Uint32 modulateG = info->g;
3740 const Uint32 modulateB = info->b; 3735 const Uint32 modulateB = info->b;
3767 posx -= 0x10000L; 3762 posx -= 0x10000L;
3768 } 3763 }
3769 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3764 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3770 } 3765 }
3771 pixel = *src; 3766 pixel = *src;
3772 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; 3767 A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
3773 if (flags & SDL_COPY_MODULATE_COLOR) { 3768 if (flags & SDL_COPY_MODULATE_COLOR) {
3774 R = (R * modulateR) / 255; 3769 R = (R * modulateR) / 255;
3775 G = (G * modulateG) / 255; 3770 G = (G * modulateG) / 255;
3776 B = (B * modulateB) / 255; 3771 B = (B * modulateB) / 255;
3777 } 3772 }
3778 if (flags & SDL_COPY_MODULATE_ALPHA) { 3773 if (flags & SDL_COPY_MODULATE_ALPHA) {
3779 A = (A * modulateA) / 255; 3774 A = (A * modulateA) / 255;
3780 } 3775 }
3781 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 3776 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
3782 *dst = pixel; 3777 *dst = pixel;
3783 posx += incx; 3778 posx += incx;
3784 ++dst; 3779 ++dst;
3785 } 3780 }
3786 posy += incy; 3781 posy += incy;
3787 info->dst += info->dst_pitch; 3782 info->dst += info->dst_pitch;
3788 } 3783 }
3789 } 3784 }
3790 3785
3791 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) 3786 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
3792 { 3787 {
3793 const int flags = info->flags; 3788 const int flags = info->flags;
3794 const Uint32 modulateR = info->r; 3789 const Uint32 modulateR = info->r;
3795 const Uint32 modulateG = info->g; 3790 const Uint32 modulateG = info->g;
3796 const Uint32 modulateB = info->b; 3791 const Uint32 modulateB = info->b;
3804 Uint32 *src = (Uint32 *)info->src; 3799 Uint32 *src = (Uint32 *)info->src;
3805 Uint32 *dst = (Uint32 *)info->dst; 3800 Uint32 *dst = (Uint32 *)info->dst;
3806 int n = info->dst_w; 3801 int n = info->dst_w;
3807 while (n--) { 3802 while (n--) {
3808 srcpixel = *src; 3803 srcpixel = *src;
3809 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 3804 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3810 dstpixel = *dst; 3805 dstpixel = *dst;
3811 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 3806 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
3812 if (flags & SDL_COPY_MODULATE_COLOR) { 3807 if (flags & SDL_COPY_MODULATE_COLOR) {
3813 srcR = (srcR * modulateR) / 255; 3808 srcR = (srcR * modulateR) / 255;
3814 srcG = (srcG * modulateG) / 255; 3809 srcG = (srcG * modulateG) / 255;
3815 srcB = (srcB * modulateB) / 255; 3810 srcB = (srcB * modulateB) / 255;
3816 } 3811 }
3847 dstR = (srcR * dstR) / 255; 3842 dstR = (srcR * dstR) / 255;
3848 dstG = (srcG * dstG) / 255; 3843 dstG = (srcG * dstG) / 255;
3849 dstB = (srcB * dstB) / 255; 3844 dstB = (srcB * dstB) / 255;
3850 break; 3845 break;
3851 } 3846 }
3852 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 3847 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
3853 *dst = dstpixel; 3848 *dst = dstpixel;
3854 ++src; 3849 ++src;
3855 ++dst; 3850 ++dst;
3856 } 3851 }
3857 info->src += info->src_pitch; 3852 info->src += info->src_pitch;
3858 info->dst += info->dst_pitch; 3853 info->dst += info->dst_pitch;
3859 } 3854 }
3860 } 3855 }
3861 3856
3862 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) 3857 static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
3863 { 3858 {
3864 const int flags = info->flags; 3859 const int flags = info->flags;
3865 const Uint32 modulateR = info->r; 3860 const Uint32 modulateR = info->r;
3866 const Uint32 modulateG = info->g; 3861 const Uint32 modulateG = info->g;
3867 const Uint32 modulateB = info->b; 3862 const Uint32 modulateB = info->b;
3896 posx -= 0x10000L; 3891 posx -= 0x10000L;
3897 } 3892 }
3898 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3893 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3899 } 3894 }
3900 srcpixel = *src; 3895 srcpixel = *src;
3901 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 3896 srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
3902 dstpixel = *dst; 3897 dstpixel = *dst;
3903 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 3898 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
3904 if (flags & SDL_COPY_MODULATE_COLOR) { 3899 if (flags & SDL_COPY_MODULATE_COLOR) {
3905 srcR = (srcR * modulateR) / 255; 3900 srcR = (srcR * modulateR) / 255;
3906 srcG = (srcG * modulateG) / 255; 3901 srcG = (srcG * modulateG) / 255;
3907 srcB = (srcB * modulateB) / 255; 3902 srcB = (srcB * modulateB) / 255;
3908 } 3903 }
3939 dstR = (srcR * dstR) / 255; 3934 dstR = (srcR * dstR) / 255;
3940 dstG = (srcG * dstG) / 255; 3935 dstG = (srcG * dstG) / 255;
3941 dstB = (srcB * dstB) / 255; 3936 dstB = (srcB * dstB) / 255;
3942 break; 3937 break;
3943 } 3938 }
3944 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 3939 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
3945 *dst = dstpixel; 3940 *dst = dstpixel;
3946 posx += incx; 3941 posx += incx;
3947 ++dst; 3942 ++dst;
3948 } 3943 }
3949 posy += incy; 3944 posy += incy;
3950 info->dst += info->dst_pitch; 3945 info->dst += info->dst_pitch;
3951 } 3946 }
3952 } 3947 }
3953 3948
3954 static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) 3949 static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info)
3955 { 3950 {
3956 const int flags = info->flags; 3951 const int flags = info->flags;
3957 Uint32 pixel; 3952 Uint32 pixel;
3958 Uint32 R, G, B, A; 3953 Uint32 R, G, B, A;
3959 int srcy, srcx; 3954 int srcy, srcx;
3982 posx -= 0x10000L; 3977 posx -= 0x10000L;
3983 } 3978 }
3984 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 3979 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
3985 } 3980 }
3986 pixel = *src; 3981 pixel = *src;
3987 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; 3982 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
3988 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 3983 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
3989 *dst = pixel; 3984 *dst = pixel;
3990 posx += incx; 3985 posx += incx;
3991 ++dst; 3986 ++dst;
3992 } 3987 }
3993 posy += incy; 3988 posy += incy;
3994 info->dst += info->dst_pitch; 3989 info->dst += info->dst_pitch;
3995 } 3990 }
3996 } 3991 }
3997 3992
3998 static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info) 3993 static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info)
3999 { 3994 {
4000 const int flags = info->flags; 3995 const int flags = info->flags;
4001 Uint32 srcpixel; 3996 Uint32 srcpixel;
4002 Uint32 srcR, srcG, srcB, srcA; 3997 Uint32 srcR, srcG, srcB, srcA;
4003 Uint32 dstpixel; 3998 Uint32 dstpixel;
4007 Uint32 *src = (Uint32 *)info->src; 4002 Uint32 *src = (Uint32 *)info->src;
4008 Uint32 *dst = (Uint32 *)info->dst; 4003 Uint32 *dst = (Uint32 *)info->dst;
4009 int n = info->dst_w; 4004 int n = info->dst_w;
4010 while (n--) { 4005 while (n--) {
4011 srcpixel = *src; 4006 srcpixel = *src;
4012 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 4007 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4013 dstpixel = *dst; 4008 dstpixel = *dst;
4014 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 4009 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
4015 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 4010 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4016 /* This goes away if we ever use premultiplied alpha */ 4011 /* This goes away if we ever use premultiplied alpha */
4017 if (srcA < 255) { 4012 if (srcA < 255) {
4018 srcR = (srcR * srcA) / 255; 4013 srcR = (srcR * srcA) / 255;
4019 srcG = (srcG * srcA) / 255; 4014 srcG = (srcG * srcA) / 255;
4042 dstR = (srcR * dstR) / 255; 4037 dstR = (srcR * dstR) / 255;
4043 dstG = (srcG * dstG) / 255; 4038 dstG = (srcG * dstG) / 255;
4044 dstB = (srcB * dstB) / 255; 4039 dstB = (srcB * dstB) / 255;
4045 break; 4040 break;
4046 } 4041 }
4047 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 4042 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
4048 *dst = dstpixel; 4043 *dst = dstpixel;
4049 ++src; 4044 ++src;
4050 ++dst; 4045 ++dst;
4051 } 4046 }
4052 info->src += info->src_pitch; 4047 info->src += info->src_pitch;
4053 info->dst += info->dst_pitch; 4048 info->dst += info->dst_pitch;
4054 } 4049 }
4055 } 4050 }
4056 4051
4057 static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) 4052 static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
4058 { 4053 {
4059 const int flags = info->flags; 4054 const int flags = info->flags;
4060 Uint32 srcpixel; 4055 Uint32 srcpixel;
4061 Uint32 srcR, srcG, srcB, srcA; 4056 Uint32 srcR, srcG, srcB, srcA;
4062 Uint32 dstpixel; 4057 Uint32 dstpixel;
4087 posx -= 0x10000L; 4082 posx -= 0x10000L;
4088 } 4083 }
4089 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4084 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4090 } 4085 }
4091 srcpixel = *src; 4086 srcpixel = *src;
4092 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 4087 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4093 dstpixel = *dst; 4088 dstpixel = *dst;
4094 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 4089 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
4095 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 4090 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4096 /* This goes away if we ever use premultiplied alpha */ 4091 /* This goes away if we ever use premultiplied alpha */
4097 if (srcA < 255) { 4092 if (srcA < 255) {
4098 srcR = (srcR * srcA) / 255; 4093 srcR = (srcR * srcA) / 255;
4099 srcG = (srcG * srcA) / 255; 4094 srcG = (srcG * srcA) / 255;
4122 dstR = (srcR * dstR) / 255; 4117 dstR = (srcR * dstR) / 255;
4123 dstG = (srcG * dstG) / 255; 4118 dstG = (srcG * dstG) / 255;
4124 dstB = (srcB * dstB) / 255; 4119 dstB = (srcB * dstB) / 255;
4125 break; 4120 break;
4126 } 4121 }
4127 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 4122 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
4128 *dst = dstpixel; 4123 *dst = dstpixel;
4129 posx += incx; 4124 posx += incx;
4130 ++dst; 4125 ++dst;
4131 } 4126 }
4132 posy += incy; 4127 posy += incy;
4133 info->dst += info->dst_pitch; 4128 info->dst += info->dst_pitch;
4134 } 4129 }
4135 } 4130 }
4136 4131
4137 static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info) 4132 static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info)
4138 { 4133 {
4139 const int flags = info->flags; 4134 const int flags = info->flags;
4140 const Uint32 modulateR = info->r; 4135 const Uint32 modulateR = info->r;
4141 const Uint32 modulateG = info->g; 4136 const Uint32 modulateG = info->g;
4142 const Uint32 modulateB = info->b; 4137 const Uint32 modulateB = info->b;
4148 Uint32 *src = (Uint32 *)info->src; 4143 Uint32 *src = (Uint32 *)info->src;
4149 Uint32 *dst = (Uint32 *)info->dst; 4144 Uint32 *dst = (Uint32 *)info->dst;
4150 int n = info->dst_w; 4145 int n = info->dst_w;
4151 while (n--) { 4146 while (n--) {
4152 pixel = *src; 4147 pixel = *src;
4153 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; 4148 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4154 if (flags & SDL_COPY_MODULATE_COLOR) { 4149 if (flags & SDL_COPY_MODULATE_COLOR) {
4155 R = (R * modulateR) / 255; 4150 R = (R * modulateR) / 255;
4156 G = (G * modulateG) / 255; 4151 G = (G * modulateG) / 255;
4157 B = (B * modulateB) / 255; 4152 B = (B * modulateB) / 255;
4158 } 4153 }
4159 if (flags & SDL_COPY_MODULATE_ALPHA) { 4154 if (flags & SDL_COPY_MODULATE_ALPHA) {
4160 A = (A * modulateA) / 255; 4155 A = (A * modulateA) / 255;
4161 } 4156 }
4162 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 4157 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
4163 *dst = pixel; 4158 *dst = pixel;
4164 ++src; 4159 ++src;
4165 ++dst; 4160 ++dst;
4166 } 4161 }
4167 info->src += info->src_pitch; 4162 info->src += info->src_pitch;
4168 info->dst += info->dst_pitch; 4163 info->dst += info->dst_pitch;
4169 } 4164 }
4170 } 4165 }
4171 4166
4172 static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) 4167 static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
4173 { 4168 {
4174 const int flags = info->flags; 4169 const int flags = info->flags;
4175 const Uint32 modulateR = info->r; 4170 const Uint32 modulateR = info->r;
4176 const Uint32 modulateG = info->g; 4171 const Uint32 modulateG = info->g;
4177 const Uint32 modulateB = info->b; 4172 const Uint32 modulateB = info->b;
4204 posx -= 0x10000L; 4199 posx -= 0x10000L;
4205 } 4200 }
4206 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4201 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4207 } 4202 }
4208 pixel = *src; 4203 pixel = *src;
4209 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; 4204 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4210 if (flags & SDL_COPY_MODULATE_COLOR) { 4205 if (flags & SDL_COPY_MODULATE_COLOR) {
4211 R = (R * modulateR) / 255; 4206 R = (R * modulateR) / 255;
4212 G = (G * modulateG) / 255; 4207 G = (G * modulateG) / 255;
4213 B = (B * modulateB) / 255; 4208 B = (B * modulateB) / 255;
4214 } 4209 }
4215 if (flags & SDL_COPY_MODULATE_ALPHA) { 4210 if (flags & SDL_COPY_MODULATE_ALPHA) {
4216 A = (A * modulateA) / 255; 4211 A = (A * modulateA) / 255;
4217 } 4212 }
4218 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 4213 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
4219 *dst = pixel; 4214 *dst = pixel;
4220 posx += incx; 4215 posx += incx;
4221 ++dst; 4216 ++dst;
4222 } 4217 }
4223 posy += incy; 4218 posy += incy;
4224 info->dst += info->dst_pitch; 4219 info->dst += info->dst_pitch;
4225 } 4220 }
4226 } 4221 }
4227 4222
4228 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) 4223 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
4229 { 4224 {
4230 const int flags = info->flags; 4225 const int flags = info->flags;
4231 const Uint32 modulateR = info->r; 4226 const Uint32 modulateR = info->r;
4232 const Uint32 modulateG = info->g; 4227 const Uint32 modulateG = info->g;
4233 const Uint32 modulateB = info->b; 4228 const Uint32 modulateB = info->b;
4241 Uint32 *src = (Uint32 *)info->src; 4236 Uint32 *src = (Uint32 *)info->src;
4242 Uint32 *dst = (Uint32 *)info->dst; 4237 Uint32 *dst = (Uint32 *)info->dst;
4243 int n = info->dst_w; 4238 int n = info->dst_w;
4244 while (n--) { 4239 while (n--) {
4245 srcpixel = *src; 4240 srcpixel = *src;
4246 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 4241 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4247 dstpixel = *dst; 4242 dstpixel = *dst;
4248 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 4243 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
4249 if (flags & SDL_COPY_MODULATE_COLOR) { 4244 if (flags & SDL_COPY_MODULATE_COLOR) {
4250 srcR = (srcR * modulateR) / 255; 4245 srcR = (srcR * modulateR) / 255;
4251 srcG = (srcG * modulateG) / 255; 4246 srcG = (srcG * modulateG) / 255;
4252 srcB = (srcB * modulateB) / 255; 4247 srcB = (srcB * modulateB) / 255;
4253 } 4248 }
4284 dstR = (srcR * dstR) / 255; 4279 dstR = (srcR * dstR) / 255;
4285 dstG = (srcG * dstG) / 255; 4280 dstG = (srcG * dstG) / 255;
4286 dstB = (srcB * dstB) / 255; 4281 dstB = (srcB * dstB) / 255;
4287 break; 4282 break;
4288 } 4283 }
4289 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 4284 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
4290 *dst = dstpixel; 4285 *dst = dstpixel;
4291 ++src; 4286 ++src;
4292 ++dst; 4287 ++dst;
4293 } 4288 }
4294 info->src += info->src_pitch; 4289 info->src += info->src_pitch;
4295 info->dst += info->dst_pitch; 4290 info->dst += info->dst_pitch;
4296 } 4291 }
4297 } 4292 }
4298 4293
4299 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) 4294 static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
4300 { 4295 {
4301 const int flags = info->flags; 4296 const int flags = info->flags;
4302 const Uint32 modulateR = info->r; 4297 const Uint32 modulateR = info->r;
4303 const Uint32 modulateG = info->g; 4298 const Uint32 modulateG = info->g;
4304 const Uint32 modulateB = info->b; 4299 const Uint32 modulateB = info->b;
4333 posx -= 0x10000L; 4328 posx -= 0x10000L;
4334 } 4329 }
4335 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4330 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4336 } 4331 }
4337 srcpixel = *src; 4332 srcpixel = *src;
4338 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; 4333 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4339 dstpixel = *dst; 4334 dstpixel = *dst;
4340 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 4335 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
4341 if (flags & SDL_COPY_MODULATE_COLOR) { 4336 if (flags & SDL_COPY_MODULATE_COLOR) {
4342 srcR = (srcR * modulateR) / 255; 4337 srcR = (srcR * modulateR) / 255;
4343 srcG = (srcG * modulateG) / 255; 4338 srcG = (srcG * modulateG) / 255;
4344 srcB = (srcB * modulateB) / 255; 4339 srcB = (srcB * modulateB) / 255;
4345 } 4340 }
4376 dstR = (srcR * dstR) / 255; 4371 dstR = (srcR * dstR) / 255;
4377 dstG = (srcG * dstG) / 255; 4372 dstG = (srcG * dstG) / 255;
4378 dstB = (srcB * dstB) / 255; 4373 dstB = (srcB * dstB) / 255;
4379 break; 4374 break;
4380 } 4375 }
4381 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 4376 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
4382 *dst = dstpixel; 4377 *dst = dstpixel;
4383 posx += incx; 4378 posx += incx;
4384 ++dst; 4379 ++dst;
4385 } 4380 }
4386 posy += incy; 4381 posy += incy;
4387 info->dst += info->dst_pitch; 4382 info->dst += info->dst_pitch;
4388 } 4383 }
4389 } 4384 }
4390 4385
4391 static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) 4386 static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info)
4392 { 4387 {
4393 const int flags = info->flags; 4388 const int flags = info->flags;
4394 Uint32 pixel; 4389 Uint32 pixel;
4395 Uint32 R, G, B, A; 4390 Uint32 R, G, B, A;
4396 int srcy, srcx; 4391 int srcy, srcx;
4419 posx -= 0x10000L; 4414 posx -= 0x10000L;
4420 } 4415 }
4421 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4416 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4422 } 4417 }
4423 pixel = *src; 4418 pixel = *src;
4424 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; 4419 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4425 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 4420 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
4426 *dst = pixel; 4421 *dst = pixel;
4427 posx += incx; 4422 posx += incx;
4428 ++dst; 4423 ++dst;
4429 } 4424 }
4430 posy += incy; 4425 posy += incy;
4431 info->dst += info->dst_pitch; 4426 info->dst += info->dst_pitch;
4432 } 4427 }
4433 } 4428 }
4434 4429
4435 static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info) 4430 static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info)
4436 { 4431 {
4437 const int flags = info->flags; 4432 const int flags = info->flags;
4438 Uint32 srcpixel; 4433 Uint32 srcpixel;
4439 Uint32 srcR, srcG, srcB, srcA; 4434 Uint32 srcR, srcG, srcB, srcA;
4440 Uint32 dstpixel; 4435 Uint32 dstpixel;
4444 Uint32 *src = (Uint32 *)info->src; 4439 Uint32 *src = (Uint32 *)info->src;
4445 Uint32 *dst = (Uint32 *)info->dst; 4440 Uint32 *dst = (Uint32 *)info->dst;
4446 int n = info->dst_w; 4441 int n = info->dst_w;
4447 while (n--) { 4442 while (n--) {
4448 srcpixel = *src; 4443 srcpixel = *src;
4449 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 4444 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4450 dstpixel = *dst; 4445 dstpixel = *dst;
4451 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 4446 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
4452 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 4447 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4453 /* This goes away if we ever use premultiplied alpha */ 4448 /* This goes away if we ever use premultiplied alpha */
4454 if (srcA < 255) { 4449 if (srcA < 255) {
4455 srcR = (srcR * srcA) / 255; 4450 srcR = (srcR * srcA) / 255;
4456 srcG = (srcG * srcA) / 255; 4451 srcG = (srcG * srcA) / 255;
4479 dstR = (srcR * dstR) / 255; 4474 dstR = (srcR * dstR) / 255;
4480 dstG = (srcG * dstG) / 255; 4475 dstG = (srcG * dstG) / 255;
4481 dstB = (srcB * dstB) / 255; 4476 dstB = (srcB * dstB) / 255;
4482 break; 4477 break;
4483 } 4478 }
4484 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 4479 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
4485 *dst = dstpixel; 4480 *dst = dstpixel;
4486 ++src; 4481 ++src;
4487 ++dst; 4482 ++dst;
4488 } 4483 }
4489 info->src += info->src_pitch; 4484 info->src += info->src_pitch;
4490 info->dst += info->dst_pitch; 4485 info->dst += info->dst_pitch;
4491 } 4486 }
4492 } 4487 }
4493 4488
4494 static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) 4489 static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
4495 { 4490 {
4496 const int flags = info->flags; 4491 const int flags = info->flags;
4497 Uint32 srcpixel; 4492 Uint32 srcpixel;
4498 Uint32 srcR, srcG, srcB, srcA; 4493 Uint32 srcR, srcG, srcB, srcA;
4499 Uint32 dstpixel; 4494 Uint32 dstpixel;
4524 posx -= 0x10000L; 4519 posx -= 0x10000L;
4525 } 4520 }
4526 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4521 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4527 } 4522 }
4528 srcpixel = *src; 4523 srcpixel = *src;
4529 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 4524 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4530 dstpixel = *dst; 4525 dstpixel = *dst;
4531 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 4526 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
4532 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 4527 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4533 /* This goes away if we ever use premultiplied alpha */ 4528 /* This goes away if we ever use premultiplied alpha */
4534 if (srcA < 255) { 4529 if (srcA < 255) {
4535 srcR = (srcR * srcA) / 255; 4530 srcR = (srcR * srcA) / 255;
4536 srcG = (srcG * srcA) / 255; 4531 srcG = (srcG * srcA) / 255;
4559 dstR = (srcR * dstR) / 255; 4554 dstR = (srcR * dstR) / 255;
4560 dstG = (srcG * dstG) / 255; 4555 dstG = (srcG * dstG) / 255;
4561 dstB = (srcB * dstB) / 255; 4556 dstB = (srcB * dstB) / 255;
4562 break; 4557 break;
4563 } 4558 }
4564 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 4559 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
4565 *dst = dstpixel; 4560 *dst = dstpixel;
4566 posx += incx; 4561 posx += incx;
4567 ++dst; 4562 ++dst;
4568 } 4563 }
4569 posy += incy; 4564 posy += incy;
4570 info->dst += info->dst_pitch; 4565 info->dst += info->dst_pitch;
4571 } 4566 }
4572 } 4567 }
4573 4568
4574 static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info) 4569 static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info)
4575 { 4570 {
4576 const int flags = info->flags; 4571 const int flags = info->flags;
4577 const Uint32 modulateR = info->r; 4572 const Uint32 modulateR = info->r;
4578 const Uint32 modulateG = info->g; 4573 const Uint32 modulateG = info->g;
4579 const Uint32 modulateB = info->b; 4574 const Uint32 modulateB = info->b;
4585 Uint32 *src = (Uint32 *)info->src; 4580 Uint32 *src = (Uint32 *)info->src;
4586 Uint32 *dst = (Uint32 *)info->dst; 4581 Uint32 *dst = (Uint32 *)info->dst;
4587 int n = info->dst_w; 4582 int n = info->dst_w;
4588 while (n--) { 4583 while (n--) {
4589 pixel = *src; 4584 pixel = *src;
4590 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; 4585 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4591 if (flags & SDL_COPY_MODULATE_COLOR) { 4586 if (flags & SDL_COPY_MODULATE_COLOR) {
4592 R = (R * modulateR) / 255; 4587 R = (R * modulateR) / 255;
4593 G = (G * modulateG) / 255; 4588 G = (G * modulateG) / 255;
4594 B = (B * modulateB) / 255; 4589 B = (B * modulateB) / 255;
4595 } 4590 }
4596 if (flags & SDL_COPY_MODULATE_ALPHA) { 4591 if (flags & SDL_COPY_MODULATE_ALPHA) {
4597 A = (A * modulateA) / 255; 4592 A = (A * modulateA) / 255;
4598 } 4593 }
4599 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 4594 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
4600 *dst = pixel; 4595 *dst = pixel;
4601 ++src; 4596 ++src;
4602 ++dst; 4597 ++dst;
4603 } 4598 }
4604 info->src += info->src_pitch; 4599 info->src += info->src_pitch;
4605 info->dst += info->dst_pitch; 4600 info->dst += info->dst_pitch;
4606 } 4601 }
4607 } 4602 }
4608 4603
4609 static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) 4604 static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
4610 { 4605 {
4611 const int flags = info->flags; 4606 const int flags = info->flags;
4612 const Uint32 modulateR = info->r; 4607 const Uint32 modulateR = info->r;
4613 const Uint32 modulateG = info->g; 4608 const Uint32 modulateG = info->g;
4614 const Uint32 modulateB = info->b; 4609 const Uint32 modulateB = info->b;
4641 posx -= 0x10000L; 4636 posx -= 0x10000L;
4642 } 4637 }
4643 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4638 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4644 } 4639 }
4645 pixel = *src; 4640 pixel = *src;
4646 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; 4641 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4647 if (flags & SDL_COPY_MODULATE_COLOR) { 4642 if (flags & SDL_COPY_MODULATE_COLOR) {
4648 R = (R * modulateR) / 255; 4643 R = (R * modulateR) / 255;
4649 G = (G * modulateG) / 255; 4644 G = (G * modulateG) / 255;
4650 B = (B * modulateB) / 255; 4645 B = (B * modulateB) / 255;
4651 } 4646 }
4652 if (flags & SDL_COPY_MODULATE_ALPHA) { 4647 if (flags & SDL_COPY_MODULATE_ALPHA) {
4653 A = (A * modulateA) / 255; 4648 A = (A * modulateA) / 255;
4654 } 4649 }
4655 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B; 4650 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
4656 *dst = pixel; 4651 *dst = pixel;
4657 posx += incx; 4652 posx += incx;
4658 ++dst; 4653 ++dst;
4659 } 4654 }
4660 posy += incy; 4655 posy += incy;
4661 info->dst += info->dst_pitch; 4656 info->dst += info->dst_pitch;
4662 } 4657 }
4663 } 4658 }
4664 4659
4665 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info) 4660 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
4666 { 4661 {
4667 const int flags = info->flags; 4662 const int flags = info->flags;
4668 const Uint32 modulateR = info->r; 4663 const Uint32 modulateR = info->r;
4669 const Uint32 modulateG = info->g; 4664 const Uint32 modulateG = info->g;
4670 const Uint32 modulateB = info->b; 4665 const Uint32 modulateB = info->b;
4678 Uint32 *src = (Uint32 *)info->src; 4673 Uint32 *src = (Uint32 *)info->src;
4679 Uint32 *dst = (Uint32 *)info->dst; 4674 Uint32 *dst = (Uint32 *)info->dst;
4680 int n = info->dst_w; 4675 int n = info->dst_w;
4681 while (n--) { 4676 while (n--) {
4682 srcpixel = *src; 4677 srcpixel = *src;
4683 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 4678 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4684 dstpixel = *dst; 4679 dstpixel = *dst;
4685 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 4680 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
4686 if (flags & SDL_COPY_MODULATE_COLOR) { 4681 if (flags & SDL_COPY_MODULATE_COLOR) {
4687 srcR = (srcR * modulateR) / 255; 4682 srcR = (srcR * modulateR) / 255;
4688 srcG = (srcG * modulateG) / 255; 4683 srcG = (srcG * modulateG) / 255;
4689 srcB = (srcB * modulateB) / 255; 4684 srcB = (srcB * modulateB) / 255;
4690 } 4685 }
4721 dstR = (srcR * dstR) / 255; 4716 dstR = (srcR * dstR) / 255;
4722 dstG = (srcG * dstG) / 255; 4717 dstG = (srcG * dstG) / 255;
4723 dstB = (srcB * dstB) / 255; 4718 dstB = (srcB * dstB) / 255;
4724 break; 4719 break;
4725 } 4720 }
4726 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 4721 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
4727 *dst = dstpixel; 4722 *dst = dstpixel;
4728 ++src; 4723 ++src;
4729 ++dst; 4724 ++dst;
4730 } 4725 }
4731 info->src += info->src_pitch; 4726 info->src += info->src_pitch;
4732 info->dst += info->dst_pitch; 4727 info->dst += info->dst_pitch;
4733 } 4728 }
4734 } 4729 }
4735 4730
4736 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) 4731 static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
4737 { 4732 {
4738 const int flags = info->flags; 4733 const int flags = info->flags;
4739 const Uint32 modulateR = info->r; 4734 const Uint32 modulateR = info->r;
4740 const Uint32 modulateG = info->g; 4735 const Uint32 modulateG = info->g;
4741 const Uint32 modulateB = info->b; 4736 const Uint32 modulateB = info->b;
4770 posx -= 0x10000L; 4765 posx -= 0x10000L;
4771 } 4766 }
4772 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4767 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4773 } 4768 }
4774 srcpixel = *src; 4769 srcpixel = *src;
4775 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 4770 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4776 dstpixel = *dst; 4771 dstpixel = *dst;
4777 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; 4772 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
4778 if (flags & SDL_COPY_MODULATE_COLOR) { 4773 if (flags & SDL_COPY_MODULATE_COLOR) {
4779 srcR = (srcR * modulateR) / 255; 4774 srcR = (srcR * modulateR) / 255;
4780 srcG = (srcG * modulateG) / 255; 4775 srcG = (srcG * modulateG) / 255;
4781 srcB = (srcB * modulateB) / 255; 4776 srcB = (srcB * modulateB) / 255;
4782 } 4777 }
4813 dstR = (srcR * dstR) / 255; 4808 dstR = (srcR * dstR) / 255;
4814 dstG = (srcG * dstG) / 255; 4809 dstG = (srcG * dstG) / 255;
4815 dstB = (srcB * dstB) / 255; 4810 dstB = (srcB * dstB) / 255;
4816 break; 4811 break;
4817 } 4812 }
4818 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB; 4813 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
4819 *dst = dstpixel; 4814 *dst = dstpixel;
4820 posx += incx; 4815 posx += incx;
4821 ++dst; 4816 ++dst;
4822 } 4817 }
4823 posy += incy; 4818 posy += incy;
4824 info->dst += info->dst_pitch; 4819 info->dst += info->dst_pitch;
4825 } 4820 }
4826 } 4821 }
4827 4822
4828 static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) 4823 static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info)
4829 { 4824 {
4830 const int flags = info->flags; 4825 const int flags = info->flags;
4831 Uint32 pixel; 4826 Uint32 pixel;
4832 Uint32 R, G, B, A; 4827 Uint32 R, G, B, A;
4833 int srcy, srcx; 4828 int srcy, srcx;
4856 posx -= 0x10000L; 4851 posx -= 0x10000L;
4857 } 4852 }
4858 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4853 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4859 } 4854 }
4860 pixel = *src; 4855 pixel = *src;
4861 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; 4856 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
4862 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 4857 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
4863 *dst = pixel; 4858 *dst = pixel;
4864 posx += incx; 4859 posx += incx;
4865 ++dst; 4860 ++dst;
4866 } 4861 }
4867 posy += incy; 4862 posy += incy;
4868 info->dst += info->dst_pitch; 4863 info->dst += info->dst_pitch;
4869 } 4864 }
4870 } 4865 }
4871 4866
4872 static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info) 4867 static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info)
4873 { 4868 {
4874 const int flags = info->flags; 4869 const int flags = info->flags;
4875 Uint32 srcpixel; 4870 Uint32 srcpixel;
4876 Uint32 srcR, srcG, srcB, srcA; 4871 Uint32 srcR, srcG, srcB, srcA;
4877 Uint32 dstpixel; 4872 Uint32 dstpixel;
4881 Uint32 *src = (Uint32 *)info->src; 4876 Uint32 *src = (Uint32 *)info->src;
4882 Uint32 *dst = (Uint32 *)info->dst; 4877 Uint32 *dst = (Uint32 *)info->dst;
4883 int n = info->dst_w; 4878 int n = info->dst_w;
4884 while (n--) { 4879 while (n--) {
4885 srcpixel = *src; 4880 srcpixel = *src;
4886 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 4881 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4887 dstpixel = *dst; 4882 dstpixel = *dst;
4888 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 4883 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
4889 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 4884 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4890 /* This goes away if we ever use premultiplied alpha */ 4885 /* This goes away if we ever use premultiplied alpha */
4891 if (srcA < 255) { 4886 if (srcA < 255) {
4892 srcR = (srcR * srcA) / 255; 4887 srcR = (srcR * srcA) / 255;
4893 srcG = (srcG * srcA) / 255; 4888 srcG = (srcG * srcA) / 255;
4916 dstR = (srcR * dstR) / 255; 4911 dstR = (srcR * dstR) / 255;
4917 dstG = (srcG * dstG) / 255; 4912 dstG = (srcG * dstG) / 255;
4918 dstB = (srcB * dstB) / 255; 4913 dstB = (srcB * dstB) / 255;
4919 break; 4914 break;
4920 } 4915 }
4921 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 4916 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
4922 *dst = dstpixel; 4917 *dst = dstpixel;
4923 ++src; 4918 ++src;
4924 ++dst; 4919 ++dst;
4925 } 4920 }
4926 info->src += info->src_pitch; 4921 info->src += info->src_pitch;
4927 info->dst += info->dst_pitch; 4922 info->dst += info->dst_pitch;
4928 } 4923 }
4929 } 4924 }
4930 4925
4931 static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) 4926 static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
4932 { 4927 {
4933 const int flags = info->flags; 4928 const int flags = info->flags;
4934 Uint32 srcpixel; 4929 Uint32 srcpixel;
4935 Uint32 srcR, srcG, srcB, srcA; 4930 Uint32 srcR, srcG, srcB, srcA;
4936 Uint32 dstpixel; 4931 Uint32 dstpixel;
4961 posx -= 0x10000L; 4956 posx -= 0x10000L;
4962 } 4957 }
4963 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 4958 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
4964 } 4959 }
4965 srcpixel = *src; 4960 srcpixel = *src;
4966 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 4961 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
4967 dstpixel = *dst; 4962 dstpixel = *dst;
4968 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 4963 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
4969 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { 4964 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
4970 /* This goes away if we ever use premultiplied alpha */ 4965 /* This goes away if we ever use premultiplied alpha */
4971 if (srcA < 255) { 4966 if (srcA < 255) {
4972 srcR = (srcR * srcA) / 255; 4967 srcR = (srcR * srcA) / 255;
4973 srcG = (srcG * srcA) / 255; 4968 srcG = (srcG * srcA) / 255;
4996 dstR = (srcR * dstR) / 255; 4991 dstR = (srcR * dstR) / 255;
4997 dstG = (srcG * dstG) / 255; 4992 dstG = (srcG * dstG) / 255;
4998 dstB = (srcB * dstB) / 255; 4993 dstB = (srcB * dstB) / 255;
4999 break; 4994 break;
5000 } 4995 }
5001 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 4996 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5002 *dst = dstpixel; 4997 *dst = dstpixel;
5003 posx += incx; 4998 posx += incx;
5004 ++dst; 4999 ++dst;
5005 } 5000 }
5006 posy += incy; 5001 posy += incy;
5007 info->dst += info->dst_pitch; 5002 info->dst += info->dst_pitch;
5008 } 5003 }
5009 } 5004 }
5010 5005
5011 static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info) 5006 static void SDL_Blit_RGBA8888_ARGB8888_Modulate(SDL_BlitInfo *info)
5012 { 5007 {
5013 const int flags = info->flags; 5008 const int flags = info->flags;
5014 const Uint32 modulateR = info->r; 5009 const Uint32 modulateR = info->r;
5015 const Uint32 modulateG = info->g; 5010 const Uint32 modulateG = info->g;
5016 const Uint32 modulateB = info->b; 5011 const Uint32 modulateB = info->b;
5022 Uint32 *src = (Uint32 *)info->src; 5017 Uint32 *src = (Uint32 *)info->src;
5023 Uint32 *dst = (Uint32 *)info->dst; 5018 Uint32 *dst = (Uint32 *)info->dst;
5024 int n = info->dst_w; 5019 int n = info->dst_w;
5025 while (n--) { 5020 while (n--) {
5026 pixel = *src; 5021 pixel = *src;
5027 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; 5022 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
5028 if (flags & SDL_COPY_MODULATE_COLOR) { 5023 if (flags & SDL_COPY_MODULATE_COLOR) {
5029 R = (R * modulateR) / 255; 5024 R = (R * modulateR) / 255;
5030 G = (G * modulateG) / 255; 5025 G = (G * modulateG) / 255;
5031 B = (B * modulateB) / 255; 5026 B = (B * modulateB) / 255;
5032 } 5027 }
5033 if (flags & SDL_COPY_MODULATE_ALPHA) { 5028 if (flags & SDL_COPY_MODULATE_ALPHA) {
5034 A = (A * modulateA) / 255; 5029 A = (A * modulateA) / 255;
5035 } 5030 }
5036 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 5031 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
5037 *dst = pixel; 5032 *dst = pixel;
5038 ++src; 5033 ++src;
5039 ++dst; 5034 ++dst;
5040 } 5035 }
5041 info->src += info->src_pitch; 5036 info->src += info->src_pitch;
5042 info->dst += info->dst_pitch; 5037 info->dst += info->dst_pitch;
5043 } 5038 }
5044 } 5039 }
5045 5040
5046 static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) 5041 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
5047 { 5042 {
5048 const int flags = info->flags; 5043 const int flags = info->flags;
5049 const Uint32 modulateR = info->r; 5044 const Uint32 modulateR = info->r;
5050 const Uint32 modulateG = info->g; 5045 const Uint32 modulateG = info->g;
5051 const Uint32 modulateB = info->b; 5046 const Uint32 modulateB = info->b;
5078 posx -= 0x10000L; 5073 posx -= 0x10000L;
5079 } 5074 }
5080 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 5075 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5081 } 5076 }
5082 pixel = *src; 5077 pixel = *src;
5083 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel; 5078 R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
5084 if (flags & SDL_COPY_MODULATE_COLOR) { 5079 if (flags & SDL_COPY_MODULATE_COLOR) {
5085 R = (R * modulateR) / 255; 5080 R = (R * modulateR) / 255;
5086 G = (G * modulateG) / 255; 5081 G = (G * modulateG) / 255;
5087 B = (B * modulateB) / 255; 5082 B = (B * modulateB) / 255;
5088 } 5083 }
5089 if (flags & SDL_COPY_MODULATE_ALPHA) { 5084 if (flags & SDL_COPY_MODULATE_ALPHA) {
5090 A = (A * modulateA) / 255; 5085 A = (A * modulateA) / 255;
5091 } 5086 }
5092 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R; 5087 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
5093 *dst = pixel; 5088 *dst = pixel;
5094 posx += incx; 5089 posx += incx;
5095 ++dst; 5090 ++dst;
5096 } 5091 }
5097 posy += incy; 5092 posy += incy;
5098 info->dst += info->dst_pitch; 5093 info->dst += info->dst_pitch;
5099 } 5094 }
5100 } 5095 }
5101 5096
5102 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info) 5097 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
5103 { 5098 {
5104 const int flags = info->flags; 5099 const int flags = info->flags;
5105 const Uint32 modulateR = info->r; 5100 const Uint32 modulateR = info->r;
5106 const Uint32 modulateG = info->g; 5101 const Uint32 modulateG = info->g;
5107 const Uint32 modulateB = info->b; 5102 const Uint32 modulateB = info->b;
5115 Uint32 *src = (Uint32 *)info->src; 5110 Uint32 *src = (Uint32 *)info->src;
5116 Uint32 *dst = (Uint32 *)info->dst; 5111 Uint32 *dst = (Uint32 *)info->dst;
5117 int n = info->dst_w; 5112 int n = info->dst_w;
5118 while (n--) { 5113 while (n--) {
5119 srcpixel = *src; 5114 srcpixel = *src;
5120 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 5115 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
5121 dstpixel = *dst; 5116 dstpixel = *dst;
5122 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 5117 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
5123 if (flags & SDL_COPY_MODULATE_COLOR) { 5118 if (flags & SDL_COPY_MODULATE_COLOR) {
5124 srcR = (srcR * modulateR) / 255; 5119 srcR = (srcR * modulateR) / 255;
5125 srcG = (srcG * modulateG) / 255; 5120 srcG = (srcG * modulateG) / 255;
5126 srcB = (srcB * modulateB) / 255; 5121 srcB = (srcB * modulateB) / 255;
5127 } 5122 }
5158 dstR = (srcR * dstR) / 255; 5153 dstR = (srcR * dstR) / 255;
5159 dstG = (srcG * dstG) / 255; 5154 dstG = (srcG * dstG) / 255;
5160 dstB = (srcB * dstB) / 255; 5155 dstB = (srcB * dstB) / 255;
5161 break; 5156 break;
5162 } 5157 }
5163 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 5158 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5164 *dst = dstpixel; 5159 *dst = dstpixel;
5165 ++src; 5160 ++src;
5166 ++dst; 5161 ++dst;
5167 } 5162 }
5168 info->src += info->src_pitch; 5163 info->src += info->src_pitch;
5169 info->dst += info->dst_pitch; 5164 info->dst += info->dst_pitch;
5170 } 5165 }
5171 } 5166 }
5172 5167
5173 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) 5168 static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
5174 { 5169 {
5175 const int flags = info->flags; 5170 const int flags = info->flags;
5176 const Uint32 modulateR = info->r; 5171 const Uint32 modulateR = info->r;
5177 const Uint32 modulateG = info->g; 5172 const Uint32 modulateG = info->g;
5178 const Uint32 modulateB = info->b; 5173 const Uint32 modulateB = info->b;
5207 posx -= 0x10000L; 5202 posx -= 0x10000L;
5208 } 5203 }
5209 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); 5204 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5210 } 5205 }
5211 srcpixel = *src; 5206 srcpixel = *src;
5207 srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
5208 dstpixel = *dst;
5209 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
5210 if (flags & SDL_COPY_MODULATE_COLOR) {
5211 srcR = (srcR * modulateR) / 255;
5212 srcG = (srcG * modulateG) / 255;
5213 srcB = (srcB * modulateB) / 255;
5214 }
5215 if (flags & SDL_COPY_MODULATE_ALPHA) {
5216 srcA = (srcA * modulateA) / 255;
5217 }
5218 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5219 /* This goes away if we ever use premultiplied alpha */
5220 if (srcA < 255) {
5221 srcR = (srcR * srcA) / 255;
5222 srcG = (srcG * srcA) / 255;
5223 srcB = (srcB * srcA) / 255;
5224 }
5225 }
5226 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
5227 case SDL_COPY_MASK:
5228 if (srcA) {
5229 dstR = srcR;
5230 dstG = srcG;
5231 dstB = srcB;
5232 }
5233 break;
5234 case SDL_COPY_BLEND:
5235 dstR = srcR + ((255 - srcA) * dstR) / 255;
5236 dstG = srcG + ((255 - srcA) * dstG) / 255;
5237 dstB = srcB + ((255 - srcA) * dstB) / 255;
5238 break;
5239 case SDL_COPY_ADD:
5240 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5241 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5242 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5243 break;
5244 case SDL_COPY_MOD:
5245 dstR = (srcR * dstR) / 255;
5246 dstG = (srcG * dstG) / 255;
5247 dstB = (srcB * dstB) / 255;
5248 break;
5249 }
5250 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5251 *dst = dstpixel;
5252 posx += incx;
5253 ++dst;
5254 }
5255 posy += incy;
5256 info->dst += info->dst_pitch;
5257 }
5258 }
5259
5260 static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info)
5261 {
5262 const int flags = info->flags;
5263 Uint32 pixel;
5264 Uint32 R, G, B, A;
5265 int srcy, srcx;
5266 int posy, posx;
5267 int incy, incx;
5268
5269 srcy = 0;
5270 posy = 0;
5271 incy = (info->src_h << 16) / info->dst_h;
5272 incx = (info->src_w << 16) / info->dst_w;
5273
5274 while (info->dst_h--) {
5275 Uint32 *src;
5276 Uint32 *dst = (Uint32 *)info->dst;
5277 int n = info->dst_w;
5278 srcx = -1;
5279 posx = 0x10000L;
5280 while (posy >= 0x10000L) {
5281 ++srcy;
5282 posy -= 0x10000L;
5283 }
5284 while (n--) {
5285 if (posx >= 0x10000L) {
5286 while (posx >= 0x10000L) {
5287 ++srcx;
5288 posx -= 0x10000L;
5289 }
5290 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5291 }
5292 pixel = *src;
5293 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5294 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
5295 *dst = pixel;
5296 posx += incx;
5297 ++dst;
5298 }
5299 posy += incy;
5300 info->dst += info->dst_pitch;
5301 }
5302 }
5303
5304 static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info)
5305 {
5306 const int flags = info->flags;
5307 Uint32 srcpixel;
5308 Uint32 srcR, srcG, srcB, srcA;
5309 Uint32 dstpixel;
5310 Uint32 dstR, dstG, dstB, dstA;
5311
5312 while (info->dst_h--) {
5313 Uint32 *src = (Uint32 *)info->src;
5314 Uint32 *dst = (Uint32 *)info->dst;
5315 int n = info->dst_w;
5316 while (n--) {
5317 srcpixel = *src;
5318 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
5319 dstpixel = *dst;
5320 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
5321 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5322 /* This goes away if we ever use premultiplied alpha */
5323 if (srcA < 255) {
5324 srcR = (srcR * srcA) / 255;
5325 srcG = (srcG * srcA) / 255;
5326 srcB = (srcB * srcA) / 255;
5327 }
5328 }
5329 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
5330 case SDL_COPY_MASK:
5331 if (srcA) {
5332 dstR = srcR;
5333 dstG = srcG;
5334 dstB = srcB;
5335 }
5336 break;
5337 case SDL_COPY_BLEND:
5338 dstR = srcR + ((255 - srcA) * dstR) / 255;
5339 dstG = srcG + ((255 - srcA) * dstG) / 255;
5340 dstB = srcB + ((255 - srcA) * dstB) / 255;
5341 break;
5342 case SDL_COPY_ADD:
5343 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5344 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5345 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5346 break;
5347 case SDL_COPY_MOD:
5348 dstR = (srcR * dstR) / 255;
5349 dstG = (srcG * dstG) / 255;
5350 dstB = (srcB * dstB) / 255;
5351 break;
5352 }
5353 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5354 *dst = dstpixel;
5355 ++src;
5356 ++dst;
5357 }
5358 info->src += info->src_pitch;
5359 info->dst += info->dst_pitch;
5360 }
5361 }
5362
5363 static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
5364 {
5365 const int flags = info->flags;
5366 Uint32 srcpixel;
5367 Uint32 srcR, srcG, srcB, srcA;
5368 Uint32 dstpixel;
5369 Uint32 dstR, dstG, dstB, dstA;
5370 int srcy, srcx;
5371 int posy, posx;
5372 int incy, incx;
5373
5374 srcy = 0;
5375 posy = 0;
5376 incy = (info->src_h << 16) / info->dst_h;
5377 incx = (info->src_w << 16) / info->dst_w;
5378
5379 while (info->dst_h--) {
5380 Uint32 *src;
5381 Uint32 *dst = (Uint32 *)info->dst;
5382 int n = info->dst_w;
5383 srcx = -1;
5384 posx = 0x10000L;
5385 while (posy >= 0x10000L) {
5386 ++srcy;
5387 posy -= 0x10000L;
5388 }
5389 while (n--) {
5390 if (posx >= 0x10000L) {
5391 while (posx >= 0x10000L) {
5392 ++srcx;
5393 posx -= 0x10000L;
5394 }
5395 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5396 }
5397 srcpixel = *src;
5398 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
5399 dstpixel = *dst;
5400 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
5401 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5402 /* This goes away if we ever use premultiplied alpha */
5403 if (srcA < 255) {
5404 srcR = (srcR * srcA) / 255;
5405 srcG = (srcG * srcA) / 255;
5406 srcB = (srcB * srcA) / 255;
5407 }
5408 }
5409 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
5410 case SDL_COPY_MASK:
5411 if (srcA) {
5412 dstR = srcR;
5413 dstG = srcG;
5414 dstB = srcB;
5415 }
5416 break;
5417 case SDL_COPY_BLEND:
5418 dstR = srcR + ((255 - srcA) * dstR) / 255;
5419 dstG = srcG + ((255 - srcA) * dstG) / 255;
5420 dstB = srcB + ((255 - srcA) * dstB) / 255;
5421 break;
5422 case SDL_COPY_ADD:
5423 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5424 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5425 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5426 break;
5427 case SDL_COPY_MOD:
5428 dstR = (srcR * dstR) / 255;
5429 dstG = (srcG * dstG) / 255;
5430 dstB = (srcB * dstB) / 255;
5431 break;
5432 }
5433 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5434 *dst = dstpixel;
5435 posx += incx;
5436 ++dst;
5437 }
5438 posy += incy;
5439 info->dst += info->dst_pitch;
5440 }
5441 }
5442
5443 static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info)
5444 {
5445 const int flags = info->flags;
5446 const Uint32 modulateR = info->r;
5447 const Uint32 modulateG = info->g;
5448 const Uint32 modulateB = info->b;
5449 const Uint32 modulateA = info->a;
5450 Uint32 pixel;
5451 Uint32 R, G, B, A;
5452
5453 while (info->dst_h--) {
5454 Uint32 *src = (Uint32 *)info->src;
5455 Uint32 *dst = (Uint32 *)info->dst;
5456 int n = info->dst_w;
5457 while (n--) {
5458 pixel = *src;
5459 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5460 if (flags & SDL_COPY_MODULATE_COLOR) {
5461 R = (R * modulateR) / 255;
5462 G = (G * modulateG) / 255;
5463 B = (B * modulateB) / 255;
5464 }
5465 if (flags & SDL_COPY_MODULATE_ALPHA) {
5466 A = (A * modulateA) / 255;
5467 }
5468 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
5469 *dst = pixel;
5470 ++src;
5471 ++dst;
5472 }
5473 info->src += info->src_pitch;
5474 info->dst += info->dst_pitch;
5475 }
5476 }
5477
5478 static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
5479 {
5480 const int flags = info->flags;
5481 const Uint32 modulateR = info->r;
5482 const Uint32 modulateG = info->g;
5483 const Uint32 modulateB = info->b;
5484 const Uint32 modulateA = info->a;
5485 Uint32 pixel;
5486 Uint32 R, G, B, A;
5487 int srcy, srcx;
5488 int posy, posx;
5489 int incy, incx;
5490
5491 srcy = 0;
5492 posy = 0;
5493 incy = (info->src_h << 16) / info->dst_h;
5494 incx = (info->src_w << 16) / info->dst_w;
5495
5496 while (info->dst_h--) {
5497 Uint32 *src;
5498 Uint32 *dst = (Uint32 *)info->dst;
5499 int n = info->dst_w;
5500 srcx = -1;
5501 posx = 0x10000L;
5502 while (posy >= 0x10000L) {
5503 ++srcy;
5504 posy -= 0x10000L;
5505 }
5506 while (n--) {
5507 if (posx >= 0x10000L) {
5508 while (posx >= 0x10000L) {
5509 ++srcx;
5510 posx -= 0x10000L;
5511 }
5512 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5513 }
5514 pixel = *src;
5515 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5516 if (flags & SDL_COPY_MODULATE_COLOR) {
5517 R = (R * modulateR) / 255;
5518 G = (G * modulateG) / 255;
5519 B = (B * modulateB) / 255;
5520 }
5521 if (flags & SDL_COPY_MODULATE_ALPHA) {
5522 A = (A * modulateA) / 255;
5523 }
5524 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
5525 *dst = pixel;
5526 posx += incx;
5527 ++dst;
5528 }
5529 posy += incy;
5530 info->dst += info->dst_pitch;
5531 }
5532 }
5533
5534 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
5535 {
5536 const int flags = info->flags;
5537 const Uint32 modulateR = info->r;
5538 const Uint32 modulateG = info->g;
5539 const Uint32 modulateB = info->b;
5540 const Uint32 modulateA = info->a;
5541 Uint32 srcpixel;
5542 Uint32 srcR, srcG, srcB, srcA;
5543 Uint32 dstpixel;
5544 Uint32 dstR, dstG, dstB, dstA;
5545
5546 while (info->dst_h--) {
5547 Uint32 *src = (Uint32 *)info->src;
5548 Uint32 *dst = (Uint32 *)info->dst;
5549 int n = info->dst_w;
5550 while (n--) {
5551 srcpixel = *src;
5552 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
5553 dstpixel = *dst;
5554 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
5555 if (flags & SDL_COPY_MODULATE_COLOR) {
5556 srcR = (srcR * modulateR) / 255;
5557 srcG = (srcG * modulateG) / 255;
5558 srcB = (srcB * modulateB) / 255;
5559 }
5560 if (flags & SDL_COPY_MODULATE_ALPHA) {
5561 srcA = (srcA * modulateA) / 255;
5562 }
5563 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5564 /* This goes away if we ever use premultiplied alpha */
5565 if (srcA < 255) {
5566 srcR = (srcR * srcA) / 255;
5567 srcG = (srcG * srcA) / 255;
5568 srcB = (srcB * srcA) / 255;
5569 }
5570 }
5571 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
5572 case SDL_COPY_MASK:
5573 if (srcA) {
5574 dstR = srcR;
5575 dstG = srcG;
5576 dstB = srcB;
5577 }
5578 break;
5579 case SDL_COPY_BLEND:
5580 dstR = srcR + ((255 - srcA) * dstR) / 255;
5581 dstG = srcG + ((255 - srcA) * dstG) / 255;
5582 dstB = srcB + ((255 - srcA) * dstB) / 255;
5583 break;
5584 case SDL_COPY_ADD:
5585 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5586 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5587 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5588 break;
5589 case SDL_COPY_MOD:
5590 dstR = (srcR * dstR) / 255;
5591 dstG = (srcG * dstG) / 255;
5592 dstB = (srcB * dstB) / 255;
5593 break;
5594 }
5595 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5596 *dst = dstpixel;
5597 ++src;
5598 ++dst;
5599 }
5600 info->src += info->src_pitch;
5601 info->dst += info->dst_pitch;
5602 }
5603 }
5604
5605 static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
5606 {
5607 const int flags = info->flags;
5608 const Uint32 modulateR = info->r;
5609 const Uint32 modulateG = info->g;
5610 const Uint32 modulateB = info->b;
5611 const Uint32 modulateA = info->a;
5612 Uint32 srcpixel;
5613 Uint32 srcR, srcG, srcB, srcA;
5614 Uint32 dstpixel;
5615 Uint32 dstR, dstG, dstB, dstA;
5616 int srcy, srcx;
5617 int posy, posx;
5618 int incy, incx;
5619
5620 srcy = 0;
5621 posy = 0;
5622 incy = (info->src_h << 16) / info->dst_h;
5623 incx = (info->src_w << 16) / info->dst_w;
5624
5625 while (info->dst_h--) {
5626 Uint32 *src;
5627 Uint32 *dst = (Uint32 *)info->dst;
5628 int n = info->dst_w;
5629 srcx = -1;
5630 posx = 0x10000L;
5631 while (posy >= 0x10000L) {
5632 ++srcy;
5633 posy -= 0x10000L;
5634 }
5635 while (n--) {
5636 if (posx >= 0x10000L) {
5637 while (posx >= 0x10000L) {
5638 ++srcx;
5639 posx -= 0x10000L;
5640 }
5641 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5642 }
5643 srcpixel = *src;
5644 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
5645 dstpixel = *dst;
5646 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
5647 if (flags & SDL_COPY_MODULATE_COLOR) {
5648 srcR = (srcR * modulateR) / 255;
5649 srcG = (srcG * modulateG) / 255;
5650 srcB = (srcB * modulateB) / 255;
5651 }
5652 if (flags & SDL_COPY_MODULATE_ALPHA) {
5653 srcA = (srcA * modulateA) / 255;
5654 }
5655 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5656 /* This goes away if we ever use premultiplied alpha */
5657 if (srcA < 255) {
5658 srcR = (srcR * srcA) / 255;
5659 srcG = (srcG * srcA) / 255;
5660 srcB = (srcB * srcA) / 255;
5661 }
5662 }
5663 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
5664 case SDL_COPY_MASK:
5665 if (srcA) {
5666 dstR = srcR;
5667 dstG = srcG;
5668 dstB = srcB;
5669 }
5670 break;
5671 case SDL_COPY_BLEND:
5672 dstR = srcR + ((255 - srcA) * dstR) / 255;
5673 dstG = srcG + ((255 - srcA) * dstG) / 255;
5674 dstB = srcB + ((255 - srcA) * dstB) / 255;
5675 break;
5676 case SDL_COPY_ADD:
5677 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5678 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5679 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5680 break;
5681 case SDL_COPY_MOD:
5682 dstR = (srcR * dstR) / 255;
5683 dstG = (srcG * dstG) / 255;
5684 dstB = (srcB * dstB) / 255;
5685 break;
5686 }
5687 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5688 *dst = dstpixel;
5689 posx += incx;
5690 ++dst;
5691 }
5692 posy += incy;
5693 info->dst += info->dst_pitch;
5694 }
5695 }
5696
5697 static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info)
5698 {
5699 const int flags = info->flags;
5700 Uint32 pixel;
5701 Uint32 R, G, B, A;
5702 int srcy, srcx;
5703 int posy, posx;
5704 int incy, incx;
5705
5706 srcy = 0;
5707 posy = 0;
5708 incy = (info->src_h << 16) / info->dst_h;
5709 incx = (info->src_w << 16) / info->dst_w;
5710
5711 while (info->dst_h--) {
5712 Uint32 *src;
5713 Uint32 *dst = (Uint32 *)info->dst;
5714 int n = info->dst_w;
5715 srcx = -1;
5716 posx = 0x10000L;
5717 while (posy >= 0x10000L) {
5718 ++srcy;
5719 posy -= 0x10000L;
5720 }
5721 while (n--) {
5722 if (posx >= 0x10000L) {
5723 while (posx >= 0x10000L) {
5724 ++srcx;
5725 posx -= 0x10000L;
5726 }
5727 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5728 }
5729 pixel = *src;
5730 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5731 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
5732 *dst = pixel;
5733 posx += incx;
5734 ++dst;
5735 }
5736 posy += incy;
5737 info->dst += info->dst_pitch;
5738 }
5739 }
5740
5741 static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info)
5742 {
5743 const int flags = info->flags;
5744 Uint32 srcpixel;
5745 Uint32 srcR, srcG, srcB, srcA;
5746 Uint32 dstpixel;
5747 Uint32 dstR, dstG, dstB, dstA;
5748
5749 while (info->dst_h--) {
5750 Uint32 *src = (Uint32 *)info->src;
5751 Uint32 *dst = (Uint32 *)info->dst;
5752 int n = info->dst_w;
5753 while (n--) {
5754 srcpixel = *src;
5755 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
5756 dstpixel = *dst;
5757 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
5758 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5759 /* This goes away if we ever use premultiplied alpha */
5760 if (srcA < 255) {
5761 srcR = (srcR * srcA) / 255;
5762 srcG = (srcG * srcA) / 255;
5763 srcB = (srcB * srcA) / 255;
5764 }
5765 }
5766 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
5767 case SDL_COPY_MASK:
5768 if (srcA) {
5769 dstR = srcR;
5770 dstG = srcG;
5771 dstB = srcB;
5772 }
5773 break;
5774 case SDL_COPY_BLEND:
5775 dstR = srcR + ((255 - srcA) * dstR) / 255;
5776 dstG = srcG + ((255 - srcA) * dstG) / 255;
5777 dstB = srcB + ((255 - srcA) * dstB) / 255;
5778 break;
5779 case SDL_COPY_ADD:
5780 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5781 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5782 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5783 break;
5784 case SDL_COPY_MOD:
5785 dstR = (srcR * dstR) / 255;
5786 dstG = (srcG * dstG) / 255;
5787 dstB = (srcB * dstB) / 255;
5788 break;
5789 }
5790 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
5791 *dst = dstpixel;
5792 ++src;
5793 ++dst;
5794 }
5795 info->src += info->src_pitch;
5796 info->dst += info->dst_pitch;
5797 }
5798 }
5799
5800 static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
5801 {
5802 const int flags = info->flags;
5803 Uint32 srcpixel;
5804 Uint32 srcR, srcG, srcB, srcA;
5805 Uint32 dstpixel;
5806 Uint32 dstR, dstG, dstB, dstA;
5807 int srcy, srcx;
5808 int posy, posx;
5809 int incy, incx;
5810
5811 srcy = 0;
5812 posy = 0;
5813 incy = (info->src_h << 16) / info->dst_h;
5814 incx = (info->src_w << 16) / info->dst_w;
5815
5816 while (info->dst_h--) {
5817 Uint32 *src;
5818 Uint32 *dst = (Uint32 *)info->dst;
5819 int n = info->dst_w;
5820 srcx = -1;
5821 posx = 0x10000L;
5822 while (posy >= 0x10000L) {
5823 ++srcy;
5824 posy -= 0x10000L;
5825 }
5826 while (n--) {
5827 if (posx >= 0x10000L) {
5828 while (posx >= 0x10000L) {
5829 ++srcx;
5830 posx -= 0x10000L;
5831 }
5832 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5833 }
5834 srcpixel = *src;
5835 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
5836 dstpixel = *dst;
5837 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
5838 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
5839 /* This goes away if we ever use premultiplied alpha */
5840 if (srcA < 255) {
5841 srcR = (srcR * srcA) / 255;
5842 srcG = (srcG * srcA) / 255;
5843 srcB = (srcB * srcA) / 255;
5844 }
5845 }
5846 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
5847 case SDL_COPY_MASK:
5848 if (srcA) {
5849 dstR = srcR;
5850 dstG = srcG;
5851 dstB = srcB;
5852 }
5853 break;
5854 case SDL_COPY_BLEND:
5855 dstR = srcR + ((255 - srcA) * dstR) / 255;
5856 dstG = srcG + ((255 - srcA) * dstG) / 255;
5857 dstB = srcB + ((255 - srcA) * dstB) / 255;
5858 break;
5859 case SDL_COPY_ADD:
5860 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
5861 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
5862 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
5863 break;
5864 case SDL_COPY_MOD:
5865 dstR = (srcR * dstR) / 255;
5866 dstG = (srcG * dstG) / 255;
5867 dstB = (srcB * dstB) / 255;
5868 break;
5869 }
5870 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
5871 *dst = dstpixel;
5872 posx += incx;
5873 ++dst;
5874 }
5875 posy += incy;
5876 info->dst += info->dst_pitch;
5877 }
5878 }
5879
5880 static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info)
5881 {
5882 const int flags = info->flags;
5883 const Uint32 modulateR = info->r;
5884 const Uint32 modulateG = info->g;
5885 const Uint32 modulateB = info->b;
5886 const Uint32 modulateA = info->a;
5887 Uint32 pixel;
5888 Uint32 R, G, B, A;
5889
5890 while (info->dst_h--) {
5891 Uint32 *src = (Uint32 *)info->src;
5892 Uint32 *dst = (Uint32 *)info->dst;
5893 int n = info->dst_w;
5894 while (n--) {
5895 pixel = *src;
5896 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5897 if (flags & SDL_COPY_MODULATE_COLOR) {
5898 R = (R * modulateR) / 255;
5899 G = (G * modulateG) / 255;
5900 B = (B * modulateB) / 255;
5901 }
5902 if (flags & SDL_COPY_MODULATE_ALPHA) {
5903 A = (A * modulateA) / 255;
5904 }
5905 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
5906 *dst = pixel;
5907 ++src;
5908 ++dst;
5909 }
5910 info->src += info->src_pitch;
5911 info->dst += info->dst_pitch;
5912 }
5913 }
5914
5915 static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
5916 {
5917 const int flags = info->flags;
5918 const Uint32 modulateR = info->r;
5919 const Uint32 modulateG = info->g;
5920 const Uint32 modulateB = info->b;
5921 const Uint32 modulateA = info->a;
5922 Uint32 pixel;
5923 Uint32 R, G, B, A;
5924 int srcy, srcx;
5925 int posy, posx;
5926 int incy, incx;
5927
5928 srcy = 0;
5929 posy = 0;
5930 incy = (info->src_h << 16) / info->dst_h;
5931 incx = (info->src_w << 16) / info->dst_w;
5932
5933 while (info->dst_h--) {
5934 Uint32 *src;
5935 Uint32 *dst = (Uint32 *)info->dst;
5936 int n = info->dst_w;
5937 srcx = -1;
5938 posx = 0x10000L;
5939 while (posy >= 0x10000L) {
5940 ++srcy;
5941 posy -= 0x10000L;
5942 }
5943 while (n--) {
5944 if (posx >= 0x10000L) {
5945 while (posx >= 0x10000L) {
5946 ++srcx;
5947 posx -= 0x10000L;
5948 }
5949 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
5950 }
5951 pixel = *src;
5952 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
5953 if (flags & SDL_COPY_MODULATE_COLOR) {
5954 R = (R * modulateR) / 255;
5955 G = (G * modulateG) / 255;
5956 B = (B * modulateB) / 255;
5957 }
5958 if (flags & SDL_COPY_MODULATE_ALPHA) {
5959 A = (A * modulateA) / 255;
5960 }
5961 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
5962 *dst = pixel;
5963 posx += incx;
5964 ++dst;
5965 }
5966 posy += incy;
5967 info->dst += info->dst_pitch;
5968 }
5969 }
5970
5971 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
5972 {
5973 const int flags = info->flags;
5974 const Uint32 modulateR = info->r;
5975 const Uint32 modulateG = info->g;
5976 const Uint32 modulateB = info->b;
5977 const Uint32 modulateA = info->a;
5978 Uint32 srcpixel;
5979 Uint32 srcR, srcG, srcB, srcA;
5980 Uint32 dstpixel;
5981 Uint32 dstR, dstG, dstB, dstA;
5982
5983 while (info->dst_h--) {
5984 Uint32 *src = (Uint32 *)info->src;
5985 Uint32 *dst = (Uint32 *)info->dst;
5986 int n = info->dst_w;
5987 while (n--) {
5988 srcpixel = *src;
5989 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
5990 dstpixel = *dst;
5991 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
5992 if (flags & SDL_COPY_MODULATE_COLOR) {
5993 srcR = (srcR * modulateR) / 255;
5994 srcG = (srcG * modulateG) / 255;
5995 srcB = (srcB * modulateB) / 255;
5996 }
5997 if (flags & SDL_COPY_MODULATE_ALPHA) {
5998 srcA = (srcA * modulateA) / 255;
5999 }
6000 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6001 /* This goes away if we ever use premultiplied alpha */
6002 if (srcA < 255) {
6003 srcR = (srcR * srcA) / 255;
6004 srcG = (srcG * srcA) / 255;
6005 srcB = (srcB * srcA) / 255;
6006 }
6007 }
6008 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6009 case SDL_COPY_MASK:
6010 if (srcA) {
6011 dstR = srcR;
6012 dstG = srcG;
6013 dstB = srcB;
6014 }
6015 break;
6016 case SDL_COPY_BLEND:
6017 dstR = srcR + ((255 - srcA) * dstR) / 255;
6018 dstG = srcG + ((255 - srcA) * dstG) / 255;
6019 dstB = srcB + ((255 - srcA) * dstB) / 255;
6020 break;
6021 case SDL_COPY_ADD:
6022 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6023 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6024 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6025 break;
6026 case SDL_COPY_MOD:
6027 dstR = (srcR * dstR) / 255;
6028 dstG = (srcG * dstG) / 255;
6029 dstB = (srcB * dstB) / 255;
6030 break;
6031 }
6032 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
6033 *dst = dstpixel;
6034 ++src;
6035 ++dst;
6036 }
6037 info->src += info->src_pitch;
6038 info->dst += info->dst_pitch;
6039 }
6040 }
6041
6042 static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
6043 {
6044 const int flags = info->flags;
6045 const Uint32 modulateR = info->r;
6046 const Uint32 modulateG = info->g;
6047 const Uint32 modulateB = info->b;
6048 const Uint32 modulateA = info->a;
6049 Uint32 srcpixel;
6050 Uint32 srcR, srcG, srcB, srcA;
6051 Uint32 dstpixel;
6052 Uint32 dstR, dstG, dstB, dstA;
6053 int srcy, srcx;
6054 int posy, posx;
6055 int incy, incx;
6056
6057 srcy = 0;
6058 posy = 0;
6059 incy = (info->src_h << 16) / info->dst_h;
6060 incx = (info->src_w << 16) / info->dst_w;
6061
6062 while (info->dst_h--) {
6063 Uint32 *src;
6064 Uint32 *dst = (Uint32 *)info->dst;
6065 int n = info->dst_w;
6066 srcx = -1;
6067 posx = 0x10000L;
6068 while (posy >= 0x10000L) {
6069 ++srcy;
6070 posy -= 0x10000L;
6071 }
6072 while (n--) {
6073 if (posx >= 0x10000L) {
6074 while (posx >= 0x10000L) {
6075 ++srcx;
6076 posx -= 0x10000L;
6077 }
6078 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6079 }
6080 srcpixel = *src;
6081 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
6082 dstpixel = *dst;
6083 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
6084 if (flags & SDL_COPY_MODULATE_COLOR) {
6085 srcR = (srcR * modulateR) / 255;
6086 srcG = (srcG * modulateG) / 255;
6087 srcB = (srcB * modulateB) / 255;
6088 }
6089 if (flags & SDL_COPY_MODULATE_ALPHA) {
6090 srcA = (srcA * modulateA) / 255;
6091 }
6092 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6093 /* This goes away if we ever use premultiplied alpha */
6094 if (srcA < 255) {
6095 srcR = (srcR * srcA) / 255;
6096 srcG = (srcG * srcA) / 255;
6097 srcB = (srcB * srcA) / 255;
6098 }
6099 }
6100 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6101 case SDL_COPY_MASK:
6102 if (srcA) {
6103 dstR = srcR;
6104 dstG = srcG;
6105 dstB = srcB;
6106 }
6107 break;
6108 case SDL_COPY_BLEND:
6109 dstR = srcR + ((255 - srcA) * dstR) / 255;
6110 dstG = srcG + ((255 - srcA) * dstG) / 255;
6111 dstB = srcB + ((255 - srcA) * dstB) / 255;
6112 break;
6113 case SDL_COPY_ADD:
6114 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6115 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6116 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6117 break;
6118 case SDL_COPY_MOD:
6119 dstR = (srcR * dstR) / 255;
6120 dstG = (srcG * dstG) / 255;
6121 dstB = (srcB * dstB) / 255;
6122 break;
6123 }
6124 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
6125 *dst = dstpixel;
6126 posx += incx;
6127 ++dst;
6128 }
6129 posy += incy;
6130 info->dst += info->dst_pitch;
6131 }
6132 }
6133
6134 static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info)
6135 {
6136 const int flags = info->flags;
6137 Uint32 pixel;
6138 Uint32 R, G, B, A;
6139 int srcy, srcx;
6140 int posy, posx;
6141 int incy, incx;
6142
6143 srcy = 0;
6144 posy = 0;
6145 incy = (info->src_h << 16) / info->dst_h;
6146 incx = (info->src_w << 16) / info->dst_w;
6147
6148 while (info->dst_h--) {
6149 Uint32 *src;
6150 Uint32 *dst = (Uint32 *)info->dst;
6151 int n = info->dst_w;
6152 srcx = -1;
6153 posx = 0x10000L;
6154 while (posy >= 0x10000L) {
6155 ++srcy;
6156 posy -= 0x10000L;
6157 }
6158 while (n--) {
6159 if (posx >= 0x10000L) {
6160 while (posx >= 0x10000L) {
6161 ++srcx;
6162 posx -= 0x10000L;
6163 }
6164 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6165 }
6166 pixel = *src;
6167 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
6168 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
6169 *dst = pixel;
6170 posx += incx;
6171 ++dst;
6172 }
6173 posy += incy;
6174 info->dst += info->dst_pitch;
6175 }
6176 }
6177
6178 static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info)
6179 {
6180 const int flags = info->flags;
6181 Uint32 srcpixel;
6182 Uint32 srcR, srcG, srcB, srcA;
6183 Uint32 dstpixel;
6184 Uint32 dstR, dstG, dstB, dstA;
6185
6186 while (info->dst_h--) {
6187 Uint32 *src = (Uint32 *)info->src;
6188 Uint32 *dst = (Uint32 *)info->dst;
6189 int n = info->dst_w;
6190 while (n--) {
6191 srcpixel = *src;
6192 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
6193 dstpixel = *dst;
6194 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6195 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6196 /* This goes away if we ever use premultiplied alpha */
6197 if (srcA < 255) {
6198 srcR = (srcR * srcA) / 255;
6199 srcG = (srcG * srcA) / 255;
6200 srcB = (srcB * srcA) / 255;
6201 }
6202 }
6203 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6204 case SDL_COPY_MASK:
6205 if (srcA) {
6206 dstR = srcR;
6207 dstG = srcG;
6208 dstB = srcB;
6209 }
6210 break;
6211 case SDL_COPY_BLEND:
6212 dstR = srcR + ((255 - srcA) * dstR) / 255;
6213 dstG = srcG + ((255 - srcA) * dstG) / 255;
6214 dstB = srcB + ((255 - srcA) * dstB) / 255;
6215 break;
6216 case SDL_COPY_ADD:
6217 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6218 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6219 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6220 break;
6221 case SDL_COPY_MOD:
6222 dstR = (srcR * dstR) / 255;
6223 dstG = (srcG * dstG) / 255;
6224 dstB = (srcB * dstB) / 255;
6225 break;
6226 }
6227 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6228 *dst = dstpixel;
6229 ++src;
6230 ++dst;
6231 }
6232 info->src += info->src_pitch;
6233 info->dst += info->dst_pitch;
6234 }
6235 }
6236
6237 static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
6238 {
6239 const int flags = info->flags;
6240 Uint32 srcpixel;
6241 Uint32 srcR, srcG, srcB, srcA;
6242 Uint32 dstpixel;
6243 Uint32 dstR, dstG, dstB, dstA;
6244 int srcy, srcx;
6245 int posy, posx;
6246 int incy, incx;
6247
6248 srcy = 0;
6249 posy = 0;
6250 incy = (info->src_h << 16) / info->dst_h;
6251 incx = (info->src_w << 16) / info->dst_w;
6252
6253 while (info->dst_h--) {
6254 Uint32 *src;
6255 Uint32 *dst = (Uint32 *)info->dst;
6256 int n = info->dst_w;
6257 srcx = -1;
6258 posx = 0x10000L;
6259 while (posy >= 0x10000L) {
6260 ++srcy;
6261 posy -= 0x10000L;
6262 }
6263 while (n--) {
6264 if (posx >= 0x10000L) {
6265 while (posx >= 0x10000L) {
6266 ++srcx;
6267 posx -= 0x10000L;
6268 }
6269 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6270 }
6271 srcpixel = *src;
6272 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
6273 dstpixel = *dst;
6274 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6275 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6276 /* This goes away if we ever use premultiplied alpha */
6277 if (srcA < 255) {
6278 srcR = (srcR * srcA) / 255;
6279 srcG = (srcG * srcA) / 255;
6280 srcB = (srcB * srcA) / 255;
6281 }
6282 }
6283 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6284 case SDL_COPY_MASK:
6285 if (srcA) {
6286 dstR = srcR;
6287 dstG = srcG;
6288 dstB = srcB;
6289 }
6290 break;
6291 case SDL_COPY_BLEND:
6292 dstR = srcR + ((255 - srcA) * dstR) / 255;
6293 dstG = srcG + ((255 - srcA) * dstG) / 255;
6294 dstB = srcB + ((255 - srcA) * dstB) / 255;
6295 break;
6296 case SDL_COPY_ADD:
6297 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6298 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6299 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6300 break;
6301 case SDL_COPY_MOD:
6302 dstR = (srcR * dstR) / 255;
6303 dstG = (srcG * dstG) / 255;
6304 dstB = (srcB * dstB) / 255;
6305 break;
6306 }
6307 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6308 *dst = dstpixel;
6309 posx += incx;
6310 ++dst;
6311 }
6312 posy += incy;
6313 info->dst += info->dst_pitch;
6314 }
6315 }
6316
6317 static void SDL_Blit_ABGR8888_ARGB8888_Modulate(SDL_BlitInfo *info)
6318 {
6319 const int flags = info->flags;
6320 const Uint32 modulateR = info->r;
6321 const Uint32 modulateG = info->g;
6322 const Uint32 modulateB = info->b;
6323 const Uint32 modulateA = info->a;
6324 Uint32 pixel;
6325 Uint32 R, G, B, A;
6326
6327 while (info->dst_h--) {
6328 Uint32 *src = (Uint32 *)info->src;
6329 Uint32 *dst = (Uint32 *)info->dst;
6330 int n = info->dst_w;
6331 while (n--) {
6332 pixel = *src;
6333 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
6334 if (flags & SDL_COPY_MODULATE_COLOR) {
6335 R = (R * modulateR) / 255;
6336 G = (G * modulateG) / 255;
6337 B = (B * modulateB) / 255;
6338 }
6339 if (flags & SDL_COPY_MODULATE_ALPHA) {
6340 A = (A * modulateA) / 255;
6341 }
6342 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
6343 *dst = pixel;
6344 ++src;
6345 ++dst;
6346 }
6347 info->src += info->src_pitch;
6348 info->dst += info->dst_pitch;
6349 }
6350 }
6351
6352 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
6353 {
6354 const int flags = info->flags;
6355 const Uint32 modulateR = info->r;
6356 const Uint32 modulateG = info->g;
6357 const Uint32 modulateB = info->b;
6358 const Uint32 modulateA = info->a;
6359 Uint32 pixel;
6360 Uint32 R, G, B, A;
6361 int srcy, srcx;
6362 int posy, posx;
6363 int incy, incx;
6364
6365 srcy = 0;
6366 posy = 0;
6367 incy = (info->src_h << 16) / info->dst_h;
6368 incx = (info->src_w << 16) / info->dst_w;
6369
6370 while (info->dst_h--) {
6371 Uint32 *src;
6372 Uint32 *dst = (Uint32 *)info->dst;
6373 int n = info->dst_w;
6374 srcx = -1;
6375 posx = 0x10000L;
6376 while (posy >= 0x10000L) {
6377 ++srcy;
6378 posy -= 0x10000L;
6379 }
6380 while (n--) {
6381 if (posx >= 0x10000L) {
6382 while (posx >= 0x10000L) {
6383 ++srcx;
6384 posx -= 0x10000L;
6385 }
6386 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6387 }
6388 pixel = *src;
6389 A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
6390 if (flags & SDL_COPY_MODULATE_COLOR) {
6391 R = (R * modulateR) / 255;
6392 G = (G * modulateG) / 255;
6393 B = (B * modulateB) / 255;
6394 }
6395 if (flags & SDL_COPY_MODULATE_ALPHA) {
6396 A = (A * modulateA) / 255;
6397 }
6398 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
6399 *dst = pixel;
6400 posx += incx;
6401 ++dst;
6402 }
6403 posy += incy;
6404 info->dst += info->dst_pitch;
6405 }
6406 }
6407
6408 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
6409 {
6410 const int flags = info->flags;
6411 const Uint32 modulateR = info->r;
6412 const Uint32 modulateG = info->g;
6413 const Uint32 modulateB = info->b;
6414 const Uint32 modulateA = info->a;
6415 Uint32 srcpixel;
6416 Uint32 srcR, srcG, srcB, srcA;
6417 Uint32 dstpixel;
6418 Uint32 dstR, dstG, dstB, dstA;
6419
6420 while (info->dst_h--) {
6421 Uint32 *src = (Uint32 *)info->src;
6422 Uint32 *dst = (Uint32 *)info->dst;
6423 int n = info->dst_w;
6424 while (n--) {
6425 srcpixel = *src;
6426 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
6427 dstpixel = *dst;
6428 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6429 if (flags & SDL_COPY_MODULATE_COLOR) {
6430 srcR = (srcR * modulateR) / 255;
6431 srcG = (srcG * modulateG) / 255;
6432 srcB = (srcB * modulateB) / 255;
6433 }
6434 if (flags & SDL_COPY_MODULATE_ALPHA) {
6435 srcA = (srcA * modulateA) / 255;
6436 }
6437 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6438 /* This goes away if we ever use premultiplied alpha */
6439 if (srcA < 255) {
6440 srcR = (srcR * srcA) / 255;
6441 srcG = (srcG * srcA) / 255;
6442 srcB = (srcB * srcA) / 255;
6443 }
6444 }
6445 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6446 case SDL_COPY_MASK:
6447 if (srcA) {
6448 dstR = srcR;
6449 dstG = srcG;
6450 dstB = srcB;
6451 }
6452 break;
6453 case SDL_COPY_BLEND:
6454 dstR = srcR + ((255 - srcA) * dstR) / 255;
6455 dstG = srcG + ((255 - srcA) * dstG) / 255;
6456 dstB = srcB + ((255 - srcA) * dstB) / 255;
6457 break;
6458 case SDL_COPY_ADD:
6459 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6460 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6461 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6462 break;
6463 case SDL_COPY_MOD:
6464 dstR = (srcR * dstR) / 255;
6465 dstG = (srcG * dstG) / 255;
6466 dstB = (srcB * dstB) / 255;
6467 break;
6468 }
6469 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6470 *dst = dstpixel;
6471 ++src;
6472 ++dst;
6473 }
6474 info->src += info->src_pitch;
6475 info->dst += info->dst_pitch;
6476 }
6477 }
6478
6479 static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
6480 {
6481 const int flags = info->flags;
6482 const Uint32 modulateR = info->r;
6483 const Uint32 modulateG = info->g;
6484 const Uint32 modulateB = info->b;
6485 const Uint32 modulateA = info->a;
6486 Uint32 srcpixel;
6487 Uint32 srcR, srcG, srcB, srcA;
6488 Uint32 dstpixel;
6489 Uint32 dstR, dstG, dstB, dstA;
6490 int srcy, srcx;
6491 int posy, posx;
6492 int incy, incx;
6493
6494 srcy = 0;
6495 posy = 0;
6496 incy = (info->src_h << 16) / info->dst_h;
6497 incx = (info->src_w << 16) / info->dst_w;
6498
6499 while (info->dst_h--) {
6500 Uint32 *src;
6501 Uint32 *dst = (Uint32 *)info->dst;
6502 int n = info->dst_w;
6503 srcx = -1;
6504 posx = 0x10000L;
6505 while (posy >= 0x10000L) {
6506 ++srcy;
6507 posy -= 0x10000L;
6508 }
6509 while (n--) {
6510 if (posx >= 0x10000L) {
6511 while (posx >= 0x10000L) {
6512 ++srcx;
6513 posx -= 0x10000L;
6514 }
6515 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6516 }
6517 srcpixel = *src;
6518 srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
6519 dstpixel = *dst;
6520 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
6521 if (flags & SDL_COPY_MODULATE_COLOR) {
6522 srcR = (srcR * modulateR) / 255;
6523 srcG = (srcG * modulateG) / 255;
6524 srcB = (srcB * modulateB) / 255;
6525 }
6526 if (flags & SDL_COPY_MODULATE_ALPHA) {
6527 srcA = (srcA * modulateA) / 255;
6528 }
6529 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6530 /* This goes away if we ever use premultiplied alpha */
6531 if (srcA < 255) {
6532 srcR = (srcR * srcA) / 255;
6533 srcG = (srcG * srcA) / 255;
6534 srcB = (srcB * srcA) / 255;
6535 }
6536 }
6537 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6538 case SDL_COPY_MASK:
6539 if (srcA) {
6540 dstR = srcR;
6541 dstG = srcG;
6542 dstB = srcB;
6543 }
6544 break;
6545 case SDL_COPY_BLEND:
6546 dstR = srcR + ((255 - srcA) * dstR) / 255;
6547 dstG = srcG + ((255 - srcA) * dstG) / 255;
6548 dstB = srcB + ((255 - srcA) * dstB) / 255;
6549 break;
6550 case SDL_COPY_ADD:
6551 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6552 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6553 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6554 break;
6555 case SDL_COPY_MOD:
6556 dstR = (srcR * dstR) / 255;
6557 dstG = (srcG * dstG) / 255;
6558 dstB = (srcB * dstB) / 255;
6559 break;
6560 }
6561 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6562 *dst = dstpixel;
6563 posx += incx;
6564 ++dst;
6565 }
6566 posy += incy;
6567 info->dst += info->dst_pitch;
6568 }
6569 }
6570
6571 static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info)
6572 {
6573 const int flags = info->flags;
6574 Uint32 pixel;
6575 Uint32 R, G, B, A;
6576 int srcy, srcx;
6577 int posy, posx;
6578 int incy, incx;
6579
6580 srcy = 0;
6581 posy = 0;
6582 incy = (info->src_h << 16) / info->dst_h;
6583 incx = (info->src_w << 16) / info->dst_w;
6584
6585 while (info->dst_h--) {
6586 Uint32 *src;
6587 Uint32 *dst = (Uint32 *)info->dst;
6588 int n = info->dst_w;
6589 srcx = -1;
6590 posx = 0x10000L;
6591 while (posy >= 0x10000L) {
6592 ++srcy;
6593 posy -= 0x10000L;
6594 }
6595 while (n--) {
6596 if (posx >= 0x10000L) {
6597 while (posx >= 0x10000L) {
6598 ++srcx;
6599 posx -= 0x10000L;
6600 }
6601 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6602 }
6603 pixel = *src;
6604 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
6605 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
6606 *dst = pixel;
6607 posx += incx;
6608 ++dst;
6609 }
6610 posy += incy;
6611 info->dst += info->dst_pitch;
6612 }
6613 }
6614
6615 static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info)
6616 {
6617 const int flags = info->flags;
6618 Uint32 srcpixel;
6619 Uint32 srcR, srcG, srcB, srcA;
6620 Uint32 dstpixel;
6621 Uint32 dstR, dstG, dstB, dstA;
6622
6623 while (info->dst_h--) {
6624 Uint32 *src = (Uint32 *)info->src;
6625 Uint32 *dst = (Uint32 *)info->dst;
6626 int n = info->dst_w;
6627 while (n--) {
6628 srcpixel = *src;
6629 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6630 dstpixel = *dst;
6631 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
6632 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6633 /* This goes away if we ever use premultiplied alpha */
6634 if (srcA < 255) {
6635 srcR = (srcR * srcA) / 255;
6636 srcG = (srcG * srcA) / 255;
6637 srcB = (srcB * srcA) / 255;
6638 }
6639 }
6640 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6641 case SDL_COPY_MASK:
6642 if (srcA) {
6643 dstR = srcR;
6644 dstG = srcG;
6645 dstB = srcB;
6646 }
6647 break;
6648 case SDL_COPY_BLEND:
6649 dstR = srcR + ((255 - srcA) * dstR) / 255;
6650 dstG = srcG + ((255 - srcA) * dstG) / 255;
6651 dstB = srcB + ((255 - srcA) * dstB) / 255;
6652 break;
6653 case SDL_COPY_ADD:
6654 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6655 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6656 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6657 break;
6658 case SDL_COPY_MOD:
6659 dstR = (srcR * dstR) / 255;
6660 dstG = (srcG * dstG) / 255;
6661 dstB = (srcB * dstB) / 255;
6662 break;
6663 }
6664 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6665 *dst = dstpixel;
6666 ++src;
6667 ++dst;
6668 }
6669 info->src += info->src_pitch;
6670 info->dst += info->dst_pitch;
6671 }
6672 }
6673
6674 static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
6675 {
6676 const int flags = info->flags;
6677 Uint32 srcpixel;
6678 Uint32 srcR, srcG, srcB, srcA;
6679 Uint32 dstpixel;
6680 Uint32 dstR, dstG, dstB, dstA;
6681 int srcy, srcx;
6682 int posy, posx;
6683 int incy, incx;
6684
6685 srcy = 0;
6686 posy = 0;
6687 incy = (info->src_h << 16) / info->dst_h;
6688 incx = (info->src_w << 16) / info->dst_w;
6689
6690 while (info->dst_h--) {
6691 Uint32 *src;
6692 Uint32 *dst = (Uint32 *)info->dst;
6693 int n = info->dst_w;
6694 srcx = -1;
6695 posx = 0x10000L;
6696 while (posy >= 0x10000L) {
6697 ++srcy;
6698 posy -= 0x10000L;
6699 }
6700 while (n--) {
6701 if (posx >= 0x10000L) {
6702 while (posx >= 0x10000L) {
6703 ++srcx;
6704 posx -= 0x10000L;
6705 }
6706 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6707 }
6708 srcpixel = *src;
6709 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6710 dstpixel = *dst;
6711 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
6712 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6713 /* This goes away if we ever use premultiplied alpha */
6714 if (srcA < 255) {
6715 srcR = (srcR * srcA) / 255;
6716 srcG = (srcG * srcA) / 255;
6717 srcB = (srcB * srcA) / 255;
6718 }
6719 }
6720 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6721 case SDL_COPY_MASK:
6722 if (srcA) {
6723 dstR = srcR;
6724 dstG = srcG;
6725 dstB = srcB;
6726 }
6727 break;
6728 case SDL_COPY_BLEND:
6729 dstR = srcR + ((255 - srcA) * dstR) / 255;
6730 dstG = srcG + ((255 - srcA) * dstG) / 255;
6731 dstB = srcB + ((255 - srcA) * dstB) / 255;
6732 break;
6733 case SDL_COPY_ADD:
6734 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6735 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6736 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6737 break;
6738 case SDL_COPY_MOD:
6739 dstR = (srcR * dstR) / 255;
6740 dstG = (srcG * dstG) / 255;
6741 dstB = (srcB * dstB) / 255;
6742 break;
6743 }
6744 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6745 *dst = dstpixel;
6746 posx += incx;
6747 ++dst;
6748 }
6749 posy += incy;
6750 info->dst += info->dst_pitch;
6751 }
6752 }
6753
6754 static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info)
6755 {
6756 const int flags = info->flags;
6757 const Uint32 modulateR = info->r;
6758 const Uint32 modulateG = info->g;
6759 const Uint32 modulateB = info->b;
6760 const Uint32 modulateA = info->a;
6761 Uint32 pixel;
6762 Uint32 R, G, B, A;
6763
6764 while (info->dst_h--) {
6765 Uint32 *src = (Uint32 *)info->src;
6766 Uint32 *dst = (Uint32 *)info->dst;
6767 int n = info->dst_w;
6768 while (n--) {
6769 pixel = *src;
6770 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
6771 if (flags & SDL_COPY_MODULATE_COLOR) {
6772 R = (R * modulateR) / 255;
6773 G = (G * modulateG) / 255;
6774 B = (B * modulateB) / 255;
6775 }
6776 if (flags & SDL_COPY_MODULATE_ALPHA) {
6777 A = (A * modulateA) / 255;
6778 }
6779 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
6780 *dst = pixel;
6781 ++src;
6782 ++dst;
6783 }
6784 info->src += info->src_pitch;
6785 info->dst += info->dst_pitch;
6786 }
6787 }
6788
6789 static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
6790 {
6791 const int flags = info->flags;
6792 const Uint32 modulateR = info->r;
6793 const Uint32 modulateG = info->g;
6794 const Uint32 modulateB = info->b;
6795 const Uint32 modulateA = info->a;
6796 Uint32 pixel;
6797 Uint32 R, G, B, A;
6798 int srcy, srcx;
6799 int posy, posx;
6800 int incy, incx;
6801
6802 srcy = 0;
6803 posy = 0;
6804 incy = (info->src_h << 16) / info->dst_h;
6805 incx = (info->src_w << 16) / info->dst_w;
6806
6807 while (info->dst_h--) {
6808 Uint32 *src;
6809 Uint32 *dst = (Uint32 *)info->dst;
6810 int n = info->dst_w;
6811 srcx = -1;
6812 posx = 0x10000L;
6813 while (posy >= 0x10000L) {
6814 ++srcy;
6815 posy -= 0x10000L;
6816 }
6817 while (n--) {
6818 if (posx >= 0x10000L) {
6819 while (posx >= 0x10000L) {
6820 ++srcx;
6821 posx -= 0x10000L;
6822 }
6823 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6824 }
6825 pixel = *src;
6826 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
6827 if (flags & SDL_COPY_MODULATE_COLOR) {
6828 R = (R * modulateR) / 255;
6829 G = (G * modulateG) / 255;
6830 B = (B * modulateB) / 255;
6831 }
6832 if (flags & SDL_COPY_MODULATE_ALPHA) {
6833 A = (A * modulateA) / 255;
6834 }
6835 pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
6836 *dst = pixel;
6837 posx += incx;
6838 ++dst;
6839 }
6840 posy += incy;
6841 info->dst += info->dst_pitch;
6842 }
6843 }
6844
6845 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
6846 {
6847 const int flags = info->flags;
6848 const Uint32 modulateR = info->r;
6849 const Uint32 modulateG = info->g;
6850 const Uint32 modulateB = info->b;
6851 const Uint32 modulateA = info->a;
6852 Uint32 srcpixel;
6853 Uint32 srcR, srcG, srcB, srcA;
6854 Uint32 dstpixel;
6855 Uint32 dstR, dstG, dstB, dstA;
6856
6857 while (info->dst_h--) {
6858 Uint32 *src = (Uint32 *)info->src;
6859 Uint32 *dst = (Uint32 *)info->dst;
6860 int n = info->dst_w;
6861 while (n--) {
6862 srcpixel = *src;
6863 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6864 dstpixel = *dst;
6865 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
6866 if (flags & SDL_COPY_MODULATE_COLOR) {
6867 srcR = (srcR * modulateR) / 255;
6868 srcG = (srcG * modulateG) / 255;
6869 srcB = (srcB * modulateB) / 255;
6870 }
6871 if (flags & SDL_COPY_MODULATE_ALPHA) {
6872 srcA = (srcA * modulateA) / 255;
6873 }
6874 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6875 /* This goes away if we ever use premultiplied alpha */
6876 if (srcA < 255) {
6877 srcR = (srcR * srcA) / 255;
6878 srcG = (srcG * srcA) / 255;
6879 srcB = (srcB * srcA) / 255;
6880 }
6881 }
6882 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6883 case SDL_COPY_MASK:
6884 if (srcA) {
6885 dstR = srcR;
6886 dstG = srcG;
6887 dstB = srcB;
6888 }
6889 break;
6890 case SDL_COPY_BLEND:
6891 dstR = srcR + ((255 - srcA) * dstR) / 255;
6892 dstG = srcG + ((255 - srcA) * dstG) / 255;
6893 dstB = srcB + ((255 - srcA) * dstB) / 255;
6894 break;
6895 case SDL_COPY_ADD:
6896 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6897 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6898 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6899 break;
6900 case SDL_COPY_MOD:
6901 dstR = (srcR * dstR) / 255;
6902 dstG = (srcG * dstG) / 255;
6903 dstB = (srcB * dstB) / 255;
6904 break;
6905 }
6906 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6907 *dst = dstpixel;
6908 ++src;
6909 ++dst;
6910 }
6911 info->src += info->src_pitch;
6912 info->dst += info->dst_pitch;
6913 }
6914 }
6915
6916 static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
6917 {
6918 const int flags = info->flags;
6919 const Uint32 modulateR = info->r;
6920 const Uint32 modulateG = info->g;
6921 const Uint32 modulateB = info->b;
6922 const Uint32 modulateA = info->a;
6923 Uint32 srcpixel;
6924 Uint32 srcR, srcG, srcB, srcA;
6925 Uint32 dstpixel;
6926 Uint32 dstR, dstG, dstB, dstA;
6927 int srcy, srcx;
6928 int posy, posx;
6929 int incy, incx;
6930
6931 srcy = 0;
6932 posy = 0;
6933 incy = (info->src_h << 16) / info->dst_h;
6934 incx = (info->src_w << 16) / info->dst_w;
6935
6936 while (info->dst_h--) {
6937 Uint32 *src;
6938 Uint32 *dst = (Uint32 *)info->dst;
6939 int n = info->dst_w;
6940 srcx = -1;
6941 posx = 0x10000L;
6942 while (posy >= 0x10000L) {
6943 ++srcy;
6944 posy -= 0x10000L;
6945 }
6946 while (n--) {
6947 if (posx >= 0x10000L) {
6948 while (posx >= 0x10000L) {
6949 ++srcx;
6950 posx -= 0x10000L;
6951 }
6952 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
6953 }
6954 srcpixel = *src;
6955 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
6956 dstpixel = *dst;
6957 dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
6958 if (flags & SDL_COPY_MODULATE_COLOR) {
6959 srcR = (srcR * modulateR) / 255;
6960 srcG = (srcG * modulateG) / 255;
6961 srcB = (srcB * modulateB) / 255;
6962 }
6963 if (flags & SDL_COPY_MODULATE_ALPHA) {
6964 srcA = (srcA * modulateA) / 255;
6965 }
6966 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
6967 /* This goes away if we ever use premultiplied alpha */
6968 if (srcA < 255) {
6969 srcR = (srcR * srcA) / 255;
6970 srcG = (srcG * srcA) / 255;
6971 srcB = (srcB * srcA) / 255;
6972 }
6973 }
6974 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
6975 case SDL_COPY_MASK:
6976 if (srcA) {
6977 dstR = srcR;
6978 dstG = srcG;
6979 dstB = srcB;
6980 }
6981 break;
6982 case SDL_COPY_BLEND:
6983 dstR = srcR + ((255 - srcA) * dstR) / 255;
6984 dstG = srcG + ((255 - srcA) * dstG) / 255;
6985 dstB = srcB + ((255 - srcA) * dstB) / 255;
6986 break;
6987 case SDL_COPY_ADD:
6988 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
6989 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
6990 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
6991 break;
6992 case SDL_COPY_MOD:
6993 dstR = (srcR * dstR) / 255;
6994 dstG = (srcG * dstG) / 255;
6995 dstB = (srcB * dstB) / 255;
6996 break;
6997 }
6998 dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
6999 *dst = dstpixel;
7000 posx += incx;
7001 ++dst;
7002 }
7003 posy += incy;
7004 info->dst += info->dst_pitch;
7005 }
7006 }
7007
7008 static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info)
7009 {
7010 const int flags = info->flags;
7011 Uint32 pixel;
7012 Uint32 R, G, B, A;
7013 int srcy, srcx;
7014 int posy, posx;
7015 int incy, incx;
7016
7017 srcy = 0;
7018 posy = 0;
7019 incy = (info->src_h << 16) / info->dst_h;
7020 incx = (info->src_w << 16) / info->dst_w;
7021
7022 while (info->dst_h--) {
7023 Uint32 *src;
7024 Uint32 *dst = (Uint32 *)info->dst;
7025 int n = info->dst_w;
7026 srcx = -1;
7027 posx = 0x10000L;
7028 while (posy >= 0x10000L) {
7029 ++srcy;
7030 posy -= 0x10000L;
7031 }
7032 while (n--) {
7033 if (posx >= 0x10000L) {
7034 while (posx >= 0x10000L) {
7035 ++srcx;
7036 posx -= 0x10000L;
7037 }
7038 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7039 }
7040 pixel = *src;
7041 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7042 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
7043 *dst = pixel;
7044 posx += incx;
7045 ++dst;
7046 }
7047 posy += incy;
7048 info->dst += info->dst_pitch;
7049 }
7050 }
7051
7052 static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info)
7053 {
7054 const int flags = info->flags;
7055 Uint32 srcpixel;
7056 Uint32 srcR, srcG, srcB, srcA;
7057 Uint32 dstpixel;
7058 Uint32 dstR, dstG, dstB, dstA;
7059
7060 while (info->dst_h--) {
7061 Uint32 *src = (Uint32 *)info->src;
7062 Uint32 *dst = (Uint32 *)info->dst;
7063 int n = info->dst_w;
7064 while (n--) {
7065 srcpixel = *src;
7066 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7067 dstpixel = *dst;
7068 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
7069 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7070 /* This goes away if we ever use premultiplied alpha */
7071 if (srcA < 255) {
7072 srcR = (srcR * srcA) / 255;
7073 srcG = (srcG * srcA) / 255;
7074 srcB = (srcB * srcA) / 255;
7075 }
7076 }
7077 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
7078 case SDL_COPY_MASK:
7079 if (srcA) {
7080 dstR = srcR;
7081 dstG = srcG;
7082 dstB = srcB;
7083 }
7084 break;
7085 case SDL_COPY_BLEND:
7086 dstR = srcR + ((255 - srcA) * dstR) / 255;
7087 dstG = srcG + ((255 - srcA) * dstG) / 255;
7088 dstB = srcB + ((255 - srcA) * dstB) / 255;
7089 break;
7090 case SDL_COPY_ADD:
7091 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7092 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7093 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7094 break;
7095 case SDL_COPY_MOD:
7096 dstR = (srcR * dstR) / 255;
7097 dstG = (srcG * dstG) / 255;
7098 dstB = (srcB * dstB) / 255;
7099 break;
7100 }
7101 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
7102 *dst = dstpixel;
7103 ++src;
7104 ++dst;
7105 }
7106 info->src += info->src_pitch;
7107 info->dst += info->dst_pitch;
7108 }
7109 }
7110
7111 static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
7112 {
7113 const int flags = info->flags;
7114 Uint32 srcpixel;
7115 Uint32 srcR, srcG, srcB, srcA;
7116 Uint32 dstpixel;
7117 Uint32 dstR, dstG, dstB, dstA;
7118 int srcy, srcx;
7119 int posy, posx;
7120 int incy, incx;
7121
7122 srcy = 0;
7123 posy = 0;
7124 incy = (info->src_h << 16) / info->dst_h;
7125 incx = (info->src_w << 16) / info->dst_w;
7126
7127 while (info->dst_h--) {
7128 Uint32 *src;
7129 Uint32 *dst = (Uint32 *)info->dst;
7130 int n = info->dst_w;
7131 srcx = -1;
7132 posx = 0x10000L;
7133 while (posy >= 0x10000L) {
7134 ++srcy;
7135 posy -= 0x10000L;
7136 }
7137 while (n--) {
7138 if (posx >= 0x10000L) {
7139 while (posx >= 0x10000L) {
7140 ++srcx;
7141 posx -= 0x10000L;
7142 }
7143 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7144 }
7145 srcpixel = *src;
7146 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7147 dstpixel = *dst;
7148 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
7149 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7150 /* This goes away if we ever use premultiplied alpha */
7151 if (srcA < 255) {
7152 srcR = (srcR * srcA) / 255;
7153 srcG = (srcG * srcA) / 255;
7154 srcB = (srcB * srcA) / 255;
7155 }
7156 }
7157 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
7158 case SDL_COPY_MASK:
7159 if (srcA) {
7160 dstR = srcR;
7161 dstG = srcG;
7162 dstB = srcB;
7163 }
7164 break;
7165 case SDL_COPY_BLEND:
7166 dstR = srcR + ((255 - srcA) * dstR) / 255;
7167 dstG = srcG + ((255 - srcA) * dstG) / 255;
7168 dstB = srcB + ((255 - srcA) * dstB) / 255;
7169 break;
7170 case SDL_COPY_ADD:
7171 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7172 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7173 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7174 break;
7175 case SDL_COPY_MOD:
7176 dstR = (srcR * dstR) / 255;
7177 dstG = (srcG * dstG) / 255;
7178 dstB = (srcB * dstB) / 255;
7179 break;
7180 }
7181 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
7182 *dst = dstpixel;
7183 posx += incx;
7184 ++dst;
7185 }
7186 posy += incy;
7187 info->dst += info->dst_pitch;
7188 }
7189 }
7190
7191 static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info)
7192 {
7193 const int flags = info->flags;
7194 const Uint32 modulateR = info->r;
7195 const Uint32 modulateG = info->g;
7196 const Uint32 modulateB = info->b;
7197 const Uint32 modulateA = info->a;
7198 Uint32 pixel;
7199 Uint32 R, G, B, A;
7200
7201 while (info->dst_h--) {
7202 Uint32 *src = (Uint32 *)info->src;
7203 Uint32 *dst = (Uint32 *)info->dst;
7204 int n = info->dst_w;
7205 while (n--) {
7206 pixel = *src;
7207 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7208 if (flags & SDL_COPY_MODULATE_COLOR) {
7209 R = (R * modulateR) / 255;
7210 G = (G * modulateG) / 255;
7211 B = (B * modulateB) / 255;
7212 }
7213 if (flags & SDL_COPY_MODULATE_ALPHA) {
7214 A = (A * modulateA) / 255;
7215 }
7216 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
7217 *dst = pixel;
7218 ++src;
7219 ++dst;
7220 }
7221 info->src += info->src_pitch;
7222 info->dst += info->dst_pitch;
7223 }
7224 }
7225
7226 static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
7227 {
7228 const int flags = info->flags;
7229 const Uint32 modulateR = info->r;
7230 const Uint32 modulateG = info->g;
7231 const Uint32 modulateB = info->b;
7232 const Uint32 modulateA = info->a;
7233 Uint32 pixel;
7234 Uint32 R, G, B, A;
7235 int srcy, srcx;
7236 int posy, posx;
7237 int incy, incx;
7238
7239 srcy = 0;
7240 posy = 0;
7241 incy = (info->src_h << 16) / info->dst_h;
7242 incx = (info->src_w << 16) / info->dst_w;
7243
7244 while (info->dst_h--) {
7245 Uint32 *src;
7246 Uint32 *dst = (Uint32 *)info->dst;
7247 int n = info->dst_w;
7248 srcx = -1;
7249 posx = 0x10000L;
7250 while (posy >= 0x10000L) {
7251 ++srcy;
7252 posy -= 0x10000L;
7253 }
7254 while (n--) {
7255 if (posx >= 0x10000L) {
7256 while (posx >= 0x10000L) {
7257 ++srcx;
7258 posx -= 0x10000L;
7259 }
7260 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7261 }
7262 pixel = *src;
7263 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7264 if (flags & SDL_COPY_MODULATE_COLOR) {
7265 R = (R * modulateR) / 255;
7266 G = (G * modulateG) / 255;
7267 B = (B * modulateB) / 255;
7268 }
7269 if (flags & SDL_COPY_MODULATE_ALPHA) {
7270 A = (A * modulateA) / 255;
7271 }
7272 pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
7273 *dst = pixel;
7274 posx += incx;
7275 ++dst;
7276 }
7277 posy += incy;
7278 info->dst += info->dst_pitch;
7279 }
7280 }
7281
7282 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
7283 {
7284 const int flags = info->flags;
7285 const Uint32 modulateR = info->r;
7286 const Uint32 modulateG = info->g;
7287 const Uint32 modulateB = info->b;
7288 const Uint32 modulateA = info->a;
7289 Uint32 srcpixel;
7290 Uint32 srcR, srcG, srcB, srcA;
7291 Uint32 dstpixel;
7292 Uint32 dstR, dstG, dstB, dstA;
7293
7294 while (info->dst_h--) {
7295 Uint32 *src = (Uint32 *)info->src;
7296 Uint32 *dst = (Uint32 *)info->dst;
7297 int n = info->dst_w;
7298 while (n--) {
7299 srcpixel = *src;
5212 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel; 7300 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
5213 dstpixel = *dst; 7301 dstpixel = *dst;
5214 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF; 7302 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
5215 if (flags & SDL_COPY_MODULATE_COLOR) { 7303 if (flags & SDL_COPY_MODULATE_COLOR) {
5216 srcR = (srcR * modulateR) / 255; 7304 srcR = (srcR * modulateR) / 255;
5251 dstG = (srcG * dstG) / 255; 7339 dstG = (srcG * dstG) / 255;
5252 dstB = (srcB * dstB) / 255; 7340 dstB = (srcB * dstB) / 255;
5253 break; 7341 break;
5254 } 7342 }
5255 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR; 7343 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
7344 *dst = dstpixel;
7345 ++src;
7346 ++dst;
7347 }
7348 info->src += info->src_pitch;
7349 info->dst += info->dst_pitch;
7350 }
7351 }
7352
7353 static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
7354 {
7355 const int flags = info->flags;
7356 const Uint32 modulateR = info->r;
7357 const Uint32 modulateG = info->g;
7358 const Uint32 modulateB = info->b;
7359 const Uint32 modulateA = info->a;
7360 Uint32 srcpixel;
7361 Uint32 srcR, srcG, srcB, srcA;
7362 Uint32 dstpixel;
7363 Uint32 dstR, dstG, dstB, dstA;
7364 int srcy, srcx;
7365 int posy, posx;
7366 int incy, incx;
7367
7368 srcy = 0;
7369 posy = 0;
7370 incy = (info->src_h << 16) / info->dst_h;
7371 incx = (info->src_w << 16) / info->dst_w;
7372
7373 while (info->dst_h--) {
7374 Uint32 *src;
7375 Uint32 *dst = (Uint32 *)info->dst;
7376 int n = info->dst_w;
7377 srcx = -1;
7378 posx = 0x10000L;
7379 while (posy >= 0x10000L) {
7380 ++srcy;
7381 posy -= 0x10000L;
7382 }
7383 while (n--) {
7384 if (posx >= 0x10000L) {
7385 while (posx >= 0x10000L) {
7386 ++srcx;
7387 posx -= 0x10000L;
7388 }
7389 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7390 }
7391 srcpixel = *src;
7392 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7393 dstpixel = *dst;
7394 dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
7395 if (flags & SDL_COPY_MODULATE_COLOR) {
7396 srcR = (srcR * modulateR) / 255;
7397 srcG = (srcG * modulateG) / 255;
7398 srcB = (srcB * modulateB) / 255;
7399 }
7400 if (flags & SDL_COPY_MODULATE_ALPHA) {
7401 srcA = (srcA * modulateA) / 255;
7402 }
7403 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7404 /* This goes away if we ever use premultiplied alpha */
7405 if (srcA < 255) {
7406 srcR = (srcR * srcA) / 255;
7407 srcG = (srcG * srcA) / 255;
7408 srcB = (srcB * srcA) / 255;
7409 }
7410 }
7411 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
7412 case SDL_COPY_MASK:
7413 if (srcA) {
7414 dstR = srcR;
7415 dstG = srcG;
7416 dstB = srcB;
7417 }
7418 break;
7419 case SDL_COPY_BLEND:
7420 dstR = srcR + ((255 - srcA) * dstR) / 255;
7421 dstG = srcG + ((255 - srcA) * dstG) / 255;
7422 dstB = srcB + ((255 - srcA) * dstB) / 255;
7423 break;
7424 case SDL_COPY_ADD:
7425 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7426 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7427 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7428 break;
7429 case SDL_COPY_MOD:
7430 dstR = (srcR * dstR) / 255;
7431 dstG = (srcG * dstG) / 255;
7432 dstB = (srcB * dstB) / 255;
7433 break;
7434 }
7435 dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
7436 *dst = dstpixel;
7437 posx += incx;
7438 ++dst;
7439 }
7440 posy += incy;
7441 info->dst += info->dst_pitch;
7442 }
7443 }
7444
7445 static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info)
7446 {
7447 const int flags = info->flags;
7448 Uint32 pixel;
7449 Uint32 R, G, B, A;
7450 int srcy, srcx;
7451 int posy, posx;
7452 int incy, incx;
7453
7454 srcy = 0;
7455 posy = 0;
7456 incy = (info->src_h << 16) / info->dst_h;
7457 incx = (info->src_w << 16) / info->dst_w;
7458
7459 while (info->dst_h--) {
7460 Uint32 *src;
7461 Uint32 *dst = (Uint32 *)info->dst;
7462 int n = info->dst_w;
7463 srcx = -1;
7464 posx = 0x10000L;
7465 while (posy >= 0x10000L) {
7466 ++srcy;
7467 posy -= 0x10000L;
7468 }
7469 while (n--) {
7470 if (posx >= 0x10000L) {
7471 while (posx >= 0x10000L) {
7472 ++srcx;
7473 posx -= 0x10000L;
7474 }
7475 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7476 }
7477 pixel = *src;
7478 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7479 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
7480 *dst = pixel;
7481 posx += incx;
7482 ++dst;
7483 }
7484 posy += incy;
7485 info->dst += info->dst_pitch;
7486 }
7487 }
7488
7489 static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info)
7490 {
7491 const int flags = info->flags;
7492 Uint32 srcpixel;
7493 Uint32 srcR, srcG, srcB, srcA;
7494 Uint32 dstpixel;
7495 Uint32 dstR, dstG, dstB, dstA;
7496
7497 while (info->dst_h--) {
7498 Uint32 *src = (Uint32 *)info->src;
7499 Uint32 *dst = (Uint32 *)info->dst;
7500 int n = info->dst_w;
7501 while (n--) {
7502 srcpixel = *src;
7503 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7504 dstpixel = *dst;
7505 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
7506 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7507 /* This goes away if we ever use premultiplied alpha */
7508 if (srcA < 255) {
7509 srcR = (srcR * srcA) / 255;
7510 srcG = (srcG * srcA) / 255;
7511 srcB = (srcB * srcA) / 255;
7512 }
7513 }
7514 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
7515 case SDL_COPY_MASK:
7516 if (srcA) {
7517 dstR = srcR;
7518 dstG = srcG;
7519 dstB = srcB;
7520 }
7521 break;
7522 case SDL_COPY_BLEND:
7523 dstR = srcR + ((255 - srcA) * dstR) / 255;
7524 dstG = srcG + ((255 - srcA) * dstG) / 255;
7525 dstB = srcB + ((255 - srcA) * dstB) / 255;
7526 break;
7527 case SDL_COPY_ADD:
7528 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7529 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7530 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7531 break;
7532 case SDL_COPY_MOD:
7533 dstR = (srcR * dstR) / 255;
7534 dstG = (srcG * dstG) / 255;
7535 dstB = (srcB * dstB) / 255;
7536 break;
7537 }
7538 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
7539 *dst = dstpixel;
7540 ++src;
7541 ++dst;
7542 }
7543 info->src += info->src_pitch;
7544 info->dst += info->dst_pitch;
7545 }
7546 }
7547
7548 static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
7549 {
7550 const int flags = info->flags;
7551 Uint32 srcpixel;
7552 Uint32 srcR, srcG, srcB, srcA;
7553 Uint32 dstpixel;
7554 Uint32 dstR, dstG, dstB, dstA;
7555 int srcy, srcx;
7556 int posy, posx;
7557 int incy, incx;
7558
7559 srcy = 0;
7560 posy = 0;
7561 incy = (info->src_h << 16) / info->dst_h;
7562 incx = (info->src_w << 16) / info->dst_w;
7563
7564 while (info->dst_h--) {
7565 Uint32 *src;
7566 Uint32 *dst = (Uint32 *)info->dst;
7567 int n = info->dst_w;
7568 srcx = -1;
7569 posx = 0x10000L;
7570 while (posy >= 0x10000L) {
7571 ++srcy;
7572 posy -= 0x10000L;
7573 }
7574 while (n--) {
7575 if (posx >= 0x10000L) {
7576 while (posx >= 0x10000L) {
7577 ++srcx;
7578 posx -= 0x10000L;
7579 }
7580 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7581 }
7582 srcpixel = *src;
7583 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7584 dstpixel = *dst;
7585 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
7586 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7587 /* This goes away if we ever use premultiplied alpha */
7588 if (srcA < 255) {
7589 srcR = (srcR * srcA) / 255;
7590 srcG = (srcG * srcA) / 255;
7591 srcB = (srcB * srcA) / 255;
7592 }
7593 }
7594 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
7595 case SDL_COPY_MASK:
7596 if (srcA) {
7597 dstR = srcR;
7598 dstG = srcG;
7599 dstB = srcB;
7600 }
7601 break;
7602 case SDL_COPY_BLEND:
7603 dstR = srcR + ((255 - srcA) * dstR) / 255;
7604 dstG = srcG + ((255 - srcA) * dstG) / 255;
7605 dstB = srcB + ((255 - srcA) * dstB) / 255;
7606 break;
7607 case SDL_COPY_ADD:
7608 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7609 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7610 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7611 break;
7612 case SDL_COPY_MOD:
7613 dstR = (srcR * dstR) / 255;
7614 dstG = (srcG * dstG) / 255;
7615 dstB = (srcB * dstB) / 255;
7616 break;
7617 }
7618 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
7619 *dst = dstpixel;
7620 posx += incx;
7621 ++dst;
7622 }
7623 posy += incy;
7624 info->dst += info->dst_pitch;
7625 }
7626 }
7627
7628 static void SDL_Blit_BGRA8888_ARGB8888_Modulate(SDL_BlitInfo *info)
7629 {
7630 const int flags = info->flags;
7631 const Uint32 modulateR = info->r;
7632 const Uint32 modulateG = info->g;
7633 const Uint32 modulateB = info->b;
7634 const Uint32 modulateA = info->a;
7635 Uint32 pixel;
7636 Uint32 R, G, B, A;
7637
7638 while (info->dst_h--) {
7639 Uint32 *src = (Uint32 *)info->src;
7640 Uint32 *dst = (Uint32 *)info->dst;
7641 int n = info->dst_w;
7642 while (n--) {
7643 pixel = *src;
7644 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7645 if (flags & SDL_COPY_MODULATE_COLOR) {
7646 R = (R * modulateR) / 255;
7647 G = (G * modulateG) / 255;
7648 B = (B * modulateB) / 255;
7649 }
7650 if (flags & SDL_COPY_MODULATE_ALPHA) {
7651 A = (A * modulateA) / 255;
7652 }
7653 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
7654 *dst = pixel;
7655 ++src;
7656 ++dst;
7657 }
7658 info->src += info->src_pitch;
7659 info->dst += info->dst_pitch;
7660 }
7661 }
7662
7663 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
7664 {
7665 const int flags = info->flags;
7666 const Uint32 modulateR = info->r;
7667 const Uint32 modulateG = info->g;
7668 const Uint32 modulateB = info->b;
7669 const Uint32 modulateA = info->a;
7670 Uint32 pixel;
7671 Uint32 R, G, B, A;
7672 int srcy, srcx;
7673 int posy, posx;
7674 int incy, incx;
7675
7676 srcy = 0;
7677 posy = 0;
7678 incy = (info->src_h << 16) / info->dst_h;
7679 incx = (info->src_w << 16) / info->dst_w;
7680
7681 while (info->dst_h--) {
7682 Uint32 *src;
7683 Uint32 *dst = (Uint32 *)info->dst;
7684 int n = info->dst_w;
7685 srcx = -1;
7686 posx = 0x10000L;
7687 while (posy >= 0x10000L) {
7688 ++srcy;
7689 posy -= 0x10000L;
7690 }
7691 while (n--) {
7692 if (posx >= 0x10000L) {
7693 while (posx >= 0x10000L) {
7694 ++srcx;
7695 posx -= 0x10000L;
7696 }
7697 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7698 }
7699 pixel = *src;
7700 B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
7701 if (flags & SDL_COPY_MODULATE_COLOR) {
7702 R = (R * modulateR) / 255;
7703 G = (G * modulateG) / 255;
7704 B = (B * modulateB) / 255;
7705 }
7706 if (flags & SDL_COPY_MODULATE_ALPHA) {
7707 A = (A * modulateA) / 255;
7708 }
7709 pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
7710 *dst = pixel;
7711 posx += incx;
7712 ++dst;
7713 }
7714 posy += incy;
7715 info->dst += info->dst_pitch;
7716 }
7717 }
7718
7719 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
7720 {
7721 const int flags = info->flags;
7722 const Uint32 modulateR = info->r;
7723 const Uint32 modulateG = info->g;
7724 const Uint32 modulateB = info->b;
7725 const Uint32 modulateA = info->a;
7726 Uint32 srcpixel;
7727 Uint32 srcR, srcG, srcB, srcA;
7728 Uint32 dstpixel;
7729 Uint32 dstR, dstG, dstB, dstA;
7730
7731 while (info->dst_h--) {
7732 Uint32 *src = (Uint32 *)info->src;
7733 Uint32 *dst = (Uint32 *)info->dst;
7734 int n = info->dst_w;
7735 while (n--) {
7736 srcpixel = *src;
7737 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7738 dstpixel = *dst;
7739 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
7740 if (flags & SDL_COPY_MODULATE_COLOR) {
7741 srcR = (srcR * modulateR) / 255;
7742 srcG = (srcG * modulateG) / 255;
7743 srcB = (srcB * modulateB) / 255;
7744 }
7745 if (flags & SDL_COPY_MODULATE_ALPHA) {
7746 srcA = (srcA * modulateA) / 255;
7747 }
7748 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7749 /* This goes away if we ever use premultiplied alpha */
7750 if (srcA < 255) {
7751 srcR = (srcR * srcA) / 255;
7752 srcG = (srcG * srcA) / 255;
7753 srcB = (srcB * srcA) / 255;
7754 }
7755 }
7756 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
7757 case SDL_COPY_MASK:
7758 if (srcA) {
7759 dstR = srcR;
7760 dstG = srcG;
7761 dstB = srcB;
7762 }
7763 break;
7764 case SDL_COPY_BLEND:
7765 dstR = srcR + ((255 - srcA) * dstR) / 255;
7766 dstG = srcG + ((255 - srcA) * dstG) / 255;
7767 dstB = srcB + ((255 - srcA) * dstB) / 255;
7768 break;
7769 case SDL_COPY_ADD:
7770 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7771 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7772 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7773 break;
7774 case SDL_COPY_MOD:
7775 dstR = (srcR * dstR) / 255;
7776 dstG = (srcG * dstG) / 255;
7777 dstB = (srcB * dstB) / 255;
7778 break;
7779 }
7780 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
7781 *dst = dstpixel;
7782 ++src;
7783 ++dst;
7784 }
7785 info->src += info->src_pitch;
7786 info->dst += info->dst_pitch;
7787 }
7788 }
7789
7790 static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
7791 {
7792 const int flags = info->flags;
7793 const Uint32 modulateR = info->r;
7794 const Uint32 modulateG = info->g;
7795 const Uint32 modulateB = info->b;
7796 const Uint32 modulateA = info->a;
7797 Uint32 srcpixel;
7798 Uint32 srcR, srcG, srcB, srcA;
7799 Uint32 dstpixel;
7800 Uint32 dstR, dstG, dstB, dstA;
7801 int srcy, srcx;
7802 int posy, posx;
7803 int incy, incx;
7804
7805 srcy = 0;
7806 posy = 0;
7807 incy = (info->src_h << 16) / info->dst_h;
7808 incx = (info->src_w << 16) / info->dst_w;
7809
7810 while (info->dst_h--) {
7811 Uint32 *src;
7812 Uint32 *dst = (Uint32 *)info->dst;
7813 int n = info->dst_w;
7814 srcx = -1;
7815 posx = 0x10000L;
7816 while (posy >= 0x10000L) {
7817 ++srcy;
7818 posy -= 0x10000L;
7819 }
7820 while (n--) {
7821 if (posx >= 0x10000L) {
7822 while (posx >= 0x10000L) {
7823 ++srcx;
7824 posx -= 0x10000L;
7825 }
7826 src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
7827 }
7828 srcpixel = *src;
7829 srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
7830 dstpixel = *dst;
7831 dstA = (Uint8)(dstpixel >> 24); dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
7832 if (flags & SDL_COPY_MODULATE_COLOR) {
7833 srcR = (srcR * modulateR) / 255;
7834 srcG = (srcG * modulateG) / 255;
7835 srcB = (srcB * modulateB) / 255;
7836 }
7837 if (flags & SDL_COPY_MODULATE_ALPHA) {
7838 srcA = (srcA * modulateA) / 255;
7839 }
7840 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
7841 /* This goes away if we ever use premultiplied alpha */
7842 if (srcA < 255) {
7843 srcR = (srcR * srcA) / 255;
7844 srcG = (srcG * srcA) / 255;
7845 srcB = (srcB * srcA) / 255;
7846 }
7847 }
7848 switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
7849 case SDL_COPY_MASK:
7850 if (srcA) {
7851 dstR = srcR;
7852 dstG = srcG;
7853 dstB = srcB;
7854 }
7855 break;
7856 case SDL_COPY_BLEND:
7857 dstR = srcR + ((255 - srcA) * dstR) / 255;
7858 dstG = srcG + ((255 - srcA) * dstG) / 255;
7859 dstB = srcB + ((255 - srcA) * dstB) / 255;
7860 break;
7861 case SDL_COPY_ADD:
7862 dstR = srcR + dstR; if (dstR > 255) dstR = 255;
7863 dstG = srcG + dstG; if (dstG > 255) dstG = 255;
7864 dstB = srcB + dstB; if (dstB > 255) dstB = 255;
7865 break;
7866 case SDL_COPY_MOD:
7867 dstR = (srcR * dstR) / 255;
7868 dstG = (srcG * dstG) / 255;
7869 dstB = (srcB * dstB) / 255;
7870 break;
7871 }
7872 dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
5256 *dst = dstpixel; 7873 *dst = dstpixel;
5257 posx += incx; 7874 posx += incx;
5258 ++dst; 7875 ++dst;
5259 } 7876 }
5260 posy += incy; 7877 posy += incy;
5275 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale }, 7892 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale },
5276 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate }, 7893 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate },
5277 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale }, 7894 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale },
5278 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend }, 7895 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend },
5279 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale }, 7896 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale },
7897 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale },
7898 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend },
7899 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend_Scale },
7900 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate },
7901 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Scale },
7902 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend },
7903 { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale },
5280 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale }, 7904 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale },
5281 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend }, 7905 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend },
5282 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale }, 7906 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale },
5283 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate }, 7907 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate },
5284 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Scale }, 7908 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Scale },
5289 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale }, 7913 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale },
5290 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate }, 7914 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate },
5291 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale }, 7915 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale },
5292 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend }, 7916 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend },
5293 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale }, 7917 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale },
7918 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale },
7919 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend },
7920 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend_Scale },
7921 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate },
7922 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Scale },
7923 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend },
7924 { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale },
5294 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale }, 7925 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale },
5295 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend }, 7926 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend },
5296 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale }, 7927 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale },
5297 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate }, 7928 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate },
5298 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Scale }, 7929 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Scale },
5303 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale }, 7934 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale },
5304 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate }, 7935 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate },
5305 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale }, 7936 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale },
5306 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend }, 7937 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend },
5307 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale }, 7938 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale },
7939 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale },
7940 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend },
7941 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale },
7942 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate },
7943 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale },
7944 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend },
7945 { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale },
5308 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale }, 7946 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale },
5309 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend }, 7947 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend },
5310 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale }, 7948 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale },
5311 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate }, 7949 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate },
5312 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Scale }, 7950 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Scale },
5317 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale }, 7955 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale },
5318 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate }, 7956 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate },
5319 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale }, 7957 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale },
5320 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend }, 7958 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend },
5321 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale }, 7959 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale },
7960 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale },
7961 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend },
7962 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale },
7963 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate },
7964 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale },
7965 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend },
7966 { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale },
5322 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale }, 7967 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale },
5323 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend }, 7968 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend },
5324 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale }, 7969 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale },
5325 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate }, 7970 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate },
5326 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Scale }, 7971 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Scale },
5331 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale }, 7976 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale },
5332 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate }, 7977 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate },
5333 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale }, 7978 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale },
5334 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend }, 7979 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend },
5335 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale }, 7980 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale },
7981 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale },
7982 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend },
7983 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale },
7984 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate },
7985 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale },
7986 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend },
7987 { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale },
5336 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale }, 7988 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale },
5337 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend }, 7989 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend },
5338 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale }, 7990 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale },
5339 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate }, 7991 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate },
5340 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Scale }, 7992 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Scale },
5345 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale }, 7997 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale },
5346 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate }, 7998 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate },
5347 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale }, 7999 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale },
5348 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend }, 8000 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend },
5349 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale }, 8001 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale },
8002 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale },
8003 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend },
8004 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale },
8005 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate },
8006 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale },
8007 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend },
8008 { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale },
5350 { 0, 0, 0, 0, NULL } 8009 { 0, 0, 0, 0, NULL }
5351 }; 8010 };
5352 8011
5353 /* *INDENT-ON* */ 8012 /* *INDENT-ON* */
5354 8013