Browse Source

sys/win32: fix RGB macro

hikari 3 years ago
parent
commit
4b289f904c
2 changed files with 2 additions and 4 deletions
  1. 1 3
      core/sys/windows/gdi32.odin
  2. 1 1
      core/sys/windows/types.odin

+ 1 - 3
core/sys/windows/gdi32.odin

@@ -67,8 +67,6 @@ foreign gdi32 {
 	PatBlt :: proc(hdc: HDC, x, y, w, h: c_int, rop: DWORD) -> BOOL ---
 }
 
-// Windows colors are packed as ABGR
 RGB :: #force_inline proc "contextless" (r, g, b: u8) -> COLORREF {
-	res: [4]u8 = {0, b, g, r}
-	return transmute(COLORREF)res
+	return COLORREF(r) | COLORREF(WORD(g) << 8) | COLORREF(DWORD(b) << 16)
 }

+ 1 - 1
core/sys/windows/types.odin

@@ -55,7 +55,7 @@ UINT_PTR :: uintptr
 ULONG :: c_ulong
 UCHAR :: BYTE
 NTSTATUS :: c.long
-COLORREF :: DWORD // Windows colors are packed as ABGR
+COLORREF :: DWORD
 LPCOLORREF :: ^COLORREF
 LPARAM :: LONG_PTR
 WPARAM :: UINT_PTR