Skip to content

Commit

Permalink
Merge commit 'a905a7869f18332579ff06ba3f7f3777708a3007' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 23, 2022
2 parents e738cf8 + a905a78 commit 26c9620
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/video/SDL_shape.c
Expand Up @@ -77,8 +77,12 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb;
Uint8 *bitmap_scanline;
SDL_Color key;

if(SDL_MUSTLOCK(shape))
SDL_LockSurface(shape);

SDL_memset(bitmap, 0, shape->h * bytes_per_scanline);

for(y = 0;y<shape->h;y++) {
bitmap_scanline = bitmap + y * bytes_per_scanline;
for(x=0;x<shape->w;x++) {
Expand Down Expand Up @@ -118,6 +122,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
bitmap_scanline[x / ppb] |= mask_value << (x % ppb);
}
}

if(SDL_MUSTLOCK(shape))
SDL_UnlockSurface(shape);
}
Expand Down
3 changes: 1 addition & 2 deletions src/video/directfb/SDL_DirectFB_shape.c
Expand Up @@ -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));

/* 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;

Expand Down

0 comments on commit 26c9620

Please sign in to comment.