fix tile image export

This commit is contained in:
garak 2019-08-13 22:28:20 -04:00
parent 50a4610d2b
commit 7a239fafda
2 changed files with 8 additions and 2 deletions

View file

@ -62,6 +62,12 @@ unsigned long crc(QByteArray buf, int len)
// images in porymap, we can effectively avoid that issue.
void exportIndexed4BPPPng(QImage image, QString filepath)
{
// Verify that the image is not empty
if (image.isNull()) {
logError(QString("Failed to export %1: the image is null.").arg(filepath));
return;
}
// Header
QByteArray pngHeader;
pngHeader.append(static_cast<char>(0x89));

View file

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