| 173 | |
| 174 | template <typename Packer> |
| 175 | void pack_surface(Packer& pk, const SVDSurface& s) { |
| 176 | pk.pack_array(4); |
| 177 | pk.pack(static_cast<std::int32_t>(s.input_pair())); |
| 178 | |
| 179 | const auto& props = s.properties(); |
| 180 | pk.pack_array(props.size()); |
| 181 | for (const auto& p : props) { |
| 182 | // Property entry is currently a length-1 array `[key]`. The |
| 183 | // OutputTransform lives inside the per-property SVDDecomposition |
| 184 | // blob (packed by pack_decomp below), so the surface-level |
| 185 | // record only needs the property key here. Leaving it as a |
| 186 | // length-1 array (rather than packing the bare int) lets a |
| 187 | // future revision extend it to `[key, transform_override]` or |
| 188 | // similar without bumping the on-wire revision number. |
| 189 | pk.pack_array(1); |
| 190 | pk.pack(static_cast<std::int32_t>(p)); |
| 191 | } |
| 192 | |
| 193 | const std::size_t n_regions = s.region_count(); |
| 194 | pk.pack_array(n_regions); |
| 195 | for (std::size_t r = 0; r < n_regions; ++r) { |
| 196 | pack_region(pk, s.atlas().region(r)); |
| 197 | } |
| 198 | |
| 199 | // Decomps are flattened: region_idx ranges first, then properties. |
| 200 | pk.pack_array(n_regions * props.size()); |
| 201 | for (std::size_t r = 0; r < n_regions; ++r) { |
| 202 | for (const auto& p : props) { |
| 203 | pack_decomp(pk, r, p, s.decomposition(r, p)); |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | // ---------- unpacking helpers ---------------------------------------- |
| 209 | // |
no test coverage detected