Check if any of base image dimensions need to be clamped to a multiple of 4. This function should only be called if the image is being compressed and mipmaps are being automatically generated.
| 208 | // Check if any of base image dimensions need to be clamped to a multiple of 4. |
| 209 | // This function should only be called if the image is being compressed and mipmaps are being automatically generated. |
| 210 | bool clampIfNeeded(ExportData& image) |
| 211 | { |
| 212 | bool clamped = false; |
| 213 | if (image.width > 1u && image.width % 4 != 0) |
| 214 | { |
| 215 | image.width = std::max(1u, image.width - image.width % 4); |
| 216 | clamped = true; |
| 217 | } |
| 218 | if (image.height > 1u && image.height % 4 != 0) |
| 219 | { |
| 220 | image.height = std::max(1u, image.height - image.height % 4); |
| 221 | clamped = true; |
| 222 | } |
| 223 | if (image.depth > 1u && image.depth % 4 != 0) |
| 224 | { |
| 225 | image.depth = std::max(1u, image.depth - image.depth % 4); |
| 226 | clamped = true; |
| 227 | } |
| 228 | |
| 229 | return clamped; |
| 230 | } |
| 231 | |
| 232 | // Fill the alpha channel with 1's. |
| 233 | void fillAlphaChannel(nvtt::Surface& image) |