Skip to content

Commit

Permalink
fix decodeall ith tile bug
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizuku committed Dec 4, 2024
1 parent 6cecb89 commit ee5df7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,15 @@ int TileSolver::Decode(struct tilecfg_t *tilecfg, wxFileName pluginfile)
rawdata + start, datasize, &m_tilecfg.fmt, &pixels, &npixel, true);
for(int i=0; i< ntile; i++)
{
size_t offset = i * nbytes;
if(offset + nbytes > npixel) break;
size_t tilestart = i * nbytes;
if(tilestart + nbytes > npixel) break;
auto& tile = m_tiles[i];
uint8_t *rgbdata = tile.GetData();
uint8_t *adata = tile.GetAlpha();
for(int pixeli=0; pixeli < m_tilecfg.fmt.w * m_tilecfg.fmt.h; pixeli++)
{
memcpy(rgbdata + pixeli*3, (void*)(pixels + pixeli), 3);
adata[pixeli] = pixels[pixeli].a; // alpah is in seperate channel
memcpy(rgbdata + pixeli*3, (void*)(pixels + tilestart + pixeli), 3);
adata[pixeli] = pixels[tilestart + pixeli].a; // alpah is in seperate channel
}
}
}
Expand Down

0 comments on commit ee5df7c

Please sign in to comment.