mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Fixed tiled render math. Fixes #156.
This commit is contained in:
parent
1e99d7050a
commit
e097ad630b
1 changed files with 4 additions and 4 deletions
|
@ -732,15 +732,15 @@ void View::OnDraw()
|
||||||
|
|
||||||
quint32 TileY = 0, SrcY = 0;
|
quint32 TileY = 0, SrcY = 0;
|
||||||
if (CurrentTileRow != TotalTileRows - 1)
|
if (CurrentTileRow != TotalTileRows - 1)
|
||||||
TileY = (TotalTileRows - CurrentTileRow - 1) * mHeight - (mHeight - mRenderImage.height() % mHeight);
|
TileY = (TotalTileRows - CurrentTileRow - 1) * mHeight - ((mHeight - mRenderImage.height() % mHeight) % mHeight);
|
||||||
else if (TotalTileRows > 1 || TotalTileColumns > 1)
|
else if (TotalTileRows > 1)
|
||||||
SrcY = mHeight - mRenderImage.height() % mHeight;
|
SrcY = (mHeight - mRenderImage.height() % mHeight) % mHeight;
|
||||||
|
|
||||||
quint32 TileStart = ((CurrentTileColumn * mWidth) + (TileY * mRenderImage.width())) * 4;
|
quint32 TileStart = ((CurrentTileColumn * mWidth) + (TileY * mRenderImage.width())) * 4;
|
||||||
|
|
||||||
for (int y = 0; y < CurrentTileHeight; y++)
|
for (int y = 0; y < CurrentTileHeight; y++)
|
||||||
{
|
{
|
||||||
quint8* src = Buffer + (SrcY + y) * CurrentTileWidth * 4;
|
quint8* src = Buffer + (SrcY + y) * mWidth * 4;
|
||||||
quint8* dst = ImageBuffer + TileStart + y * mRenderImage.width() * 4;
|
quint8* dst = ImageBuffer + TileStart + y * mRenderImage.width() * 4;
|
||||||
|
|
||||||
memcpy(dst, src, CurrentTileWidth * 4);
|
memcpy(dst, src, CurrentTileWidth * 4);
|
||||||
|
|
Loading…
Reference in a new issue