Skip to content

Commit

Permalink
Fix clear screen alpha channel
Browse files Browse the repository at this point in the history
  • Loading branch information
jblang committed Feb 1, 2020
1 parent a1182ef commit 20d2cbc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/util/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ void destroy_image(struct image *img)

void clear_image(struct image *img)
{
int i;
int color = img->palette->pixels[0];
int width = img->width * img->bytesperpixel;
if (img->palette->npreallocated)
Expand All @@ -250,8 +249,13 @@ void clear_image(struct image *img)
if (color)
color = 255;
}
for (i = 0; i < img->height; i++)
memset(img->currlines[i], color, width);
for (int i = 0; i < img->height; i++)
for (int j = 0; j < width; j++) {
if (j % img->bytesperpixel == img->palette->info.truec.missingbyte)
img->currlines[i][j] = 0xff;
else
img->currlines[i][j] = color;
}
}

#define drawchar drawchar8
Expand Down

0 comments on commit 20d2cbc

Please sign in to comment.