diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-02 14:29:39 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-02 14:29:39 +0100 |
commit | cd8a1883be2bd0ca7101c700764704ba485d2072 (patch) | |
tree | cc07b86e86b7fa0b143329f50bf8cfaa1ef0fe2a | |
parent | 9c4234b8c977f285978c5595a812fee3e282590a (diff) |
Revert "src/anim-atlas: put in adapted old bitmask code"
This reverts commit 4e1823a8690992e6e0d9c54e41b333ea0dbc2be7.
And now it's safely stored in revision history for the next time it's
needed for comparison purposes.
-rw-r--r-- | src/anim-atlas.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index 45e23445..434f34b6 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -129,18 +129,19 @@ auto anim_atlas::frame_quad(const Vector3& center, rotation r, std::size_t i) co void anim_atlas::make_bitmask_(const ImageView2D& tex, BitArray& array) { - constexpr unsigned char amin = 32; const auto pixels = tex.pixels(); const auto size = pixels.size(); - const auto width = size[1], height = size[0]; - const auto stride = (std::size_t)pixels.stride()[0], width0 = width & ~7u; - fm_assert(tex.pixelSize() == 4 && pixels.stride()[1] == 4); + const auto width = size[1], height = size[0], + stride = (std::size_t)pixels.stride()[0], width0 = width & ~7u; const auto* const data = (const unsigned char*)pixels.data(); -#if 0 auto* const dest = (unsigned char*)array.data(); + fm_assert(tex.pixelSize() == 4); + fm_assert(pixels.stride()[1] == 4); + for (auto j = 0_uz; j < height; j++) { + constexpr unsigned char amin = 32; auto i = 0_uz; for (; i < width0; i += 8) { @@ -164,11 +165,6 @@ void anim_atlas::make_bitmask_(const ImageView2D& tex, BitArray& array) array.set((height-j-1)*width + i, alpha >= amin); } } -#else - for (std::size_t y = 0; y < height; y++) - for (std::size_t x = 0; x < width; x++) - array.set(y*width + x, data[(height-y-1)*stride + x*4 + 3] >= amin); -#endif } BitArray anim_atlas::make_bitmask(const ImageView2D& tex) |