Changed CortBox(2) col parameter from RGB to BGR

That's how it is in the original. Look up Microsoft's COLORREF.
This commit is contained in:
Clownacy 2019-02-21 21:01:16 +00:00
parent 3eca2d7cf3
commit b648268283

View file

@ -476,7 +476,8 @@ void Surface2Surface(int x, int y, RECT *rect, int to, int from)
unsigned long GetCortBoxColor(unsigned long col) 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) void CortBox(RECT *rect, uint32_t col)
@ -485,7 +486,10 @@ void CortBox(RECT *rect, uint32_t col)
SDL_Rect destRect = RectToSDLRectScaled(rect); SDL_Rect destRect = RectToSDLRectScaled(rect);
//Set colour and draw //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); SDL_RenderFillRect(gRenderer, &destRect);
} }
@ -494,9 +498,10 @@ void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no)
//Get rect //Get rect
SDL_Rect destRect = RectToSDLRectScaled(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_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)); 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; surf[surf_no].needs_updating = true;
} }