From 1e3b92218a8e460c6a2d7efb4bbfc9def5d10672 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Sun, 5 Feb 2017 10:01:32 +0100 Subject: [PATCH] Remove obsolete transparent stuff --- blupi.cpp | 13 ------------- decor.cpp | 3 --- pixmap.cpp | 35 ++++------------------------------- pixmap.h | 2 -- 4 files changed, 4 insertions(+), 49 deletions(-) diff --git a/blupi.cpp b/blupi.cpp index 816f071..991be10 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -335,7 +335,6 @@ void WindowProc2 (const SDL_Event &event) iconDim.x = 64; iconDim.y = 66 / 2; g_pPixmap->Cache (CHHILI, "image\\hili.blp", totalDim, iconDim); - g_pPixmap->SetTransparent (CHHILI, RGB (0, 0, 255)); // bleu } SDL_SetWindowTitle (g_window, "Blupi"); if (g_pSound != NULL) g_pSound->RestartMusic (); @@ -515,7 +514,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMCELY*2; if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim) ) return InitFail("Cache floor000.blp", true); - g_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu totalDim.x = DIMOBJX*16; totalDim.y = DIMOBJY*8; @@ -523,11 +521,9 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMOBJY; if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim) ) return InitFail("Cache obj000.blp", true); - g_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim) ) return InitFail("Cache obj-o000.blp", true); - g_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc totalDim.x = DIMBLUPIX*16; totalDim.y = DIMBLUPIY*23; @@ -535,7 +531,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMBLUPIY; if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim) ) return InitFail("Cache blupi.blp", true); - g_pPixmap->SetTransparent(CHBLUPI, RGB(0,0,255)); // bleu totalDim.x = 64; totalDim.y = 66; @@ -543,7 +538,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = 66/2; if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim) ) return InitFail("Cache hili.blp", true); - g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu totalDim.x = DIMCELX*2*3; totalDim.y = DIMCELY*2*5; @@ -551,7 +545,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMCELY*2; if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim) ) return InitFail("Cache fog.blp", true); - g_pPixmap->SetTransparent(CHFOG, RGB(255,255,255)); // blanc totalDim.x = DIMCELX*2*16; totalDim.y = DIMCELY*2*1; @@ -559,7 +552,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMCELY*2; if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim) ) return InitFail("Cache mask1.blp", true); - g_pPixmap->SetTransparent(CHMASK1, RGB(0,0,0)); // noir totalDim.x = DIMBUTTONX*6; totalDim.y = DIMBUTTONY*21; @@ -567,7 +559,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMBUTTONY; if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim) ) return InitFail("Cache button00.blp", true); - g_pPixmap->SetTransparent(CHBUTTON, RGB(0,0,255)); // bleu totalDim.x = DIMJAUGEX*1; totalDim.y = DIMJAUGEY*4; @@ -575,7 +566,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMJAUGEY; if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim) ) return InitFail("Cache jauge.blp", true); - g_pPixmap->SetTransparent(CHJAUGE, RGB(0,0,255)); // bleu totalDim.x = DIMTEXTX*16; totalDim.y = DIMTEXTY*8*3; @@ -583,7 +573,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMTEXTY; if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim) ) return InitFail("Cache text.blp", true); - g_pPixmap->SetTransparent(CHTEXT, RGB(0,0,255)); // bleu totalDim.x = DIMLITTLEX*16; totalDim.y = DIMLITTLEY*8; @@ -591,7 +580,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = DIMLITTLEY; if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim) ) return InitFail("Cache little.blp", true); - g_pPixmap->SetTransparent(CHLITTLE, RGB(0,0,255)); // bleu totalDim.x = 426; totalDim.y = 52; @@ -599,7 +587,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.y = 52; if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim) ) return InitFail("Cache bignum.blp", true); - g_pPixmap->SetTransparent(CHBIGNUM, RGB(0,0,255)); // bleu // Load all cursors g_pPixmap->LoadCursors (); diff --git a/decor.cpp b/decor.cpp index 91daeba..747d118 100644 --- a/decor.cpp +++ b/decor.cpp @@ -226,7 +226,6 @@ bool CDecor::LoadImages() sprintf(filename, "image\\floor%.3d.blp", m_region); if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim) ) return false; - m_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu totalDim.x = DIMOBJX*16; totalDim.y = DIMOBJY*8; @@ -235,12 +234,10 @@ bool CDecor::LoadImages() sprintf(filename, "image\\obj%.3d.blp", m_region); if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim) ) return false; - m_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu sprintf(filename, "image\\obj-o%.3d.blp", m_region); if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim) ) return false; - m_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc MapInitColors(); // init les couleurs pour la carte diff --git a/pixmap.cpp b/pixmap.cpp index 37b50de..08ce038 100644 --- a/pixmap.cpp +++ b/pixmap.cpp @@ -354,29 +354,6 @@ bool CPixmap::Cache(int channel, SDL_Surface *surface, POINT totalDim) return true; } -// Définition de la couleur transparente. - -void CPixmap::SetTransparent(int channel, COLORREF color) -{ - if ( channel < 0 || channel >= MAXIMAGE ) return; - if (m_lpSDLTexture[channel] == NULL ) return; - - m_colorSurface[2*channel+0] = color; - m_colorSurface[2*channel+1] = color; -} - -// Définition de la couleur transparente. - -void CPixmap::SetTransparent2(int channel, COLORREF color1, COLORREF color2) -{ - if ( channel < 0 || channel >= MAXIMAGE ) return; - if (m_lpSDLTexture[channel] == NULL ) return; - - m_colorSurface[2*channel+0] = color1; - m_colorSurface[2*channel+1] = color2; -} - - // Modifie la région de clipping. void CPixmap::SetClipping(RECT clip) @@ -456,9 +433,8 @@ bool CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, oldColor1 = m_colorSurface[2*channel+0]; oldColor2 = m_colorSurface[2*channel+1]; - if (channel != CHMAP && bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, pos, rect, mode); - if (channel != CHMAP && bMask ) SetTransparent2(channel, oldColor1, oldColor2); if ( ddrval != DD_OK ) return false; return true; @@ -502,9 +478,8 @@ bool CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, oldColor1 = m_colorSurface[2*channel+0]; oldColor2 = m_colorSurface[2*channel+1]; - if ( bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, pos, rect, mode); - if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); if ( ddrval != DD_OK ) return false; return true; @@ -543,9 +518,8 @@ bool CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos, oldColor1 = m_colorSurface[2*channel+0]; oldColor2 = m_colorSurface[2*channel+1]; - if ( bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, pos, rect, mode); - if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); if ( ddrval != DD_OK ) return false; return true; @@ -565,9 +539,8 @@ bool CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, oldColor1 = m_colorSurface[2*channel+0]; oldColor2 = m_colorSurface[2*channel+1]; - if ( bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, dest, rect, mode); - if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); if ( ddrval != DD_OK ) return false; return true; diff --git a/pixmap.h b/pixmap.h index 055cb2b..33a1026 100644 --- a/pixmap.h +++ b/pixmap.h @@ -25,8 +25,6 @@ public: bool Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim); bool Cache(int channel, char *pFilename, POINT totalDim); bool Cache(int channel, SDL_Surface *surface, POINT totalDim); - void SetTransparent(int channel, COLORREF color); - void SetTransparent2(int channel, COLORREF color1, COLORREF color2); void SetClipping(RECT clip); RECT GetClipping();