Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix in image loading #1071

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libs/yocto/yocto_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,8 +1480,9 @@ static vector<byte> convert_components(
throw std::invalid_argument{"components not supported"};
if (components == components_to) return pixels;

auto cpixels = vector<byte>((size_t)components_to * pixels.size());
for (auto i = 0ull; i < pixels.size(); i++) {
auto npixels = pixels.size() / (size_t)components;
auto cpixels = vector<byte>((size_t)components_to * npixels);
for (auto i = 0ull; i < npixels; i++) {
auto vp = pixels.data() + i * components;
auto cp = cpixels.data() + i * components_to;
if (components_to > 0) cp[0] = (components > 0) ? vp[0] : 0;
Expand Down