Browse Source

TextureTools: it's height that's bounded to 16 bits, not width.

Documented correctly, implemented and tested wrong.
pull/168/head
Vladimír Vondruš 3 years ago
parent
commit
81780e5838
  1. 2
      src/Magnum/TextureTools/Atlas.cpp
  2. 12
      src/Magnum/TextureTools/Test/AtlasTest.cpp

2
src/Magnum/TextureTools/Atlas.cpp

@ -192,7 +192,7 @@ bool atlasLandfillAddSortedFlipped(Implementation::AtlasLandfillState& state, co
AtlasLandfill::AtlasLandfill(const Vector3i& size):_state{InPlaceInit} {
CORRADE_ASSERT(size.x(), "TextureTools::AtlasLandfill: expected non-zero width, got" << Debug::packed << size, );
CORRADE_ASSERT(size.y() || size.z() == 1, "TextureTools::AtlasLandfill: expected a single array slice for unbounded height, got" << Debug::packed << size, );
CORRADE_ASSERT(size.x() <= 65536, "TextureTools::AtlasLandfill: expected width to fit into 16 bits, got" << Debug::packed << size, );
CORRADE_ASSERT(size.y() <= 65536, "TextureTools::AtlasLandfill: expected height to fit into 16 bits, got" << Debug::packed << size, );
/* Change y / z = 0 to y / z = MAX so the algorithm doesn't need to branch
on that internally */

12
src/Magnum/TextureTools/Test/AtlasTest.cpp

@ -979,23 +979,23 @@ void AtlasTest::landfillInvalidSize() {
/* These are fine */
AtlasLandfill{{16, 0}};
AtlasLandfill{{65536, 16}};
AtlasLandfill{{16, 65536}};
AtlasLandfill{{16, 16, 0}};
AtlasLandfill{{65536, 16, 16}};
AtlasLandfill{{16, 65536, 16}};
std::ostringstream out;
Error redirectError{&out};
AtlasLandfill{{0, 16}};
AtlasLandfill{{65537, 16}};
AtlasLandfill{{16, 65537}};
AtlasLandfill{{0, 16, 16}};
AtlasLandfill{{16, 0, 16}};
AtlasLandfill{{65537, 16, 16}};
AtlasLandfill{{16, 65537, 16}};
CORRADE_COMPARE_AS(out.str(),
"TextureTools::AtlasLandfill: expected non-zero width, got {0, 16, 1}\n"
"TextureTools::AtlasLandfill: expected width to fit into 16 bits, got {65537, 16, 1}\n"
"TextureTools::AtlasLandfill: expected height to fit into 16 bits, got {16, 65537, 1}\n"
"TextureTools::AtlasLandfill: expected non-zero width, got {0, 16, 16}\n"
"TextureTools::AtlasLandfill: expected a single array slice for unbounded height, got {16, 0, 16}\n"
"TextureTools::AtlasLandfill: expected width to fit into 16 bits, got {65537, 16, 16}\n",
"TextureTools::AtlasLandfill: expected height to fit into 16 bits, got {16, 65537, 16}\n",
TestSuite::Compare::String);
}

Loading…
Cancel
Save