forked from jengelh/SDL2
53 lines
2.0 KiB
Diff
53 lines
2.0 KiB
Diff
|
# https://bugzilla.libsdl.org/show_bug.cgi?id=3466
|
||
|
# commits 5184186d4366 and fbf9b0e3589a
|
||
|
#
|
||
|
diff -udpr SDL2-2.0.5.orig/src/video/SDL_blit_N.c SDL2-2.0.5/src/video/SDL_blit_N.c
|
||
|
--- SDL2-2.0.5.orig/src/video/SDL_blit_N.c 2016-10-20 05:56:26.000000000 +0200
|
||
|
+++ SDL2-2.0.5/src/video/SDL_blit_N.c 2016-10-23 09:58:57.319897519 +0200
|
||
|
@@ -118,12 +118,6 @@ calc_swizzle32(const SDL_PixelFormat * s
|
||
|
16, 8, 0, 24,
|
||
|
0, NULL
|
||
|
};
|
||
|
- if (!srcfmt) {
|
||
|
- srcfmt = &default_pixel_format;
|
||
|
- }
|
||
|
- if (!dstfmt) {
|
||
|
- dstfmt = &default_pixel_format;
|
||
|
- }
|
||
|
const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00,
|
||
|
0x04, 0x04, 0x04, 0x04,
|
||
|
0x08, 0x08, 0x08, 0x08,
|
||
|
@@ -131,11 +125,20 @@ calc_swizzle32(const SDL_PixelFormat * s
|
||
|
0x0C);
|
||
|
vector unsigned char vswiz;
|
||
|
vector unsigned int srcvec;
|
||
|
+ Uint32 rmask, gmask, bmask, amask;
|
||
|
+
|
||
|
+ if (!srcfmt) {
|
||
|
+ srcfmt = &default_pixel_format;
|
||
|
+ }
|
||
|
+ if (!dstfmt) {
|
||
|
+ dstfmt = &default_pixel_format;
|
||
|
+ }
|
||
|
+
|
||
|
#define RESHIFT(X) (3 - ((X) >> 3))
|
||
|
- Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift);
|
||
|
- Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
|
||
|
- Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
|
||
|
- Uint32 amask;
|
||
|
+ rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift);
|
||
|
+ gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
|
||
|
+ bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
|
||
|
+
|
||
|
/* Use zero for alpha if either surface doesn't have alpha */
|
||
|
if (dstfmt->Amask) {
|
||
|
amask =
|
||
|
@@ -147,6 +150,7 @@ calc_swizzle32(const SDL_PixelFormat * s
|
||
|
0xFFFFFFFF);
|
||
|
}
|
||
|
#undef RESHIFT
|
||
|
+
|
||
|
((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask);
|
||
|
vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0));
|
||
|
return (vswiz);
|