Skip to content

Commit

Permalink
tweak(shared): add ABGR support in CfxRGBA
Browse files Browse the repository at this point in the history
  • Loading branch information
Disquse committed Nov 7, 2023
1 parent 7b59ac0 commit d2991d3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion code/client/shared/CfxRGBA.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,19 @@ struct CRGBA
return CRGBA((argb & 0xFF0000) >> 16, ((argb & 0xFF00) >> 8), argb & 0xFF, (argb & 0xFF000000) >> 24);
}

inline static CRGBA FromABGR(uint32_t abgr)
{
return CRGBA(abgr & 0xFF, ((abgr & 0xFF00) >> 8), (abgr & 0xFF0000) >> 16, (abgr & 0xFF000000) >> 24);
}


inline uint32_t AsARGB() const
{
return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
};

inline uint32_t AsABGR() const
{
return (alpha << 24) | (blue << 16) | (green << 8) | red;
}
};

0 comments on commit d2991d3

Please sign in to comment.