From d2991d34a007f43e31e770b7bf85f791b12cc833 Mon Sep 17 00:00:00 2001 From: Disquse Date: Tue, 7 Nov 2023 19:10:44 +0300 Subject: [PATCH] tweak(shared): add ABGR support in CfxRGBA --- code/client/shared/CfxRGBA.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/client/shared/CfxRGBA.h b/code/client/shared/CfxRGBA.h index c5fca0154a..637d88aaaa 100644 --- a/code/client/shared/CfxRGBA.h +++ b/code/client/shared/CfxRGBA.h @@ -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; } -}; \ No newline at end of file + + inline uint32_t AsABGR() const + { + return (alpha << 24) | (blue << 16) | (green << 8) | red; + } +};