mirror of https://github.com/encounter/SDL.git
Clear the previous bitmap when calculating a new window shape
Fixes https://github.com/libsdl-org/SDL/issues/6428
This commit is contained in:
parent
65a38a4015
commit
a905a7869f
|
@ -77,8 +77,12 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
|
||||||
int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb;
|
int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb;
|
||||||
Uint8 *bitmap_scanline;
|
Uint8 *bitmap_scanline;
|
||||||
SDL_Color key;
|
SDL_Color key;
|
||||||
|
|
||||||
if(SDL_MUSTLOCK(shape))
|
if(SDL_MUSTLOCK(shape))
|
||||||
SDL_LockSurface(shape);
|
SDL_LockSurface(shape);
|
||||||
|
|
||||||
|
SDL_memset(bitmap, 0, shape->h * bytes_per_scanline);
|
||||||
|
|
||||||
for(y = 0;y<shape->h;y++) {
|
for(y = 0;y<shape->h;y++) {
|
||||||
bitmap_scanline = bitmap + y * bytes_per_scanline;
|
bitmap_scanline = bitmap + y * bytes_per_scanline;
|
||||||
for(x=0;x<shape->w;x++) {
|
for(x=0;x<shape->w;x++) {
|
||||||
|
@ -118,6 +122,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
|
||||||
bitmap_scanline[x / ppb] |= mask_value << (x % ppb);
|
bitmap_scanline[x / ppb] |= mask_value << (x % ppb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SDL_MUSTLOCK(shape))
|
if(SDL_MUSTLOCK(shape))
|
||||||
SDL_UnlockSurface(shape);
|
SDL_UnlockSurface(shape);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,7 @@ DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowSh
|
||||||
SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, &data->surface));
|
SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, &data->surface));
|
||||||
|
|
||||||
/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
|
/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
|
||||||
SDL_DFB_ALLOC_CLEAR(bitmap, shape->w * shape->h);
|
SDL_CalculateShapeBitmap(shaper->mode, shape, bitmap, 1);
|
||||||
SDL_CalculateShapeBitmap(shaper->mode,shape,bitmap,1);
|
|
||||||
|
|
||||||
src = bitmap;
|
src = bitmap;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue