| 4528 | } |
| 4529 | |
| 4530 | void imageDecodeToR8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _dstPitch, TextureFormat::Enum _srcFormat) |
| 4531 | { |
| 4532 | const uint8_t* src = (const uint8_t*)_src; |
| 4533 | uint8_t* dst = (uint8_t*)_dst; |
| 4534 | |
| 4535 | const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; |
| 4536 | const uint32_t srcPitch = _width*srcBpp/8; |
| 4537 | |
| 4538 | for (uint32_t zz = 0; zz < _depth; ++zz, src += _height*srcPitch, dst += _height*_dstPitch) |
| 4539 | { |
| 4540 | if (isCompressed(_srcFormat)) |
| 4541 | { |
| 4542 | uint32_t size = imageGetSize(NULL, uint16_t(_width), uint16_t(_height), 0, false, false, 1, TextureFormat::RGBA8); |
| 4543 | void* temp = bx::alloc(_allocator, size); |
| 4544 | imageDecodeToRgba8(_allocator, temp, _src, _width, _height, _width*4, _srcFormat); |
| 4545 | imageConvert(_allocator, dst, TextureFormat::R8, temp, TextureFormat::RGBA8, _width, _height, 1, _width*4, _dstPitch); |
| 4546 | bx::free(_allocator, temp); |
| 4547 | } |
| 4548 | else |
| 4549 | { |
| 4550 | imageConvert(_allocator, dst, TextureFormat::R8, src, _srcFormat, _width, _height, 1, srcPitch, _dstPitch); |
| 4551 | } |
| 4552 | } |
| 4553 | } |
| 4554 | |
| 4555 | void imageDecodeToBgra8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _dstPitch, TextureFormat::Enum _srcFormat) |
| 4556 | { |
no test coverage detected