diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-08-12 23:17:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-10-10 18:35:30 +0300 |
commit | b0986091868f928b5e09c1a7f51654e102bf5f54 (patch) | |
tree | 40d5b2f597b27dc0c92dd8a44dd85043a1b4e726 /source/blender/imbuf/intern/dds/ColorBlock.cpp | |
parent | 2a97c17549a858ce1beac22777bc0d2f3a535eb8 (diff) |
Fix various compiler warnings.
Diffstat (limited to 'source/blender/imbuf/intern/dds/ColorBlock.cpp')
-rw-r--r-- | source/blender/imbuf/intern/dds/ColorBlock.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index 28f31fcad8b..dd4ae3e518e 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -38,6 +38,7 @@ #include <Image.h> #include <Common.h> +#if 0 // Get approximate luminance. inline static uint colorLuminance(Color32 c) { @@ -49,6 +50,7 @@ { return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) + (c0.b - c1.b) * (c0.b - c1.b); } +#endif /// Default constructor. @@ -86,8 +88,8 @@ void ColorBlock::init(const Image *img, uint x, uint y) void ColorBlock::init(uint w, uint h, const uint *data, uint x, uint y) { - const uint bw = min(w - x, 4U); - const uint bh = min(h - y, 4U); + const uint bw = MIN(w - x, 4U); + const uint bh = MIN(h - y, 4U); // Blocks that are smaller than 4x4 are handled by repeating the pixels. // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( @@ -107,8 +109,8 @@ void ColorBlock::init(uint w, uint h, const uint *data, uint x, uint y) void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y) { - const uint bw = min(w - x, 4U); - const uint bh = min(h - y, 4U); + const uint bw = MIN(w - x, 4U); + const uint bh = MIN(h - y, 4U); // Blocks that are smaller than 4x4 are handled by repeating the pixels. // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( @@ -124,10 +126,10 @@ void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y) const uint idx = ((y + by) * w + x + bx); Color32 & c = color(e, i); - c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? - c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f)); - c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f)); - c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f)); + c.r = uint8(255 * CLAMP(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? + c.g = uint8(255 * CLAMP(data[idx + 1 * srcPlane], 0.0f, 1.0f)); + c.b = uint8(255 * CLAMP(data[idx + 2 * srcPlane], 0.0f, 1.0f)); + c.a = uint8(255 * CLAMP(data[idx + 3 * srcPlane], 0.0f, 1.0f)); } } } |