Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
GRAPHICS: Fix conversion of a color with 1-bit alpha to ARGB.
Browse files Browse the repository at this point in the history
  • Loading branch information
Akz- committed Jul 29, 2014
1 parent 44dc44d commit bd5d9c9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion graphics/pixelformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ struct PixelFormat {
}

inline void colorToARGB(uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const {
a = (aBits() == 0) ? 0xFF : (((color >> aShift) << aLoss) & 0xFF);
if (aBits() == 0) {
a = 0xFF;
} else if (aBits() == 1) {
a = (color >> aShift) ? 0xFF : 0;
} else {
a = ((color >> aShift) << aLoss) & 0xFF;
}
r = ((color >> rShift) << rLoss) & 0xFF;
g = ((color >> gShift) << gLoss) & 0xFF;
b = ((color >> bShift) << bLoss) & 0xFF;
Expand Down

0 comments on commit bd5d9c9

Please sign in to comment.