Worker thread procedure for the "ConvertImageBufferFormat" function
| 427 | |
| 428 | // Worker thread procedure for the "ConvertImageBufferFormat" function |
| 429 | static void ConvertImageBufferFormatWorker( |
| 430 | ImageFormat srcFormat, |
| 431 | DataType srcDataType, |
| 432 | const VariantConstBuffer& srcBuffer, |
| 433 | ImageFormat dstFormat, |
| 434 | VariantBuffer& dstBuffer, |
| 435 | std::size_t idxBegin, |
| 436 | std::size_t idxEnd) |
| 437 | { |
| 438 | /* Get size for source and destination formats */ |
| 439 | auto srcFormatSize = ImageFormatSize(srcFormat); |
| 440 | auto dstFormatSize = ImageFormatSize(dstFormat); |
| 441 | |
| 442 | /* Initialize default variant color (0, 0, 0, 1) */ |
| 443 | VariantColor value { UninitializeTag{} }; |
| 444 | |
| 445 | SetVariantMinMax(srcDataType, value.r, true); |
| 446 | SetVariantMinMax(srcDataType, value.g, true); |
| 447 | SetVariantMinMax(srcDataType, value.b, true); |
| 448 | SetVariantMinMax(srcDataType, value.a, false); |
| 449 | |
| 450 | for (auto i = idxBegin; i < idxEnd; ++i) |
| 451 | { |
| 452 | /* Read RGBA variant from source buffer */ |
| 453 | ReadRGBAFormattedVariant(srcFormat, srcDataType, srcBuffer, i*srcFormatSize, value); |
| 454 | |
| 455 | /* Write RGBA variant to destination buffer */ |
| 456 | WriteRGBAFormattedVariant(dstFormat, srcDataType, dstBuffer, i*dstFormatSize, value); |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | static void ConvertImageBufferFormat( |
| 461 | const SrcImageDescriptor& srcImageDesc, |
no test coverage detected