From c1c6cb457479e17d07bc6d9baa618ef85d60f2bc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Jul 2013 13:14:39 +0300 Subject: Improve a bit dye code formatting. --- src/resources/dye.cpp | 10 +++++----- src/resources/openglimagehelper.cpp | 4 ++-- src/resources/sdlimagehelper.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/resources') diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index 93edbabbc..dd6c50d63 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -206,12 +206,12 @@ void DyePalette::replaceSColor(uint8_t *const color) const if (it == it_end) return; const DyeColor &col2 = *it; - if (color[2] == col.value[0] && color[1] == col.value[1] - && color[0] == col.value[2]) + if (color[3] == col.value[0] && color[2] == col.value[1] + && color[1] == col.value[2]) { - color[2] = col2.value[0]; - color[1] = col2.value[1]; - color[0] = col2.value[2]; + color[3] = col2.value[0]; + color[2] = col2.value[1]; + color[1] = col2.value[2]; return; } ++ it; diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index a107b0099..79cd12512 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -75,7 +75,7 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const if (pal) { for (uint32_t *p_end = pixels + surf->w * surf->h; - pixels != p_end; ++pixels) + pixels != p_end; ++pixels) { uint8_t *p = reinterpret_cast(pixels); const int alpha = *p & 255; @@ -92,7 +92,7 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const if (pal) { for (uint32_t *p_end = pixels + surf->w * surf->h; - pixels != p_end; ++pixels) + pixels != p_end; ++pixels) { pal->replaceAOGLColor(reinterpret_cast(pixels)); } diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 337d1cb53..32fbd0f35 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -73,13 +73,13 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const if (pal) { for (uint32_t *p_end = pixels + surf->w * surf->h; - pixels != p_end; ++pixels) + pixels != p_end; ++pixels) { uint8_t *const p = reinterpret_cast(pixels); const int alpha = *p & 255; if (!alpha) continue; - pal->replaceSColor(p + 1); + pal->replaceSColor(p); } } break; @@ -90,7 +90,7 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const if (pal) { for (uint32_t *p_end = pixels + surf->w * surf->h; - pixels != p_end; ++pixels) + pixels != p_end; ++pixels) { pal->replaceAColor(reinterpret_cast(pixels)); } @@ -101,7 +101,7 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const default: { for (uint32_t *p_end = pixels + surf->w * surf->h; - pixels != p_end; ++pixels) + pixels != p_end; ++pixels) { const uint32_t p = *pixels; const int alpha = p & 255; -- cgit v1.2.3-70-g09d2