fix2
This commit is contained in:
parent
422332d0a2
commit
70ce0b0b7e
|
@ -674,14 +674,13 @@ img_t gfx_alpha_img(img_t src, int alpha)
|
||||||
if (SDL_LockSurface(img) == 0) {
|
if (SDL_LockSurface(img) == 0) {
|
||||||
ptr = (Uint8*)img->pixels;
|
ptr = (Uint8*)img->pixels;
|
||||||
size = img->w * img->h;
|
size = img->w * img->h;
|
||||||
while (size > 0) {
|
while (size --) {
|
||||||
Uint8 r, g, b, a;
|
Uint8 r, g, b, a;
|
||||||
memcpy(&col, ptr, bpp);
|
memcpy(&col, ptr, bpp);
|
||||||
SDL_GetRGBA(col, img->format, &r, &g, &b, &a);
|
SDL_GetRGBA(col, img->format, &r, &g, &b, &a);
|
||||||
col = SDL_MapRGBA(img->format, r, g, b, a * alpha / 255);
|
col = SDL_MapRGBA(img->format, r, g, b, a * alpha / 255);
|
||||||
memcpy(ptr, &col, bpp);
|
memcpy(ptr, &col, bpp);
|
||||||
ptr += bpp;
|
ptr += bpp;
|
||||||
-- size;
|
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface(img);
|
SDL_UnlockSurface(img);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue