Fix tileset image export on exact multiple of 16 tiles

This commit is contained in:
Diegoisawesome 2019-11-29 18:26:21 -06:00 committed by huderlem
parent 62a42d6b3c
commit 67f8b09c6e

View file

@ -200,7 +200,7 @@ QImage TilesetEditorTileSelector::buildPrimaryTilesIndexedImage() {
} }
int primaryLength = this->primaryTileset->tiles->length(); int primaryLength = this->primaryTileset->tiles->length();
int height = primaryLength / this->numTilesWide + 1; int height = qCeil(primaryLength / static_cast<double>(this->numTilesWide));
QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888); QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888);
QPainter painter(&image); QPainter painter(&image);
@ -236,7 +236,7 @@ QImage TilesetEditorTileSelector::buildSecondaryTilesIndexedImage() {
} }
int secondaryLength = this->secondaryTileset->tiles->length(); int secondaryLength = this->secondaryTileset->tiles->length();
int height = secondaryLength / this->numTilesWide + 1; int height = qCeil(secondaryLength / static_cast<double>(this->numTilesWide));
QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888); QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888);
QPainter painter(&image); QPainter painter(&image);