Commit ea2b1efa authored by phcoder's avatar phcoder
Browse files

Fix assembling of PNG color in order to support big-endian platforms

parent 977f2a92
...@@ -226,10 +226,16 @@ extern "C" ...@@ -226,10 +226,16 @@ extern "C"
std::vector<uint8_t> out; std::vector<uint8_t> out;
unsigned long width, height; unsigned long width, height;
auto result = Platform::loadPNG(out, width, height, (uint8_t*)bdata, info->size, true); int result = Platform::loadPNG(out, width, height, (uint8_t*)bdata, info->size, true);
assert(result == 0); assert(result == 0);
r8::io::Stegano stegano; r8::io::Stegano stegano;
stegano.load({ reinterpret_cast<const uint32_t*>(out.data()), nullptr, out.size() / 4 }, machine); uint32_t *buf = new uint32_t[out.size() / 4];
for (int i = 0; i < out.size() / 4; i++) {
buf[i] = out[4 * i] | (out[4 * i + 1] << 8) | (out[4 * i + 2] << 16) | (out[4 * i + 3] << 24);
}
r8::io::PngData pngData = { buf, NULL, out.size() / 4 };
stegano.load(pngData, machine);
delete[] buf;
} }
else else
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment