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:
authorCampbell Barton <ideasman42@gmail.com>2018-06-17 18:04:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-17 18:04:54 +0300
commite74bd46ede9a957c03821e36b80ad2d2f378bf73 (patch)
tree76fa7d9f44992dc5715525e06da71b36e69356ce /source/blender/imbuf/intern/dds
parent1eed46c788f1c9e0d92985857bdbf5a7045f6791 (diff)
Cleanup: trailing space for imbuf module
Diffstat (limited to 'source/blender/imbuf/intern/dds')
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp80
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.h38
-rw-r--r--source/blender/imbuf/intern/dds/CMakeLists.txt4
-rw-r--r--source/blender/imbuf/intern/dds/Color.h4
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp56
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.h18
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp176
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.h30
-rw-r--r--source/blender/imbuf/intern/dds/Image.h26
-rw-r--r--source/blender/imbuf/intern/dds/PixelFormat.h8
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp2
11 files changed, 221 insertions, 221 deletions
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 8e571483e08..170cf620701 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -33,7 +33,7 @@
*/
// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
+//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
@@ -42,10 +42,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -71,37 +71,37 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
color_array[0].g = (col0.g << 2) | (col0.g >> 4);
color_array[0].r = (col0.r << 3) | (col0.r >> 2);
color_array[0].a = 0xFF;
-
+
// @@ Same as above, but faster?
// Color32 c;
// c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000);
// c.u |= (c.u >> 5) & 0x070007;
// c.u |= (c.u >> 6) & 0x000300;
// color_array[0].u = c.u;
-
+
color_array[1].r = (col1.r << 3) | (col1.r >> 2);
color_array[1].g = (col1.g << 2) | (col1.g >> 4);
color_array[1].b = (col1.b << 3) | (col1.b >> 2);
color_array[1].a = 0xFF;
-
+
// @@ Same as above, but faster?
// c.u = ((col1.u << 3) & 0xf8) | ((col1.u << 5) & 0xfc00) | ((col1.u << 8) & 0xf80000);
// c.u |= (c.u >> 5) & 0x070007;
// c.u |= (c.u >> 6) & 0x000300;
// color_array[1].u = c.u;
-
+
if ( col0.u > col1.u ) {
// Four-color block: derive the other two colors.
color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
color_array[2].a = 0xFF;
-
+
color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3;
color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
color_array[3].a = 0xFF;
-
+
return 4;
}
else {
@@ -110,13 +110,13 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
color_array[2].a = 0xFF;
-
+
// Set all components to 0 to match DXT specs.
color_array[3].r = 0x00; // color_array[2].r;
color_array[3].g = 0x00; // color_array[2].g;
color_array[3].b = 0x00; // color_array[2].b;
color_array[3].a = 0x00;
-
+
return 3;
}
}
@@ -134,7 +134,7 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
color_array[1].g = (col1.g << 2) | (col1.g >> 4);
color_array[1].b = (3 * col1.b * 22) / 8;
color_array[1].a = 0xFF;
-
+
int gdiff = color_array[1].g - color_array[0].g;
if ( col0.u > col1.u ) {
@@ -143,7 +143,7 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
color_array[2].a = 0xFF;
-
+
color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
@@ -157,13 +157,13 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
color_array[2].b = ((col0.b + col1.b) * 33) / 8;
color_array[2].a = 0xFF;
-
+
// Set all components to 0 to match DXT specs.
color_array[3].r = 0x00; // color_array[2].r;
color_array[3].g = 0x00; // color_array[2].g;
color_array[3].b = 0x00; // color_array[2].b;
color_array[3].a = 0x00;
-
+
return 3;
}
}
@@ -175,18 +175,18 @@ void BlockDXT1::evaluatePalette3(Color32 color_array[4]) const
color_array[0].g = (col0.g << 2) | (col0.g >> 4);
color_array[0].r = (col0.r << 3) | (col0.r >> 2);
color_array[0].a = 0xFF;
-
+
color_array[1].r = (col1.r << 3) | (col1.r >> 2);
color_array[1].g = (col1.g << 2) | (col1.g >> 4);
color_array[1].b = (col1.b << 3) | (col1.b >> 2);
color_array[1].a = 0xFF;
-
+
// Three-color block: derive the other color.
color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
color_array[2].a = 0xFF;
-
+
// Set all components to 0 to match DXT specs.
color_array[3].r = 0x00; // color_array[2].r;
color_array[3].g = 0x00; // color_array[2].g;
@@ -201,18 +201,18 @@ void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const
color_array[0].g = (col0.g << 2) | (col0.g >> 4);
color_array[0].r = (col0.r << 3) | (col0.r >> 2);
color_array[0].a = 0xFF;
-
+
color_array[1].r = (col1.r << 3) | (col1.r >> 2);
color_array[1].g = (col1.g << 2) | (col1.g >> 4);
color_array[1].b = (col1.b << 3) | (col1.b >> 2);
color_array[1].a = 0xFF;
-
+
// Four-color block: derive the other two colors.
color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
color_array[2].a = 0xFF;
-
+
color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3;
color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
@@ -225,7 +225,7 @@ void BlockDXT1::decodeBlock(ColorBlock *block) const
// Decode color block.
Color32 color_array[4];
evaluatePalette(color_array);
-
+
// Write color block.
for ( uint j = 0; j < 4; j++ ) {
for ( uint i = 0; i < 4; i++ ) {
@@ -281,7 +281,7 @@ void BlockDXT3::decodeBlock(ColorBlock *block) const
{
// Decode color.
color.decodeBlock(block);
-
+
// Decode alpha.
alpha.decodeBlock(block);
}
@@ -419,10 +419,10 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock *block) const
{
uint8 alpha_array[8];
evaluatePalette(alpha_array);
-
+
uint8 index_array[16];
indices(index_array);
-
+
for (uint i = 0; i < 16; i++) {
block->color(i).a = alpha_array[index_array[i]];
}
@@ -431,26 +431,26 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock *block) const
void AlphaBlockDXT5::flip4()
{
uint64 * b = (uint64 *)this;
-
+
// @@ The masks might have to be byte swapped.
uint64 tmp = (*b & (uint64)(0x000000000000FFFFLL));
tmp |= (*b & (uint64)(0x000000000FFF0000LL)) << 36;
tmp |= (*b & (uint64)(0x000000FFF0000000LL)) << 12;
tmp |= (*b & (uint64)(0x000FFF0000000000LL)) >> 12;
tmp |= (*b & (uint64)(0xFFF0000000000000LL)) >> 36;
-
+
*b = tmp;
}
void AlphaBlockDXT5::flip2()
{
uint * b = (uint *)this;
-
+
// @@ The masks might have to be byte swapped.
uint tmp = (*b & 0xFF000000);
tmp |= (*b & 0x00000FFF) << 12;
tmp |= (*b & 0x00FFF000) >> 12;
-
+
*b = tmp;
}
@@ -458,7 +458,7 @@ void BlockDXT5::decodeBlock(ColorBlock *block) const
{
// Decode color.
color.decodeBlock(block);
-
+
// Decode alpha.
alpha.decodeBlock(block);
}
@@ -467,7 +467,7 @@ void BlockDXT5::decodeBlockNV5x(ColorBlock *block) const
{
// Decode color.
color.decodeBlockNV5x(block);
-
+
// Decode alpha.
alpha.decodeBlock(block);
}
@@ -492,10 +492,10 @@ void BlockATI1::decodeBlock(ColorBlock *block) const
{
uint8 alpha_array[8];
alpha.evaluatePalette(alpha_array);
-
+
uint8 index_array[16];
alpha.indices(index_array);
-
+
for (uint i = 0; i < 16; i++) {
Color32 & c = block->color(i);
c.b = c.g = c.r = alpha_array[index_array[i]];
@@ -521,10 +521,10 @@ void BlockATI2::decodeBlock(ColorBlock *block) const
{
uint8 alpha_array[8];
uint8 index_array[16];
-
+
x.evaluatePalette(alpha_array);
x.indices(index_array);
-
+
for (uint i = 0; i < 16; i++) {
Color32 & c = block->color(i);
c.r = alpha_array[index_array[i]];
@@ -532,7 +532,7 @@ void BlockATI2::decodeBlock(ColorBlock *block) const
y.evaluatePalette(alpha_array);
y.indices(index_array);
-
+
for (uint i = 0; i < 16; i++) {
Color32 & c = block->color(i);
c.g = alpha_array[index_array[i]];
@@ -563,17 +563,17 @@ void BlockCTX1::evaluatePalette(Color32 color_array[4]) const
color_array[0].g = col0[1];
color_array[0].r = col0[0];
color_array[0].a = 0xFF;
-
+
color_array[1].r = 0x00;
color_array[1].g = col0[1];
color_array[1].b = col1[0];
color_array[1].a = 0xFF;
-
+
color_array[2].r = 0x00;
color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
color_array[2].a = 0xFF;
-
+
color_array[3].r = 0x00;
color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
@@ -585,7 +585,7 @@ void BlockCTX1::decodeBlock(ColorBlock *block) const
// Decode color block.
Color32 color_array[4];
evaluatePalette(color_array);
-
+
// Write color block.
for ( uint j = 0; j < 4; j++ ) {
for ( uint i = 0; i < 4; i++ ) {
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h
index 6aae9c9817c..7371d72ea4a 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.h
+++ b/source/blender/imbuf/intern/dds/BlockDXT.h
@@ -33,7 +33,7 @@
*/
// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
+//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
@@ -42,10 +42,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -79,10 +79,10 @@ struct BlockDXT1 {
void evaluatePalette3(Color32 color_array[4]) const;
void evaluatePalette4(Color32 color_array[4]) const;
-
+
void decodeBlock(ColorBlock * block) const;
void decodeBlockNV5x(ColorBlock * block) const;
-
+
void setIndices(int * idx);
void flip4();
@@ -119,9 +119,9 @@ struct AlphaBlockDXT3 {
};
uint16 row[4];
};
-
+
void decodeBlock(ColorBlock * block) const;
-
+
void flip4();
void flip2();
};
@@ -131,10 +131,10 @@ struct AlphaBlockDXT3 {
struct BlockDXT3 {
AlphaBlockDXT3 alpha;
BlockDXT1 color;
-
+
void decodeBlock(ColorBlock * block) const;
void decodeBlockNV5x(ColorBlock * block) const;
-
+
void flip4();
void flip2();
};
@@ -187,7 +187,7 @@ struct AlphaBlockDXT5 {
uint8 bitsD() const { return (u >> 55) & 0x7LL; }
uint8 bitsE() const { return (u >> 58) & 0x7LL; }
uint8 bitsF() const { return (u >> 61) & 0x7LL; }
-
+
void evaluatePalette(uint8 alpha[8]) const;
void evaluatePalette8(uint8 alpha[8]) const;
void evaluatePalette6(uint8 alpha[8]) const;
@@ -195,9 +195,9 @@ struct AlphaBlockDXT5 {
uint index(uint index) const;
void setIndex(uint index, uint value);
-
+
void decodeBlock(ColorBlock * block) const;
-
+
void flip4();
void flip2();
};
@@ -207,10 +207,10 @@ struct AlphaBlockDXT5 {
struct BlockDXT5 {
AlphaBlockDXT5 alpha;
BlockDXT1 color;
-
+
void decodeBlock(ColorBlock * block) const;
void decodeBlockNV5x(ColorBlock * block) const;
-
+
void flip4();
void flip2();
};
@@ -218,9 +218,9 @@ struct BlockDXT5 {
/// ATI1 block.
struct BlockATI1 {
AlphaBlockDXT5 alpha;
-
+
void decodeBlock(ColorBlock * block) const;
-
+
void flip4();
void flip2();
};
@@ -229,9 +229,9 @@ struct BlockATI1 {
struct BlockATI2 {
AlphaBlockDXT5 x;
AlphaBlockDXT5 y;
-
+
void decodeBlock(ColorBlock * block) const;
-
+
void flip4();
void flip2();
};
@@ -249,7 +249,7 @@ struct BlockCTX1 {
void setIndices(int * idx);
void decodeBlock(ColorBlock * block) const;
-
+
void flip4();
void flip2();
};
diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt
index 57603725ce1..8c95695f356 100644
--- a/source/blender/imbuf/intern/dds/CMakeLists.txt
+++ b/source/blender/imbuf/intern/dds/CMakeLists.txt
@@ -19,11 +19,11 @@
#
# The Original Code is: all of this file.
#
-# Contributor(s):
+# Contributor(s):
#
# ***** END GPL LICENSE BLOCK *****
-set(INC
+set(INC
.
..
../..
diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h
index 6676057d710..51939a6ea4c 100644
--- a/source/blender/imbuf/intern/dds/Color.h
+++ b/source/blender/imbuf/intern/dds/Color.h
@@ -69,7 +69,7 @@ public:
operator unsigned int () const {
return u;
}
-
+
union {
struct {
unsigned char b, g, r, a;
@@ -85,7 +85,7 @@ public:
Color16() { }
Color16(const Color16 & c) : u(c.u) { }
explicit Color16(unsigned short U) : u(U) { }
-
+
union {
struct {
unsigned short b : 5;
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index dd4ae3e518e..2cee4c984dd 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -44,14 +44,14 @@
{
return c.r + c.g + c.b;
}
-
+
// Get the euclidean distance between the given colors.
inline static uint colorDistance(Color32 c0, Color32 c1)
{
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.
ColorBlock::ColorBlock()
@@ -120,11 +120,11 @@ void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y)
for (uint i = 0; i < 4; i++) {
const uint by = i % bh;
-
+
for (uint e = 0; e < 4; e++) {
const uint bx = e % bw;
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));
@@ -160,13 +160,13 @@ void ColorBlock::swizzle(uint x, uint y, uint z, uint w)
bool ColorBlock::isSingleColor(Color32 mask/*= Color32(0xFF, 0xFF, 0xFF, 0x00)*/) const
{
uint u = m_color[0].u & mask.u;
-
+
for (int i = 1; i < 16; i++) {
if (u != (m_color[i].u & mask.u)) {
return false;
}
}
-
+
return true;
}
@@ -191,7 +191,7 @@ bool ColorBlock::isSingleColorNoAlpha() const
return false;
}
}
-
+
return true;
}
*/
@@ -210,12 +210,12 @@ bool ColorBlock::isSingleColorNoAlpha() const
unique = false;
}
}
-
+
if ( unique ) {
count++;
}
}
-
+
return count;
}*/
@@ -231,7 +231,7 @@ Color32 ColorBlock::averageColor() const
b += m_color[i].b;
a += m_color[i].a;
}
-
+
return Color32(uint8(r / 16), uint8(g / 16), uint8(b / 16), uint8(a / 16));
}*/
@@ -251,7 +251,7 @@ void ColorBlock::diameterRange(Color32 *start, Color32 *end) const
{
Color32 c0, c1;
uint best_dist = 0;
-
+
for (int i = 0; i < 16; i++) {
for (int j = i+1; j < 16; j++) {
uint dist = colorDistance(m_color[i], m_color[j]);
@@ -262,7 +262,7 @@ void ColorBlock::diameterRange(Color32 *start, Color32 *end) const
}
}
}
-
+
*start = c0;
*end = c1;
}
@@ -272,13 +272,13 @@ void ColorBlock::luminanceRange(Color32 *start, Color32 *end) const
{
Color32 minColor, maxColor;
uint minLuminance, maxLuminance;
-
+
maxLuminance = minLuminance = colorLuminance(m_color[0]);
-
+
for (uint i = 1; i < 16; i++)
{
uint luminance = colorLuminance(m_color[i]);
-
+
if (luminance > maxLuminance) {
maxLuminance = luminance;
maxColor = m_color[i];
@@ -293,7 +293,7 @@ void ColorBlock::luminanceRange(Color32 *start, Color32 *end) const
*end = maxColor;
}
-/// Get color range based on the bounding box.
+/// Get color range based on the bounding box.
void ColorBlock::boundsRange(Color32 *start, Color32 *end) const
{
Color32 minColor(255, 255, 255);
@@ -327,7 +327,7 @@ void ColorBlock::boundsRange(Color32 *start, Color32 *end) const
*end = maxColor;
}
-/// Get color range based on the bounding box.
+/// Get color range based on the bounding box.
void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const
{
Color32 minColor(255, 255, 255, 255);
@@ -361,7 +361,7 @@ void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const
maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0;
maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0;
maxColor.a = (maxColor.a >= inset.a) ? maxColor.a - inset.a : 0;
-
+
*start = minColor;
*end = maxColor;
}
@@ -374,10 +374,10 @@ void ColorBlock::sortColorsByAbsoluteValue()
for ( uint a = 0; a < 16; a++ ) {
uint max = a;
Color16 cmax(m_color[a]);
-
+
for ( uint b = a+1; b < 16; b++ ) {
Color16 cb(m_color[b]);
-
+
if ( cb.u > cmax.u ) {
max = b;
cmax = cb;
@@ -391,17 +391,17 @@ void ColorBlock::sortColorsByAbsoluteValue()
/*/// Find extreme colors in the given axis.
void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) const
{
-
+
int mini, maxi;
mini = maxi = 0;
-
+
float min, max;
min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis);
for (uint i = 1; i < 16; i++)
{
const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
-
+
float val = dot(vec, axis);
if ( val < min ) {
mini = i;
@@ -412,7 +412,7 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) c
max = val;
}
}
-
+
*start = m_color[mini];
*end = m_color[maxi];
}*/
@@ -422,12 +422,12 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) c
void ColorBlock::sortColors(const Vector3 & axis)
{
float luma_array[16];
-
+
for (uint i = 0; i < 16; i++) {
const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
luma_array[i] = dot(vec, axis);
}
-
+
// Dummy selection sort.
for ( uint a = 0; a < 16; a++ ) {
uint min = a;
@@ -447,12 +447,12 @@ float ColorBlock::volume() const
{
Box bounds;
bounds.clearBounds();
-
+
for (int i = 0; i < 16; i++) {
const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b);
bounds.addPointToBounds(point);
}
-
+
return bounds.volume();
}
*/
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h
index 8d5031aa603..7b5291cf976 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.h
+++ b/source/blender/imbuf/intern/dds/ColorBlock.h
@@ -46,30 +46,30 @@ struct ColorBlock {
ColorBlock(const uint * linearImage);
ColorBlock(const ColorBlock & block);
ColorBlock(const Image * img, uint x, uint y);
-
+
void init(const Image * img, uint x, uint y);
void init(uint w, uint h, const uint * data, uint x, uint y);
void init(uint w, uint h, const float * data, uint x, uint y);
-
+
void swizzle(uint x, uint y, uint z, uint w); // 0=r, 1=g, 2=b, 3=a, 4=0xFF, 5=0
-
+
bool isSingleColor(Color32 mask = Color32(0xFF, 0xFF, 0xFF, 0x00)) const;
bool hasAlpha() const;
-
-
+
+
// Accessors
const Color32 * colors() const;
Color32 color(uint i) const;
Color32 & color(uint i);
-
+
Color32 color(uint x, uint y) const;
Color32 & color(uint x, uint y);
-
+
private:
-
+
Color32 m_color[4 * 4];
-
+
};
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 7c11fca3c34..97ce5b90fa0 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -33,7 +33,7 @@
*/
// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
+//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
@@ -42,10 +42,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -84,7 +84,7 @@ 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_DX10 = DDS_MAKEFOURCC('D', 'X', '1', '0');
static const uint FOURCC_UVER = DDS_MAKEFOURCC('U', 'V', 'E', 'R');
@@ -112,7 +112,7 @@ static const uint D3DFMT_A2R10G10B10 = 35;
// Palette formats.
//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;
@@ -126,7 +126,7 @@ static const uint D3DFMT_L16 = 81;
//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;
static const uint DDSD_WIDTH = 0x00000004U;
@@ -135,7 +135,7 @@ static const uint DDSD_PITCH = 0x00000008U;
static const uint DDSD_MIPMAPCOUNT = 0x00020000U;
static const uint DDSD_LINEARSIZE = 0x00080000U;
static const uint DDSD_DEPTH = 0x00800000U;
-
+
static const uint DDSCAPS_COMPLEX = 0x00000008U;
static const uint DDSCAPS_TEXTURE = 0x00001000U;
static const uint DDSCAPS_MIPMAP = 0x00400000U;
@@ -162,78 +162,78 @@ static const uint DDPF_LUMINANCE = 0x00020000U;
static const uint DDPF_ALPHAPREMULT = 0x00008000U;
// Custom NVTT flags.
-static const uint DDPF_NORMAL = 0x80000000U;
+static const uint DDPF_NORMAL = 0x80000000U;
static const uint DDPF_SRGB = 0x40000000U;
// DX10 formats.
enum DXGI_FORMAT
{
DXGI_FORMAT_UNKNOWN = 0,
-
+
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
DXGI_FORMAT_R32G32B32A32_UINT = 3,
DXGI_FORMAT_R32G32B32A32_SINT = 4,
-
+
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
DXGI_FORMAT_R32G32B32_FLOAT = 6,
DXGI_FORMAT_R32G32B32_UINT = 7,
DXGI_FORMAT_R32G32B32_SINT = 8,
-
+
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
DXGI_FORMAT_R16G16B16A16_UINT = 12,
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
DXGI_FORMAT_R16G16B16A16_SINT = 14,
-
+
DXGI_FORMAT_R32G32_TYPELESS = 15,
DXGI_FORMAT_R32G32_FLOAT = 16,
DXGI_FORMAT_R32G32_UINT = 17,
DXGI_FORMAT_R32G32_SINT = 18,
-
+
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
-
+
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
DXGI_FORMAT_R10G10B10A2_UINT = 25,
-
+
DXGI_FORMAT_R11G11B10_FLOAT = 26,
-
+
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
DXGI_FORMAT_R8G8B8A8_UINT = 30,
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
DXGI_FORMAT_R8G8B8A8_SINT = 32,
-
+
DXGI_FORMAT_R16G16_TYPELESS = 33,
DXGI_FORMAT_R16G16_FLOAT = 34,
DXGI_FORMAT_R16G16_UNORM = 35,
DXGI_FORMAT_R16G16_UINT = 36,
DXGI_FORMAT_R16G16_SNORM = 37,
DXGI_FORMAT_R16G16_SINT = 38,
-
+
DXGI_FORMAT_R32_TYPELESS = 39,
DXGI_FORMAT_D32_FLOAT = 40,
DXGI_FORMAT_R32_FLOAT = 41,
DXGI_FORMAT_R32_UINT = 42,
DXGI_FORMAT_R32_SINT = 43,
-
+
DXGI_FORMAT_R24G8_TYPELESS = 44,
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
-
+
DXGI_FORMAT_R8G8_TYPELESS = 48,
DXGI_FORMAT_R8G8_UNORM = 49,
DXGI_FORMAT_R8G8_UINT = 50,
DXGI_FORMAT_R8G8_SNORM = 51,
DXGI_FORMAT_R8G8_SINT = 52,
-
+
DXGI_FORMAT_R16_TYPELESS = 53,
DXGI_FORMAT_R16_FLOAT = 54,
DXGI_FORMAT_D16_UNORM = 55,
@@ -241,41 +241,41 @@ static const uint DDPF_SRGB = 0x40000000U;
DXGI_FORMAT_R16_UINT = 57,
DXGI_FORMAT_R16_SNORM = 58,
DXGI_FORMAT_R16_SINT = 59,
-
+
DXGI_FORMAT_R8_TYPELESS = 60,
DXGI_FORMAT_R8_UNORM = 61,
DXGI_FORMAT_R8_UINT = 62,
DXGI_FORMAT_R8_SNORM = 63,
DXGI_FORMAT_R8_SINT = 64,
DXGI_FORMAT_A8_UNORM = 65,
-
+
DXGI_FORMAT_R1_UNORM = 66,
-
+
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
-
+
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
-
+
DXGI_FORMAT_BC1_TYPELESS = 70,
DXGI_FORMAT_BC1_UNORM = 71,
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
-
+
DXGI_FORMAT_BC2_TYPELESS = 73,
DXGI_FORMAT_BC2_UNORM = 74,
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
-
+
DXGI_FORMAT_BC3_TYPELESS = 76,
DXGI_FORMAT_BC3_UNORM = 77,
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
-
+
DXGI_FORMAT_BC4_TYPELESS = 79,
DXGI_FORMAT_BC4_UNORM = 80,
DXGI_FORMAT_BC4_SNORM = 81,
-
+
DXGI_FORMAT_BC5_TYPELESS = 82,
DXGI_FORMAT_BC5_UNORM = 83,
DXGI_FORMAT_BC5_SNORM = 84,
-
+
DXGI_FORMAT_B5G6R5_UNORM = 85,
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
@@ -312,71 +312,71 @@ static const uint DDPF_SRGB = 0x40000000U;
switch (dxgiFormat)
{
CASE(UNKNOWN);
-
+
CASE(R32G32B32A32_TYPELESS);
CASE(R32G32B32A32_FLOAT);
CASE(R32G32B32A32_UINT);
CASE(R32G32B32A32_SINT);
-
+
CASE(R32G32B32_TYPELESS);
CASE(R32G32B32_FLOAT);
CASE(R32G32B32_UINT);
CASE(R32G32B32_SINT);
-
+
CASE(R16G16B16A16_TYPELESS);
CASE(R16G16B16A16_FLOAT);
CASE(R16G16B16A16_UNORM);
CASE(R16G16B16A16_UINT);
CASE(R16G16B16A16_SNORM);
CASE(R16G16B16A16_SINT);
-
+
CASE(R32G32_TYPELESS);
CASE(R32G32_FLOAT);
CASE(R32G32_UINT);
CASE(R32G32_SINT);
-
+
CASE(R32G8X24_TYPELESS);
CASE(D32_FLOAT_S8X24_UINT);
CASE(R32_FLOAT_X8X24_TYPELESS);
CASE(X32_TYPELESS_G8X24_UINT);
-
+
CASE(R10G10B10A2_TYPELESS);
CASE(R10G10B10A2_UNORM);
CASE(R10G10B10A2_UINT);
-
+
CASE(R11G11B10_FLOAT);
-
+
CASE(R8G8B8A8_TYPELESS);
CASE(R8G8B8A8_UNORM);
CASE(R8G8B8A8_UNORM_SRGB);
CASE(R8G8B8A8_UINT);
CASE(R8G8B8A8_SNORM);
CASE(R8G8B8A8_SINT);
-
+
CASE(R16G16_TYPELESS);
CASE(R16G16_FLOAT);
CASE(R16G16_UNORM);
CASE(R16G16_UINT);
CASE(R16G16_SNORM);
CASE(R16G16_SINT);
-
+
CASE(R32_TYPELESS);
CASE(D32_FLOAT);
CASE(R32_FLOAT);
CASE(R32_UINT);
CASE(R32_SINT);
-
+
CASE(R24G8_TYPELESS);
CASE(D24_UNORM_S8_UINT);
CASE(R24_UNORM_X8_TYPELESS);
CASE(X24_TYPELESS_G8_UINT);
-
+
CASE(R8G8_TYPELESS);
CASE(R8G8_UNORM);
CASE(R8G8_UINT);
CASE(R8G8_SNORM);
CASE(R8G8_SINT);
-
+
CASE(R16_TYPELESS);
CASE(R16_FLOAT);
CASE(D16_UNORM);
@@ -384,7 +384,7 @@ static const uint DDPF_SRGB = 0x40000000U;
CASE(R16_UINT);
CASE(R16_SNORM);
CASE(R16_SINT);
-
+
CASE(R8_TYPELESS);
CASE(R8_UNORM);
CASE(R8_UINT);
@@ -393,28 +393,28 @@ static const uint DDPF_SRGB = 0x40000000U;
CASE(A8_UNORM);
CASE(R1_UNORM);
-
+
CASE(R9G9B9E5_SHAREDEXP);
-
+
CASE(R8G8_B8G8_UNORM);
CASE(G8R8_G8B8_UNORM);
CASE(BC1_TYPELESS);
CASE(BC1_UNORM);
CASE(BC1_UNORM_SRGB);
-
+
CASE(BC2_TYPELESS);
CASE(BC2_UNORM);
CASE(BC2_UNORM_SRGB);
-
+
CASE(BC3_TYPELESS);
CASE(BC3_UNORM);
CASE(BC3_UNORM_SRGB);
-
+
CASE(BC4_TYPELESS);
CASE(BC4_UNORM);
CASE(BC4_SNORM);
-
+
CASE(BC5_TYPELESS);
CASE(BC5_UNORM);
CASE(BC5_SNORM);
@@ -424,12 +424,12 @@ static const uint DDPF_SRGB = 0x40000000U;
CASE(B8G8R8A8_UNORM);
CASE(B8G8R8X8_UNORM);
- default:
+ default:
return "UNKNOWN";
}
#undef CASE
}
-
+
static const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension)
{
switch (resourceDimension)
@@ -686,7 +686,7 @@ void DDSHeader::setFormatCode(uint32 code)
// set fourcc pixel format.
this->pf.flags = DDPF_FOURCC;
this->pf.fourcc = code;
-
+
this->pf.bitcount = 0;
this->pf.rmask = 0;
this->pf.gmask = 0;
@@ -803,7 +803,7 @@ void DDSHeader::swapBytes()
this->pitch = POSH_LittleU32(this->pitch);
this->depth = POSH_LittleU32(this->depth);
this->mipmapcount = POSH_LittleU32(this->mipmapcount);
-
+
for (int i = 0; i < 11; i++) {
this->reserved[i] = POSH_LittleU32(this->reserved[i]);
}
@@ -898,12 +898,12 @@ bool DirectDrawSurface::isValid() const
{
return false;
}
-
+
const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/);
if ( (header.flags & required) != required ) {
return false;
}
-
+
if (header.pf.size != 32) {
return false;
}
@@ -958,20 +958,20 @@ bool DirectDrawSurface::isSupported() const
{
return false;
}
-
+
if (isTextureCube() && (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES)
{
// Cubemaps must contain all faces.
return false;
}
-
+
if (isTexture3D())
{
// @@ 3D textures not supported yet.
return false;
}
}
-
+
return true;
}
@@ -980,14 +980,14 @@ bool DirectDrawSurface::hasAlpha() const
if (header.hasDX10Header())
{
/* TODO: Update hasAlpha to handle all DX10 formats. */
- return
+ return
header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM ||
header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM ||
header.header10.dxgiFormat == DXGI_FORMAT_BC3_UNORM;
}
else
{
- if (header.pf.flags & DDPF_RGB)
+ if (header.pf.flags & DDPF_RGB)
{
return header.pf.amask != 0;
}
@@ -1096,19 +1096,19 @@ void DirectDrawSurface::setUserVersion(int version)
void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
{
stream.seek(offset(face, mipmap));
-
+
uint w = width();
uint h = height();
-
+
// Compute width and height.
for (uint m = 0; m < mipmap; m++)
{
w = MAX(1U, w / 2);
h = MAX(1U, h / 2);
}
-
+
img->allocate(w, h);
-
+
if (hasAlpha())
{
img->setFormat(Image::Format_ARGB);
@@ -1125,7 +1125,7 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
}
else
{
- if (header.pf.flags & DDPF_RGB)
+ if (header.pf.flags & DDPF_RGB)
{
readLinearImage(img);
}
@@ -1161,19 +1161,19 @@ void* DirectDrawSurface::readData(uint &rsize)
void DirectDrawSurface::readLinearImage(Image *img)
{
-
+
const uint w = img->width();
const uint h = img->height();
-
+
uint rshift, rsize;
PixelFormat::maskShiftAndSize(header.pf.rmask, &rshift, &rsize);
-
+
uint gshift, gsize;
PixelFormat::maskShiftAndSize(header.pf.gmask, &gshift, &gsize);
-
+
uint bshift, bsize;
PixelFormat::maskShiftAndSize(header.pf.bmask, &bshift, &bsize);
-
+
uint ashift, asize;
PixelFormat::maskShiftAndSize(header.pf.amask, &ashift, &asize);
@@ -1210,19 +1210,19 @@ void DirectDrawSurface::readBlockImage(Image *img)
const uint w = img->width();
const uint h = img->height();
-
+
const uint bw = (w + 3) / 4;
const uint bh = (h + 3) / 4;
-
+
for (uint by = 0; by < bh; by++)
{
for (uint bx = 0; bx < bw; bx++)
{
ColorBlock block;
-
+
// Read color block.
readBlock(&block);
-
+
// Write color block.
for (uint y = 0; y < MIN(4U, h-4*by); y++)
{
@@ -1242,7 +1242,7 @@ static Color32 buildNormal(uint8 x, uint8 y)
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);
-
+
return Color32(x, y, z);
}
@@ -1282,7 +1282,7 @@ void DirectDrawSurface::readBlock(ColorBlock *rgba)
BlockDXT5 block;
mem_read(stream, block);
block.decodeBlock(rgba);
-
+
if (fourcc == FOURCC_RXGB)
{
// Swap R & A.
@@ -1307,7 +1307,7 @@ void DirectDrawSurface::readBlock(ColorBlock *rgba)
mem_read(stream, block);
block.decodeBlock(rgba);
}
-
+
// If normal flag set, convert to normal.
if (header.pf.flags & DDPF_NORMAL)
{
@@ -1377,7 +1377,7 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const
uint w = width();
uint h = height();
uint d = depth();
-
+
for (uint m = 0; m < mipmap; m++)
{
w = MAX(1U, w / 2);
@@ -1408,19 +1408,19 @@ uint DirectDrawSurface::faceSize() const
{
const uint count = mipmapCount();
uint size = 0;
-
+
for (uint m = 0; m < count; m++)
{
size += mipmapSize(m);
}
-
+
return size;
}
uint DirectDrawSurface::offset(const uint face, const uint mipmap)
{
uint size = 128; // sizeof(DDSHeader);
-
+
if (header.hasDX10Header())
{
size += 20; // sizeof(DDSHeader10);
@@ -1430,12 +1430,12 @@ uint DirectDrawSurface::offset(const uint face, const uint mipmap)
{
size += face * faceSize();
}
-
+
for (uint m = 0; m < mipmap; m++)
{
size += mipmapSize(m);
}
-
+
return size;
}
@@ -1458,7 +1458,7 @@ void DirectDrawSurface::printInfo() const
if (header.flags & DDSD_PITCH) printf("Pitch: %u\n", header.pitch);
else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %u\n", header.pitch);
printf("Mipmap count: %u\n", header.mipmapcount);
-
+
printf("Pixel Format:\n");
printf("\tFlags: 0x%.8X\n", header.pf.flags);
if (header.pf.flags & DDPF_RGB) printf("\t\tDDPF_RGB\n");
@@ -1472,7 +1472,7 @@ void DirectDrawSurface::printInfo() const
if (header.pf.flags & DDPF_PALETTEINDEXED8) printf("\t\tDDPF_PALETTEINDEXED8\n");
if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
-
+
if (header.pf.fourcc != 0) {
// Display fourcc code even when DDPF_FOURCC flag not set.
printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n",
@@ -1541,7 +1541,7 @@ void DirectDrawSurface::printInfo() const
int major = (header.reserved[10] >> 16) & 0xFF;
int minor = (header.reserved[10] >> 8) & 0xFF;
int revision= header.reserved[10] & 0xFF;
-
+
printf("Version:\n");
printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision);
}
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
index 44c27a98c1d..b7bcb8303bf 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
@@ -33,7 +33,7 @@
*/
// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
+//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
@@ -42,10 +42,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -109,7 +109,7 @@ struct DDSHeader {
// Helper methods.
DDSHeader();
-
+
void setWidth(uint w);
void setHeight(uint h);
void setDepth(uint d);
@@ -128,9 +128,9 @@ struct DDSHeader {
void setSrgbFlag(bool b);
void setHasAlphaFlag(bool b);
void setUserVersion(int version);
-
+
/*void swapBytes();*/
-
+
bool hasDX10Header() const;
uint signature() const;
uint toolVersion() const;
@@ -147,12 +147,12 @@ class DirectDrawSurface
public:
DirectDrawSurface(unsigned char *mem, uint size);
~DirectDrawSurface();
-
+
bool isValid() const;
bool isSupported() const;
bool hasAlpha() const;
-
+
uint mipmapCount() const;
uint fourCC() const;
uint width() const;
@@ -166,26 +166,26 @@ public:
void setNormalFlag(bool b);
void setHasAlphaFlag(bool b);
void setUserVersion(int version);
-
+
void mipmap(Image *img, uint f, uint m);
void *readData(uint &size);
// void mipmap(FloatImage *img, uint f, uint m);
-
+
void printInfo() const;
private:
-
+
uint blockSize() const;
uint faceSize() const;
uint mipmapSize(uint m) const;
-
+
uint offset(uint f, uint m);
-
+
void readLinearImage(Image * img);
void readBlockImage(Image * img);
void readBlock(ColorBlock * rgba);
-
-
+
+
private:
Stream stream; // memory where DDS file resides
DDSHeader header;
diff --git a/source/blender/imbuf/intern/dds/Image.h b/source/blender/imbuf/intern/dds/Image.h
index 658f01deaec..bb74a9d5d15 100644
--- a/source/blender/imbuf/intern/dds/Image.h
+++ b/source/blender/imbuf/intern/dds/Image.h
@@ -44,45 +44,45 @@
class Image
{
public:
-
- enum Format
+
+ enum Format
{
Format_RGB,
Format_ARGB,
};
-
+
Image();
~Image();
-
+
void allocate(uint w, uint h);
#if 0
bool load(const char *name);
-
+
void wrap(void *data, uint w, uint h);
void unwrap();
#endif
-
+
uint width() const;
uint height() const;
-
+
const Color32 * scanline(uint h) const;
Color32 * scanline(uint h);
-
+
const Color32 * pixels() const;
Color32 * pixels();
-
+
const Color32 & pixel(uint idx) const;
Color32 & pixel(uint idx);
-
+
const Color32 & pixel(uint x, uint y) const;
Color32 & pixel(uint x, uint y);
-
+
Format format() const;
void setFormat(Format f);
-
+
private:
void free();
-
+
private:
uint m_width;
uint m_height;
diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h
index e841e696833..e37e09dd661 100644
--- a/source/blender/imbuf/intern/dds/PixelFormat.h
+++ b/source/blender/imbuf/intern/dds/PixelFormat.h
@@ -33,7 +33,7 @@
*/
// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
+//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
@@ -42,10 +42,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -93,7 +93,7 @@
++(*shift);
mask >>= 1;
}
-
+
*size = 0;
while ((mask & 1) == 1) {
++(*size);
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index 67a0b0ffd00..c038407c0a6 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -143,7 +143,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, size_t size, int flags, cha
}
}
}
- ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0);
+ ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0);
if (ibuf == 0) return(0); /* memory allocation failed */
ibuf->ftype = IMB_FTYPE_DDS;