From b648268283ac1506c53305a6e9c829fe97c2b45e Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 21 Feb 2019 21:01:16 +0000 Subject: [PATCH] Changed CortBox(2) col parameter from RGB to BGR That's how it is in the original. Look up Microsoft's COLORREF. --- src/Draw.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Draw.cpp b/src/Draw.cpp index 8458046b..d3f9d193 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -476,7 +476,8 @@ void Surface2Surface(int x, int y, RECT *rect, int to, int from) unsigned long GetCortBoxColor(unsigned long col) { - return ((col & 0xFF) << 16) | (col & 0xFF00) | ((col & 0xFF0000) >> 16); + // This comes in BGR, and goes out BGR + return col; } void CortBox(RECT *rect, uint32_t col) @@ -485,7 +486,10 @@ void CortBox(RECT *rect, uint32_t col) SDL_Rect destRect = RectToSDLRectScaled(rect); //Set colour and draw - SDL_SetRenderDrawColor(gRenderer, (col & 0xFF0000) >> 16, (col & 0x00FF00) >> 8, col & 0x0000FF, 0xFF); + const unsigned char col_red = col & 0x0000FF; + const unsigned char col_green = (col & 0x00FF00) >> 8; + const unsigned char col_blue = (col & 0xFF0000) >> 16; + SDL_SetRenderDrawColor(gRenderer, col_red, col_green, col_blue, 0xFF); SDL_RenderFillRect(gRenderer, &destRect); } @@ -494,9 +498,10 @@ void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no) //Get rect SDL_Rect destRect = RectToSDLRectScaled(rect); - const unsigned char col_red = (col & 0xFF0000) >> 16; + //Set colour and draw + const unsigned char col_red = col & 0x0000FF; const unsigned char col_green = (col & 0x00FF00) >> 8; - const unsigned char col_blue = col & 0x0000FF; + const unsigned char col_blue = (col & 0xFF0000) >> 16; SDL_FillRect(surf[surf_no].surface, &destRect, SDL_MapRGB(surf[surf_no].surface->format, col_red, col_green, col_blue)); surf[surf_no].needs_updating = true; }