fix tile image export
This commit is contained in:
parent
50a4610d2b
commit
7a239fafda
2 changed files with 8 additions and 2 deletions
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue