Use src/dst prefixes instead of from/to.

This commit is contained in:
John Preston 2022-06-29 16:17:03 +04:00
parent cb5296a6b0
commit 32cf0968a1

View file

@ -41,15 +41,15 @@ FrameGenerator::Frame ImageFrameGenerator::renderNext(
const auto skipx = (size.width() - scaled.width()) / 2;
const auto skipy = (size.height() - scaled.height()) / 2;
const auto fromPerLine = scaled.bytesPerLine();
const auto toPerLine = result.bytesPerLine();
const auto srcPerLine = scaled.bytesPerLine();
const auto dstPerLine = result.bytesPerLine();
const auto lineBytes = scaled.width() * 4;
auto from = scaled.constBits();
auto to = result.bits() + (skipx * 4) + (skipy * fromPerLine);
auto src = scaled.constBits();
auto dst = result.bits() + (skipx * 4) + (skipy * srcPerLine);
for (auto y = 0, height = scaled.height(); y != height; ++y) {
memcpy(to, from, lineBytes);
from += fromPerLine;
to += toPerLine;
memcpy(dst, src, lineBytes);
src += srcPerLine;
dst += dstPerLine;
}
return { .image = std::move(result) };