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:
Diffstat (limited to 'source/blender/imbuf/intern/dds')
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp20
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp46
2 files changed, 33 insertions, 33 deletions
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 2ea255234e5..49ba566b6e8 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -135,27 +135,27 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
color_array[1].b = (3 * col1.b * 22) / 8;
color_array[1].a = 0xFF;
- int gdiff = color_array[1].g - color_array[0].g;
+ int gdiff = color_array[1].g - color_array[0].g;
if( col0.u > col1.u ) {
// Four-color block: derive the other two colors.
- color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
- 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].r = ((2 * col0.r + col1.r) * 22) / 8;
+ 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;
+ 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;
color_array[3].a = 0xFF;
return 4;
}
else {
// Three-color block: derive the other color.
- color_array[2].r = ((col0.r + col1.r) * 33) / 8;
- 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].r = ((col0.r + col1.r) * 33) / 8;
+ 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.
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index b0c4d0a396e..0b4a7cabf92 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -81,7 +81,7 @@ ColorBlock::ColorBlock(const Image * img, uint x, uint y)
void ColorBlock::init(const Image * img, uint x, uint y)
{
- init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
+ init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
}
void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
@@ -89,34 +89,34 @@ 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);
- // 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. :(
- // @@ Ideally we should zero the weights of the pixels out of range.
+ // 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. :(
+ // @@ Ideally we should zero the weights of the pixels out of range.
- for (uint i = 0; i < 4; i++)
- {
- const int by = i % bh;
+ for (uint i = 0; i < 4; i++)
+ {
+ const int by = i % bh;
- for (uint e = 0; e < 4; e++)
- {
- const int bx = e % bw;
- const uint idx = (y + by) * w + x + bx;
+ for (uint e = 0; e < 4; e++)
+ {
+ const int bx = e % bw;
+ const uint idx = (y + by) * w + x + bx;
- color(e, i).u = data[idx];
- }
- }
+ color(e, i).u = data[idx];
+ }
+ }
}
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. :(
- // @@ Ideally we should zero the weights of the pixels out of range.
+ // @@ Ideally we should zero the weights of the pixels out of range.
- uint srcPlane = w * h;
+ uint srcPlane = w * h;
for (uint i = 0; i < 4; i++)
{
@@ -125,13 +125,13 @@ void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
for (uint e = 0; e < 4; e++)
{
const uint bx = e % bw;
- const uint idx = ((y + by) * w + x + bx);
+ 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));
}
}
}