From 7430be69e394c37892f60ee9b43f3b2198615b8a Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 28 Aug 2021 12:59:46 -0700 Subject: [PATCH] Remove getBGR getBGR, when used in FillRect, was actually passing colors in RGB order. But now the masks are fixed, so remove it, and fix up all existing getBGR colors to use getRGB instead. --- desktop_version/src/Editor.cpp | 20 ++++++++++---------- desktop_version/src/Graphics.cpp | 9 ++------- desktop_version/src/Graphics.h | 2 -- desktop_version/src/preloader.cpp | 4 ++-- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index 61a51d4f..8f3be58c 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -607,7 +607,7 @@ void editorrender(void) if(customentities[i].p1==1) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8)+4, "^", 255, 255, 255 - help.glow, false); if(customentities[i].p1==2) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8)+4, "<", 255, 255, 255 - help.glow, false); if(customentities[i].p1==3) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8)+4, ">", 255, 255, 255 - help.glow, false); - fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,16,graphics.getBGR(255,164,255)); + fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,16,graphics.getRGB(255,164,255)); break; case 2: //Threadmills & platforms if (!INBOUNDS_VEC(obj.customplatformtile, graphics.entcolours)) @@ -631,18 +631,18 @@ void editorrender(void) if(customentities[i].p1==1) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+12,(customentities[i].y*8)- (ed.levy*30*8), "^", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); if(customentities[i].p1==2) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+12,(customentities[i].y*8)- (ed.levy*30*8), "<", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); if(customentities[i].p1==3) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+12,(customentities[i].y*8)- (ed.levy*30*8), ">", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); - fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255)); + fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getRGB(255,255,255)); } if(customentities[i].p1==5) { graphics.Print((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8), ">>>>", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); - fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255)); + fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getRGB(255,255,255)); } else if(customentities[i].p1==6) { graphics.Print((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8), "<<<<", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); - fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255)); + fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getRGB(255,255,255)); } if(customentities[i].p1>=7) @@ -662,12 +662,12 @@ void editorrender(void) if(customentities[i].p1==7) { graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8), "> > > > ", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); - fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),64,8,graphics.getBGR(255,255,255)); + fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),64,8,graphics.getRGB(255,255,255)); } else if(customentities[i].p1==8) { graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8), "< < < < ", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); - fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),64,8,graphics.getBGR(255,255,255)); + fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),64,8,graphics.getRGB(255,255,255)); } break; case 3: //Disappearing Platform @@ -687,7 +687,7 @@ void editorrender(void) } graphics.Print((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8), "////", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); - fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255)); + fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getRGB(255,255,255)); break; case 9: //Shiny Trinket graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),22,196,196,196); @@ -894,7 +894,7 @@ void editorrender(void) fillboxabs( room->enemyx1, room->enemyy1, room->enemyx2-room->enemyx1, room->enemyy2-room->enemyy1, - graphics.getBGR(255-(help.glow/2),64,64)); + graphics.getRGB(255-(help.glow/2),64,64)); } if(room->platx1!=0 || room->platy1!=0 @@ -903,7 +903,7 @@ void editorrender(void) fillboxabs( room->platx1, room->platy1, room->platx2-room->platx1, room->platy2-room->platy1, - graphics.getBGR(64,64,255-(help.glow/2))); + graphics.getRGB(64,64,255-(help.glow/2))); } } @@ -1139,7 +1139,7 @@ void editorrender(void) else if(ed.scripteditmod) { //Elaborate C64 BASIC menu goes here! - FillRect(graphics.backBuffer, 0,0,320,240, graphics.getBGR(123, 111, 218)); + FillRect(graphics.backBuffer, 0,0,320,240, graphics.getRGB(123, 111, 218)); FillRect(graphics.backBuffer, 14,16,292,208, graphics.getRGB(61, 48, 162)); switch(ed.scripthelppage) { diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 9d35268d..5f5a75be 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -3041,9 +3041,9 @@ Uint32 Graphics::bigchunkygetcol(int t) switch (t) { case 1: - return getBGR((fRandom() * 64), 10, 10); + return getRGB((fRandom() * 64), 10, 10); case 2: - return getBGR(int(160- help.glow/2 - (fRandom()*20)), 200- help.glow/2, 220 - help.glow); + return getRGB(int(160- help.glow/2 - (fRandom()*20)), 200- help.glow/2, 220 - help.glow); } return 0x00000000; } @@ -3258,11 +3258,6 @@ Uint32 Graphics::getRGB(Uint8 r, Uint8 g, Uint8 b) return SDL_MapRGB(backBuffer->format, r, g, b); } -Uint32 Graphics::getBGR(Uint8 r, Uint8 g, Uint8 b) -{ - return SDL_MapRGB(backBuffer->format, r, g, b); -} - Uint32 Graphics::getRGB(Uint32 _col) { return ( _col); diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 8765aea0..2ac68e1e 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -183,8 +183,6 @@ public: Uint32 getRGB(Uint8 r, Uint8 g, Uint8 b); - Uint32 getBGR(Uint8 r, Uint8 g, Uint8 b); - Uint32 getRGB(Uint32 _col); Uint32 RGBflip(Uint8 r, Uint8 g, Uint8 b); diff --git a/desktop_version/src/preloader.cpp b/desktop_version/src/preloader.cpp index 08c48b4b..90a9c4b0 100644 --- a/desktop_version/src/preloader.cpp +++ b/desktop_version/src/preloader.cpp @@ -95,7 +95,7 @@ void preloaderrender(void) } } - FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getBGR(0x3E,0x31,0xA2)); + FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getRGB(0x3E,0x31,0xA2)); if(pre_fakepercent==100){ graphics.Print(282-(15*8), 204, "LOADING... " + help.String(int(pre_fakepercent))+"%", 124, 112, 218, false); @@ -115,7 +115,7 @@ void preloaderrender(void) pre_temprecty = 0; pre_temprecth = 240; ClearSurface(graphics.backBuffer); - FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getBGR(0x3E,0x31,0xA2)); + FillRect(graphics.backBuffer, pre_frontrectx, pre_frontrecty, pre_frontrectw,pre_frontrecth, graphics.getRGB(0x3E,0x31,0xA2)); graphics.Print(282-(15*8), 204, "LOADING... 100%", 124, 112, 218, false); }