This commit is contained in:
parent
74cf055610
commit
646ab1283f
@ -35,7 +35,7 @@ constexpr bool valid(TileSheetV1 const&ts) noexcept {
|
||||
return (ts.bpp == 4 || ts.bpp == 8) && ts.pixels.size() == bytes;
|
||||
}
|
||||
|
||||
constexpr ox::Error repair(TileSheetV1 &ts, int bpp) noexcept {
|
||||
constexpr ox::Error repair(TileSheetV1 &ts, int const bpp) noexcept {
|
||||
auto const bytes = static_cast<size_t>(ts.columns * ts.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
|
||||
ts.pixels.resize(bytes);
|
||||
return {};
|
||||
@ -84,7 +84,7 @@ constexpr bool valid(TileSheetV2 const&ts) noexcept {
|
||||
return (ts.bpp == 4 || ts.bpp == 8) && valid(ts.subsheet, ts.bpp);
|
||||
}
|
||||
|
||||
constexpr void repair(TileSheetV2::SubSheet &ss, int bpp) noexcept {
|
||||
constexpr void repair(TileSheetV2::SubSheet &ss, int const bpp) noexcept {
|
||||
auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
|
||||
ss.pixels.resize(bytes);
|
||||
for (auto &s : ss.subsheets) {
|
||||
@ -154,7 +154,7 @@ constexpr bool valid(TileSheetV3 const&ts) noexcept {
|
||||
return (ts.bpp == 4 || ts.bpp == 8) && valid(ts.subsheet, ts.bpp);
|
||||
}
|
||||
|
||||
constexpr void repair(TileSheetV3::SubSheet &ss, int bpp) noexcept {
|
||||
constexpr void repair(TileSheetV3::SubSheet &ss, int const bpp) noexcept {
|
||||
auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
|
||||
ss.pixels.resize(bytes);
|
||||
for (auto &s : ss.subsheets) {
|
||||
@ -248,7 +248,7 @@ constexpr bool valid(TileSheetV4 const&ts) noexcept {
|
||||
return (ts.bpp == 4 || ts.bpp == 8) && valid(ts.subsheet, ts.bpp);
|
||||
}
|
||||
|
||||
constexpr void repair(TileSheetV4::SubSheet &ss, int bpp) noexcept {
|
||||
constexpr void repair(TileSheetV4::SubSheet &ss, int const bpp) noexcept {
|
||||
if (ss.subsheets.empty()) {
|
||||
auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
|
||||
ss.pixels.resize(bytes);
|
||||
@ -350,7 +350,7 @@ constexpr bool valid(TileSheetV5 const&ts) noexcept {
|
||||
return (ts.bpp == 4 || ts.bpp == 8) && valid(ts.subsheet);
|
||||
}
|
||||
|
||||
constexpr void repair(TileSheetV5::SubSheet &ss, int const bpp) noexcept {
|
||||
constexpr void repair(TileSheetV5::SubSheet &ss) noexcept {
|
||||
if (ss.subsheets.empty()) {
|
||||
auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile);
|
||||
ss.pixels.resize(bytes);
|
||||
@ -360,7 +360,7 @@ constexpr void repair(TileSheetV5::SubSheet &ss, int const bpp) noexcept {
|
||||
ss.rows = -1;
|
||||
}
|
||||
for (auto &s : ss.subsheets) {
|
||||
repair(s, bpp);
|
||||
repair(s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ constexpr ox::Error repair(TileSheetV5 &ts) noexcept {
|
||||
if (ts.bpp != 4 && ts.bpp != 8) {
|
||||
return ox::Error{1, "Unable to repair TileSheet"};
|
||||
}
|
||||
repair(ts.subsheet, ts.bpp);
|
||||
repair(ts.subsheet);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user