summaryrefslogtreecommitdiff
path: root/src/resources/dye/dyepalette.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
commit3c404128c4669a1f4f190e20a89553677717fc50 (patch)
tree2db4e5031089c800c4e00fd6244e578f44a7c910 /src/resources/dye/dyepalette.cpp
parent89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff)
downloadplus-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz
plus-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2
plus-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz
plus-3c404128c4669a1f4f190e20a89553677717fc50.zip
Add missing comments into defines.
Diffstat (limited to 'src/resources/dye/dyepalette.cpp')
-rw-r--r--src/resources/dye/dyepalette.cpp75
1 files changed, 48 insertions, 27 deletions
diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp
index 9b2a2a8a8..9ea08331d 100644
--- a/src/resources/dye/dyepalette.cpp
+++ b/src/resources/dye/dyepalette.cpp
@@ -26,7 +26,7 @@
#ifndef DYECMD
#include "resources/db/palettedb.h"
-#endif
+#endif // DYECMD
#include "utils/stringutils.h"
@@ -40,7 +40,7 @@
#ifndef SDL_BYTEORDER
#error missing SDL_endian.h
-#endif
+#endif // SDL_BYTEORDER
DyePalette::DyePalette(const std::string &restrict description,
const uint8_t blockSize) :
@@ -94,7 +94,8 @@ DyePalette::DyePalette(const std::string &restrict description,
}
return;
}
-#endif
+#endif // DYECMD
+
logger->log("Error, invalid embedded palette: %s", description.c_str());
}
@@ -242,10 +243,12 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int alpha = pixels[ptr] & 0xff000000;
const unsigned int data = pixels[ptr] & 0x00ffffff;
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const int alpha = *p & 0xff;
const unsigned int data = pixels[ptr] & 0xffffff00;
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
// logger->log("c:%04d %08x", c, *pixels);
// logger->log("data: %08x", data);
if (!alpha)
@@ -264,10 +267,11 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const unsigned int coldata = (col.value[2] << 16U)
| (col.value[1] << 8U) | (col.value[0]);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
const unsigned int coldata = (col.value[2] << 8U)
| (col.value[1] << 16U) | (col.value[0] << 24U);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
// logger->log("coldata: %08x", coldata);
if (data == coldata)
{
@@ -291,10 +295,12 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int alpha = *pixels & 0xff000000;
const unsigned int data = (*pixels) & 0x00ffffff;
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const int alpha = *p & 0xff;
const unsigned int data = (*pixels) & 0xffffff00;
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
// logger->log("c:%04d %08x", c, *pixels);
// logger->log("data: %08x", data);
if (!alpha)
@@ -313,10 +319,12 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const unsigned int coldata = (col.value[2] << 16U)
| (col.value[1] << 8U) | (col.value[0]);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const unsigned int coldata = (col.value[2] << 8U)
| (col.value[1] << 16U) | (col.value[0] << 24U);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
// logger->log("coldata: %08x", coldata);
if (data == coldata)
{
@@ -361,12 +369,13 @@ void DyePalette::replaceAColor(uint32_t *restrict pixels,
| (col.value[2] << 16U)
| (col.value[1] << 8U)
| (col.value[0]);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const unsigned int coldata = (col.value[3])
| (col.value[2] << 8U)
| (col.value[1] << 16U) |
(col.value[0] << 24U);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
if (data == coldata)
{
@@ -402,12 +411,12 @@ void DyePalette::replaceAColor(uint32_t *restrict pixels,
| (col.value[2] << 16U)
| (col.value[1] << 8U)
| (col.value[0]);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
const unsigned int coldata = (col.value[3])
| (col.value[2] << 8U)
| (col.value[1] << 16U) |
(col.value[0] << 24U);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
if (data == coldata)
{
@@ -441,10 +450,12 @@ void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int alpha = *p & 0xff;
const unsigned int data = (pixels[ptr]) & 0xffffff00;
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const int alpha = pixels[ptr] & 0xff000000;
const unsigned int data = (pixels[ptr]) & 0x00ffffff;
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
if (alpha)
{
std::vector<DyeColor>::const_iterator it = mColors.begin();
@@ -457,10 +468,12 @@ void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const unsigned int coldata = (col.value[0] << 24)
| (col.value[1] << 16) | (col.value[2] << 8);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const unsigned int coldata = (col.value[0])
| (col.value[1] << 8) | (col.value[2] << 16);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
if (data == coldata)
{
p[0] = col2.value[0];
@@ -484,10 +497,12 @@ void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int alpha = *p & 0xff;
const unsigned int data = (*pixels) & 0xffffff00;
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const int alpha = *pixels & 0xff000000;
const unsigned int data = (*pixels) & 0x00ffffff;
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
if (!alpha)
continue;
@@ -501,10 +516,12 @@ void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const unsigned int coldata = (col.value[0] << 24)
| (col.value[1] << 16) | (col.value[2] << 8);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const unsigned int coldata = (col.value[0])
| (col.value[1] << 8) | (col.value[2] << 16);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
if (data == coldata)
{
p[0] = col2.value[0];
@@ -547,12 +564,14 @@ void DyePalette::replaceAOGLColor(uint32_t *restrict pixels,
| (col.value[1] << 16U)
| (col.value[2] << 8U)
| col.value[3];
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const unsigned int coldata = (col.value[0])
| (col.value[1] << 8U)
| (col.value[2] << 16U)
| (col.value[3] << 24U);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
if (data == coldata)
{
p[0] = col2.value[0];
@@ -587,12 +606,14 @@ void DyePalette::replaceAOGLColor(uint32_t *restrict pixels,
| (col.value[1] << 16U)
| (col.value[2] << 8U)
| col.value[3];
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const unsigned int coldata = (col.value[0])
| (col.value[1] << 8U)
| (col.value[2] << 16U)
| (col.value[3] << 24U);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
if (data == coldata)
{
p[0] = col2.value[0];