| 32 | // --- Data size computation --- |
| 33 | |
| 34 | size_t ComputeDataSize(int width, int height, PixelFormat fmt) |
| 35 | { |
| 36 | const auto& info = PixelFormatRegistry::Get(fmt); |
| 37 | if (info.isCompressed) |
| 38 | { |
| 39 | int bw = (width + 3) / 4; |
| 40 | int bh = (height + 3) / 4; |
| 41 | int blockBytes = (fmt == PixelFormat::DXT1) ? 8 : 16; |
| 42 | return static_cast<size_t>(bw) * bh * blockBytes; |
| 43 | } |
| 44 | return static_cast<size_t>(width) * height * info.bitsPerPixel / 8; |
| 45 | } |
| 46 | |
| 47 | // --- RGBA8888 → format converters --- |
| 48 |
no test coverage detected