diff options
author | Simon McVittie <smcv@debian.org> | 2022-09-18 15:37:53 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2022-09-18 15:39:06 +0100 |
commit | 995f51c3de7e68c6735081e0c6907f4327855f7a (patch) | |
tree | c703f2ca46383a7d01124c849219e1b22ec58e8a | |
parent | 2a42e88e2d8c05010101c1dfdad3604f0ba1e61b (diff) |
Revert "video: Optimize temporarily saving of dest alpha for a blit."
This reverts commit 812d58fb1de30bb94dd89f76e838f1884284bcc1.
Bisection indicates that this triggers a crash in the amoebax package.
Bug: https://github.com/libsdl-org/sdl12-compat/issues/211
Gbp-Pq: Name Revert-video-Optimize-temporarily-saving-of-dest-alpha-fo.patch
-rw-r--r-- | src/SDL12_compat.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c index 2dddc16..812f7d4 100644 --- a/src/SDL12_compat.c +++ b/src/SDL12_compat.c @@ -6041,7 +6041,7 @@ SDL_GetVideoSurface(void) } static int -SaveDestAlpha(SDL12_Surface *src12, SDL12_Surface *dst12, const SDL12_Rect *dstrect12, Uint8 **retval) +SaveDestAlpha(SDL12_Surface *src12, SDL12_Surface *dst12, Uint8 **retval) { /* The 1.2 docs say this: * RGBA->RGBA: @@ -6058,8 +6058,8 @@ SaveDestAlpha(SDL12_Surface *src12, SDL12_Surface *dst12, const SDL12_Rect *dstr Uint8 *dptr; int x, y; - const int w = dstrect12->w; - const int h = dstrect12->h; + const int w = dst12->w; + const int h = dst12->h; const Uint32 amask = dst12->format->Amask; const Uint32 ashift = dst12->format->Ashift; @@ -6074,7 +6074,6 @@ SaveDestAlpha(SDL12_Surface *src12, SDL12_Surface *dst12, const SDL12_Rect *dstr if (dst12->format->BytesPerPixel == 2) { const Uint16 *sptr = (const Uint16 *) dst12->pixels; - sptr += ((dst12->pitch / 2) * dstrect12->y) + dstrect12->x; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { *(dptr++) = (Uint8) ((sptr[x] & amask) >> ashift); @@ -6083,7 +6082,6 @@ SaveDestAlpha(SDL12_Surface *src12, SDL12_Surface *dst12, const SDL12_Rect *dstr } } else if (dst12->format->BytesPerPixel == 4) { const Uint32 *sptr = (const Uint32 *) dst12->pixels; - sptr += ((dst12->pitch / 4) * dstrect12->y) + dstrect12->x; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { *(dptr++) = (Uint8) ((sptr[x] & amask) >> ashift); @@ -6100,7 +6098,7 @@ SaveDestAlpha(SDL12_Surface *src12, SDL12_Surface *dst12, const SDL12_Rect *dstr } static void -RestoreDestAlpha(SDL12_Surface *dst12, Uint8 *dstalpha, const SDL12_Rect *dstrect12) +RestoreDestAlpha(SDL12_Surface *dst12, Uint8 *dstalpha) { if (dstalpha) { int x, y; @@ -6114,7 +6112,6 @@ RestoreDestAlpha(SDL12_Surface *dst12, Uint8 *dstalpha, const SDL12_Rect *dstrec if (dst12->format->BytesPerPixel == 2) { Uint16 *dptr = (Uint16 *) dst12->pixels; - dptr += ((dst12->pitch / 2) * dstrect12->y) + dstrect12->x; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { dptr[x] = (Uint16) ((dptr[x] & ~amask) | ((((Uint16) *(sptr++)) << ashift) & amask)); @@ -6123,7 +6120,6 @@ RestoreDestAlpha(SDL12_Surface *dst12, Uint8 *dstalpha, const SDL12_Rect *dstrec } } else if (dst12->format->BytesPerPixel == 4) { Uint32 *dptr = (Uint32 *) dst12->pixels; - dptr += ((dst12->pitch / 4) * dstrect12->y) + dstrect12->x; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { dptr[x] = (dptr[x] & ~amask) | ((((Uint32) *(sptr++)) << ashift) & amask); @@ -6146,7 +6142,7 @@ SDL_UpperBlit(SDL12_Surface *src12, SDL12_Rect *srcrect12, SDL12_Surface *dst12, if ((src12 == NULL) || (dst12 == NULL)) { return SDL20_SetError("SDL_UpperBlit: passed a NULL surface"); - } else if (SaveDestAlpha(src12, dst12, dstrect12, &dstalpha) < 0) { + } else if (SaveDestAlpha(src12, dst12, &dstalpha) < 0) { return -1; } @@ -6155,7 +6151,7 @@ SDL_UpperBlit(SDL12_Surface *src12, SDL12_Rect *srcrect12, SDL12_Surface *dst12, dst12->surface20, dstrect12 ? Rect12to20(dstrect12, &dstrect20) : NULL); - RestoreDestAlpha(dst12, dstalpha, dstrect12); + RestoreDestAlpha(dst12, dstalpha); if (dstrect12) { Rect20to12(&dstrect20, dstrect12); @@ -6171,7 +6167,7 @@ SDL_LowerBlit(SDL12_Surface *src12, SDL12_Rect *srcrect12, SDL12_Surface *dst12, SDL_Rect srcrect20, dstrect20; int retval; - if (SaveDestAlpha(src12, dst12, dstrect12, &dstalpha) < 0) { + if (SaveDestAlpha(src12, dst12, &dstalpha) < 0) { return -1; } @@ -6180,7 +6176,7 @@ SDL_LowerBlit(SDL12_Surface *src12, SDL12_Rect *srcrect12, SDL12_Surface *dst12, dst12->surface20, dstrect12 ? Rect12to20(dstrect12, &dstrect20) : NULL); - RestoreDestAlpha(dst12, dstalpha, dstrect12); + RestoreDestAlpha(dst12, dstalpha); if (srcrect12) { Rect20to12(&srcrect20, srcrect12); |