Fix RGBGFX -t/--trim-end combined with -B/--background-color for non-deduplicated output (#2130)

This commit is contained in:
Rangi
2026-09-20 15:05:06 -04:00
committed by GitHub
parent 408e861ecc
commit ace8db1b73
13 changed files with 15 additions and 10 deletions
+8 -10
View File
@@ -689,17 +689,15 @@ static void outputUnoptimizedTileData(
// LCOV_EXCL_STOP
}
uint64_t widthTiles = options.inputSlice.width ? options.inputSlice.width : image.png.width / 8;
uint64_t heightTiles =
options.inputSlice.height ? options.inputSlice.height : image.png.height / 8;
uint64_t nbTiles = widthTiles * heightTiles;
uint64_t nbKeptTiles = nbTiles > options.trim ? nbTiles - options.trim : 0;
uint64_t tileIdx = 0;
size_t nbTiles = std::count_if(RANGE(attrmap), [](AttrmapEntry const &attr) {
return !attr.isBackgroundTile();
});
size_t nbKeptTiles = nbTiles > options.trim ? nbTiles - options.trim : 0;
size_t tileIdx = 0;
for (auto const &[tile, attr] : zip(image.visitAsTiles(), attrmap)) {
// Do not emit fully-background tiles.
if (attr.isBackgroundTile()) {
++tileIdx;
continue;
}
@@ -918,9 +916,9 @@ static void outputTileData(UniqueTiles const &tiles) {
// LCOV_EXCL_STOP
}
uint64_t nbTiles = tiles.size();
uint64_t nbKeptTiles = nbTiles > options.trim ? nbTiles - options.trim : 0;
uint64_t tileIdx = 0;
size_t nbTiles = tiles.size();
size_t nbKeptTiles = nbTiles > options.trim ? nbTiles - options.trim : 0;
size_t tileIdx = 0;
for (TileData const *tile : tiles) {
assume(tile->tileID == tileIdx);
+3
View File
@@ -0,0 +1,3 @@
-B #ff00ff
-x 1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

+4
View File
@@ -0,0 +1,4 @@
-B #ff00ff
-x 1
-u
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B