diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-23 08:02:07 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-23 08:02:07 +0100 |
| commit | 62effff4a9bb2cddd515f6d6123c7ed141258ac1 (patch) | |
| tree | 9bfa4c22b8cc071ba385c2ae54f85c8a1ccc629e | |
| parent | e5d5fe63545a4b67e9c148ad35f4545a1c496028 (diff) | |
anim-atlas: cleanup bitmask code
| -rw-r--r-- | src/anim-atlas.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index b357a386..841c66d8 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -114,13 +114,13 @@ BitArray anim_atlas::make_bit_array(const ImageView2D& tex) return BitArray{DirectInit, width*height, true}; fm_assert(tex.pixelSize() == 4); - const auto stride = (std::size_t)pixels.stride()[0]; - const auto channels = (std::size_t)pixels.stride()[1]; + fm_assert(pixels.stride()[1] == 4); + const auto stride = (std::size_t)pixels.stride()[0]; BitArray array{NoInit, width*height}; - const char* __restrict const data = (const char*)tex.pixels().data(); + const char* __restrict const data = (const char*)pixels.data(); 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*channels + 3] != 0); + array.set(y*width + x, data[(height-y-1)*stride + x*4 + 3] != 0); return array; } |
