Use the new frame() method.

This commit is contained in:
King_DuckZ 2020-03-20 01:53:57 +01:00
parent 965dafa240
commit ef348fe1ca

View file

@ -119,7 +119,6 @@ namespace {
std::vector<std::vector<char>> icon_fetch (const ConstBlock& block, int width, int height) {
const constexpr int in_height = 16, in_width = 16;
const bool scale = (in_width != width or in_height != height);
const auto slot_begin = block.cbegin();
const std::vector<uint8_t>& palette = block.palette();
assert(palette.size() == 16 * 4);
const int32_t palette_padded_size = (not scale) * (((palette.size() * CHAR_BIT + 31) bitand ~31) / CHAR_BIT);
@ -165,7 +164,7 @@ std::vector<std::vector<char>> icon_fetch (const ConstBlock& block, int width, i
orig_rgb.resize(in_scan_sz * in_height);
for (int y = 0; y < in_height; ++y) {
for (int x = 0; x < in_width / 2; ++x) {
const uint8_t curr = *(slot_begin + 128 + (in_width / 2 * y) + 128 * icon_num + x);
const uint8_t curr = *(block.frame(1 + icon_num) + (in_width / 2 * y) + x);
orig_rgb[y * in_scan_sz + x] = ((curr bitand 0xf0) >> 4) bitor ((curr bitand 0x0f) << 4);
}
}