diff options
Diffstat (limited to 'source/blender/imbuf/intern/dds/ColorBlock.cpp')
-rw-r--r-- | source/blender/imbuf/intern/dds/ColorBlock.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
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)); } } } |