summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-27 14:55:32 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-27 14:55:32 +0300
commit7525bcd3024697e233091012d994cb86e9a05179 (patch)
treefe33fc33a8b0bb4bfad6140195e6afcd4105007e
parentb1032f8fde46889a3b9bdb25333f26225a28d0f4 (diff)
downloadmanaverse-7525bcd3024697e233091012d994cb86e9a05179.tar.gz
manaverse-7525bcd3024697e233091012d994cb86e9a05179.tar.bz2
manaverse-7525bcd3024697e233091012d994cb86e9a05179.tar.xz
manaverse-7525bcd3024697e233091012d994cb86e9a05179.zip
Add restrict keyword in dyepalette.
-rw-r--r--src/resources/dye/dyepalette.cpp15
-rw-r--r--src/resources/dye/dyepalette.h20
2 files changed, 20 insertions, 15 deletions
diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp
index 2dd71f2ec..564c2ac05 100644
--- a/src/resources/dye/dyepalette.cpp
+++ b/src/resources/dye/dyepalette.cpp
@@ -34,7 +34,7 @@
#include "debug.h"
-DyePalette::DyePalette(const std::string &description,
+DyePalette::DyePalette(const std::string &restrict description,
const uint8_t blockSize) :
mColors()
{
@@ -103,7 +103,7 @@ unsigned int DyePalette::hexDecode(const signed char c)
}
void DyePalette::getColor(const unsigned int intensity,
- unsigned int (&color)[3]) const
+ unsigned int (&restrict color)[3]) const restrict2
{
if (intensity == 0)
{
@@ -160,7 +160,8 @@ void DyePalette::getColor(const unsigned int intensity,
}
}
-void DyePalette::getColor(double intensity, int (&color)[3]) const
+void DyePalette::getColor(double intensity,
+ int (&restrict color)[3]) const restrict2
{
// Nothing to do here
if (mColors.empty())
@@ -203,7 +204,7 @@ void DyePalette::getColor(double intensity, int (&color)[3]) const
}
void DyePalette::replaceSColor(uint32_t *restrict pixels,
- const int bufSize) const
+ const int bufSize) const restrict2
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
const size_t sz = mColors.size();
@@ -311,7 +312,7 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels,
}
void DyePalette::replaceAColor(uint32_t *restrict pixels,
- const int bufSize) const
+ const int bufSize) const restrict2
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
const size_t sz = mColors.size();
@@ -402,7 +403,7 @@ void DyePalette::replaceAColor(uint32_t *restrict pixels,
}
void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
- const int bufSize) const
+ const int bufSize) const restrict2
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
const size_t sz = mColors.size();
@@ -497,7 +498,7 @@ void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
}
void DyePalette::replaceAOGLColor(uint32_t *restrict pixels,
- const int bufSize) const
+ const int bufSize) const restrict2
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
const size_t sz = mColors.size();
diff --git a/src/resources/dye/dyepalette.h b/src/resources/dye/dyepalette.h
index 1269d1511..8f30cfd2f 100644
--- a/src/resources/dye/dyepalette.h
+++ b/src/resources/dye/dyepalette.h
@@ -41,7 +41,8 @@ class DyePalette final
* The string is either a file name or a sequence of hexadecimal RGB
* values separated by ',' and starting with '#'.
*/
- DyePalette(const std::string &pallete, const uint8_t blockSize);
+ DyePalette(const std::string &restrict pallete,
+ const uint8_t blockSize);
A_DELETE_COPY(DyePalette)
@@ -50,34 +51,37 @@ class DyePalette final
* implicitly black (0, 0, 0).
*/
void getColor(const unsigned int intensity,
- unsigned int (&color)[3]) const;
+ unsigned int (&restrict color)[3]) const restrict2;
/**
* Gets a pixel color depending on its intensity.
*/
- void getColor(double intensity, int (&color)[3]) const;
+ void getColor(double intensity,
+ int (&restrict color)[3]) const restrict2;
/**
* replace colors for SDL for S dye.
*/
- void replaceSColor(uint32_t *restrict pixels, const int bufSize) const;
+ void replaceSColor(uint32_t *restrict pixels,
+ const int bufSize) const restrict2;
/**
- * replace colors for SDL for S dye.
+ * replace colors for SDL for A dye.
*/
- void replaceAColor(uint32_t *restrict pixels, const int bufSize) const;
+ void replaceAColor(uint32_t *restrict pixels,
+ const int bufSize) const restrict2;
/**
* replace colors for OpenGL for S dye.
*/
void replaceSOGLColor(uint32_t *restrict pixels,
- const int bufSize) const;
+ const int bufSize) const restrict2;
/**
* replace colors for OpenGL for A dye.
*/
void replaceAOGLColor(uint32_t *restrict pixels,
- const int bufSize) const;
+ const int bufSize) const restrict2;
static unsigned int hexDecode(const signed char c)
A_CONST A_WARN_UNUSED;