Fix exported tile images writing garbage pixels
This commit is contained in:
parent
8e6aa78884
commit
81b6cfa537
2 changed files with 5 additions and 16 deletions
|
@ -60,6 +60,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
- Fix bug where layout json and blockdata could be saved separately leading to inconsistent data.
|
- Fix bug where layout json and blockdata could be saved separately leading to inconsistent data.
|
||||||
- Fix crash when saving tilesets with fewer palettes than the maximum.
|
- Fix crash when saving tilesets with fewer palettes than the maximum.
|
||||||
- Fix projects not opening on Windows if the project filepath contains certain characters.
|
- Fix projects not opening on Windows if the project filepath contains certain characters.
|
||||||
|
- Fix exported tile images containing garbage pixels after the end of the tiles.
|
||||||
|
|
||||||
## [5.4.1] - 2024-03-21
|
## [5.4.1] - 2024-03-21
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -226,17 +226,11 @@ QImage TilesetEditorTileSelector::buildPrimaryTilesIndexedImage() {
|
||||||
int primaryLength = this->primaryTileset->tiles.length();
|
int primaryLength = this->primaryTileset->tiles.length();
|
||||||
int height = qCeil(primaryLength / static_cast<double>(this->numTilesWide));
|
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);
|
||||||
|
image.fill(0);
|
||||||
|
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
for (uint16_t tile = 0; tile < primaryLength; tile++) {
|
for (uint16_t tile = 0; tile < primaryLength; tile++) {
|
||||||
QImage tileImage;
|
QImage tileImage = getGreyscaleTileImage(tile, this->primaryTileset, this->secondaryTileset);
|
||||||
if (tile < primaryLength) {
|
|
||||||
tileImage = getGreyscaleTileImage(tile, this->primaryTileset, this->secondaryTileset);
|
|
||||||
} else {
|
|
||||||
tileImage = QImage(8, 8, QImage::Format_RGBA8888);
|
|
||||||
tileImage.fill(qRgb(0, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
int y = tile / this->numTilesWide;
|
int y = tile / this->numTilesWide;
|
||||||
int x = tile % this->numTilesWide;
|
int x = tile % this->numTilesWide;
|
||||||
QPoint origin = QPoint(x * 8, y * 8);
|
QPoint origin = QPoint(x * 8, y * 8);
|
||||||
|
@ -261,18 +255,12 @@ QImage TilesetEditorTileSelector::buildSecondaryTilesIndexedImage() {
|
||||||
int secondaryLength = this->secondaryTileset->tiles.length();
|
int secondaryLength = this->secondaryTileset->tiles.length();
|
||||||
int height = qCeil(secondaryLength / static_cast<double>(this->numTilesWide));
|
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);
|
||||||
|
image.fill(0);
|
||||||
|
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
uint16_t primaryLength = static_cast<uint16_t>(Project::getNumTilesPrimary());
|
uint16_t primaryLength = static_cast<uint16_t>(Project::getNumTilesPrimary());
|
||||||
for (uint16_t tile = 0; tile < secondaryLength; tile++) {
|
for (uint16_t tile = 0; tile < secondaryLength; tile++) {
|
||||||
QImage tileImage;
|
QImage tileImage = getGreyscaleTileImage(tile + primaryLength, this->primaryTileset, this->secondaryTileset);
|
||||||
if (tile < secondaryLength) {
|
|
||||||
tileImage = getGreyscaleTileImage(tile + primaryLength, this->primaryTileset, this->secondaryTileset);
|
|
||||||
} else {
|
|
||||||
tileImage = QImage(8, 8, QImage::Format_RGBA8888);
|
|
||||||
tileImage.fill(qRgb(0, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
int y = tile / this->numTilesWide;
|
int y = tile / this->numTilesWide;
|
||||||
int x = tile % this->numTilesWide;
|
int x = tile % this->numTilesWide;
|
||||||
QPoint origin = QPoint(x * 8, y * 8);
|
QPoint origin = QPoint(x * 8, y * 8);
|
||||||
|
|
Loading…
Reference in a new issue