Skip to content

Commit

Permalink
Fix readAlpha, scale values properly
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Dec 29, 2024
1 parent bd7d5b4 commit 2cfe7aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ class ResourceGlyph : public GlyphObject
uint8_t srcbyte = 0;
uint8_t srcShift = 0;
const uint8_t mask = (1 << bitsPerPixel) - 1;
const uint8_t dstShift = 8 - bitsPerPixel;
auto rowptr = bufptr;
for(unsigned y = 0; y < glyph.height; ++y) {
for(unsigned x = 0; x < glyph.width; ++x) {
Expand All @@ -420,7 +419,7 @@ class ResourceGlyph : public GlyphObject
srcShift = 8;
}
srcShift -= bitsPerPixel;
rowptr[x] = ((srcbyte >> srcShift) & mask) << dstShift;
rowptr[x] = 255 * ((srcbyte >> srcShift) & mask) / mask;
}
rowptr += stride;
}
Expand Down

0 comments on commit 2cfe7aa

Please sign in to comment.