Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2015-08-12 23:17:27 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2015-10-10 18:35:30 +0300
commitb0986091868f928b5e09c1a7f51654e102bf5f54 (patch)
tree40d5b2f597b27dc0c92dd8a44dd85043a1b4e726 /source/blender/imbuf/intern/dds
parent2a97c17549a858ce1beac22777bc0d2f3a535eb8 (diff)
Fix various compiler warnings.
Diffstat (limited to 'source/blender/imbuf/intern/dds')
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp18
-rw-r--r--source/blender/imbuf/intern/dds/Common.h12
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp40
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.cpp4
4 files changed, 38 insertions, 36 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));
}
}
}
diff --git a/source/blender/imbuf/intern/dds/Common.h b/source/blender/imbuf/intern/dds/Common.h
index ab929b82264..b1beb3f3a1b 100644
--- a/source/blender/imbuf/intern/dds/Common.h
+++ b/source/blender/imbuf/intern/dds/Common.h
@@ -28,14 +28,14 @@
#ifndef __COMMON_H__
#define __COMMON_H__
-#ifndef min
-#define min(a,b) ((a) <= (b) ? (a) : (b))
+#ifndef MIN
+#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#endif
-#ifndef max
-#define max(a,b) ((a) >= (b) ? (a) : (b))
+#ifndef MAX
+#define MAX(a,b) ((a) >= (b) ? (a) : (b))
#endif
-#ifndef clamp
-#define clamp(x,a,b) min(max((x), (a)), (b))
+#ifndef CLAMP
+#define CLAMP(x,a,b) MIN(MAX((x), (a)), (b))
#endif
template<typename T>
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 6bf82776afe..a4281514e39 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -83,7 +83,7 @@ static const uint FOURCC_RXGB = DDS_MAKEFOURCC('R', 'X', 'G', 'B');
static const uint FOURCC_ATI1 = DDS_MAKEFOURCC('A', 'T', 'I', '1');
static const uint FOURCC_ATI2 = DDS_MAKEFOURCC('A', 'T', 'I', '2');
-static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y');
+//static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y');
static const uint FOURCC_DX10 = DDS_MAKEFOURCC('D', 'X', '1', '0');
@@ -107,25 +107,25 @@ static const uint D3DFMT_X8B8G8R8 = 33;
static const uint D3DFMT_G16R16 = 34;
static const uint D3DFMT_A2R10G10B10 = 35;
-static const uint D3DFMT_A16B16G16R16 = 36;
+//static const uint D3DFMT_A16B16G16R16 = 36;
// Palette formats.
-static const uint D3DFMT_A8P8 = 40;
-static const uint D3DFMT_P8 = 41;
+//static const uint D3DFMT_A8P8 = 40;
+//static const uint D3DFMT_P8 = 41;
// Luminance formats.
static const uint D3DFMT_L8 = 50;
-static const uint D3DFMT_A8L8 = 51;
-static const uint D3DFMT_A4L4 = 52;
+//static const uint D3DFMT_A8L8 = 51;
+//static const uint D3DFMT_A4L4 = 52;
static const uint D3DFMT_L16 = 81;
// Floating point formats
-static const uint D3DFMT_R16F = 111;
-static const uint D3DFMT_G16R16F = 112;
-static const uint D3DFMT_A16B16G16R16F = 113;
-static const uint D3DFMT_R32F = 114;
-static const uint D3DFMT_G32R32F = 115;
-static const uint D3DFMT_A32B32G32R32F = 116;
+//static const uint D3DFMT_R16F = 111;
+//static const uint D3DFMT_G16R16F = 112;
+//static const uint D3DFMT_A16B16G16R16F = 113;
+//static const uint D3DFMT_R32F = 114;
+//static const uint D3DFMT_G32R32F = 115;
+//static const uint D3DFMT_A32B32G32R32F = 116;
static const uint DDSD_CAPS = 0x00000001U;
static const uint DDSD_PIXELFORMAT = 0x00001000U;
@@ -1102,8 +1102,8 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
// Compute width and height.
for (uint m = 0; m < mipmap; m++)
{
- w = max(1U, w / 2);
- h = max(1U, h / 2);
+ w = MAX(1U, w / 2);
+ h = MAX(1U, h / 2);
}
img->allocate(w, h);
@@ -1223,9 +1223,9 @@ void DirectDrawSurface::readBlockImage(Image *img)
readBlock(&block);
// Write color block.
- for (uint y = 0; y < min(4U, h-4*by); y++)
+ for (uint y = 0; y < MIN(4U, h-4*by); y++)
{
- for (uint x = 0; x < min(4U, w-4*bx); x++)
+ for (uint x = 0; x < MIN(4U, w-4*bx); x++)
{
img->pixel(4*bx+x, 4*by+y) = block.color(x, y);
}
@@ -1240,7 +1240,7 @@ static Color32 buildNormal(uint8 x, uint8 y)
float ny = 2 * (y / 255.0f) - 1;
float nz = 0.0f;
if (1 - nx*nx - ny*ny > 0) nz = sqrt(1 - nx*nx - ny*ny);
- uint8 z = clamp(int(255.0f * (nz + 1) / 2.0f), 0, 255);
+ uint8 z = CLAMP(int(255.0f * (nz + 1) / 2.0f), 0, 255);
return Color32(x, y, z);
}
@@ -1379,9 +1379,9 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const
for (uint m = 0; m < mipmap; m++)
{
- w = max(1U, w / 2);
- h = max(1U, h / 2);
- d = max(1U, d / 2);
+ w = MAX(1U, w / 2);
+ h = MAX(1U, h / 2);
+ d = MAX(1U, d / 2);
}
if (header.pf.flags & DDPF_FOURCC)
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp
index 4f63d17dc90..604796d1705 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.cpp
+++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp
@@ -246,8 +246,8 @@ int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels,
// mip levels are contiguous.
data += block_bytes * blocks;
- mip_width = max(1U, mip_width >> 1);
- mip_height = max(1U, mip_height >> 1);
+ mip_width = MAX(1U, mip_width >> 1);
+ mip_height = MAX(1U, mip_height >> 1);
}
return 1;