MCPcopy Create free account
hub / github.com/crownengine/crown / imageDecodeToBgra8

Function imageDecodeToBgra8

3rdparty/bimg/src/image.cpp:4555–4965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {
4557 const uint8_t* src = (const uint8_t*)_src;
4558 uint8_t* dst = (uint8_t*)_dst;
4559
4560 uint32_t width = _width/4;
4561 uint32_t height = _height/4;
4562
4563 uint8_t temp[16*4];
4564
4565 switch (_srcFormat)
4566 {
4567 case TextureFormat::BC1:
4568 if (BX_ENABLED(BIMG_DECODE_BC1) )
4569 {
4570 for (uint32_t yy = 0; yy < height; ++yy)
4571 {
4572 for (uint32_t xx = 0; xx < width; ++xx)
4573 {
4574 decodeBlockDxt1(temp, src);
4575 src += 8;
4576
4577 uint8_t* block = &dst[yy*_dstPitch*4 + xx*16];
4578 bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16);
4579 bx::memCopy(&block[1*_dstPitch], &temp[16], 16);
4580 bx::memCopy(&block[2*_dstPitch], &temp[32], 16);
4581 bx::memCopy(&block[3*_dstPitch], &temp[48], 16);
4582 }
4583 }
4584 }
4585 else
4586 {
4587 BX_WARN(false, "BC1 decoder is disabled (BIMG_DECODE_BC1).");
4588 imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xff00ff00) );
4589 }
4590 break;
4591
4592 case TextureFormat::BC2:
4593 if (BX_ENABLED(BIMG_DECODE_BC2) )
4594 {
4595 for (uint32_t yy = 0; yy < height; ++yy)
4596 {
4597 for (uint32_t xx = 0; xx < width; ++xx)
4598 {
4599 decodeBlockDxt23A(temp+3, src);
4600 src += 8;
4601 decodeBlockDxt(temp, src);
4602 src += 8;
4603
4604 uint8_t* block = &dst[yy*_dstPitch*4 + xx*16];
4605 bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16);
4606 bx::memCopy(&block[1*_dstPitch], &temp[16], 16);
4607 bx::memCopy(&block[2*_dstPitch], &temp[32], 16);
4608 bx::memCopy(&block[3*_dstPitch], &temp[48], 16);
4609 }
4610 }
4611 }
4612 else

Callers 8

imageConvertFunction · 0.85
imageDecodeToRgba8Function · 0.85
createMethod · 0.85
updateMethod · 0.85
createMethod · 0.85
updateMethod · 0.85
createMethod · 0.85
updateMethod · 0.85

Calls 15

decodeBlockDxt1Function · 0.85
memCopyFunction · 0.85
imageCheckerboardFunction · 0.85
decodeBlockDxt23AFunction · 0.85
decodeBlockDxtFunction · 0.85
decodeBlockDxt45AFunction · 0.85
imageAllocFunction · 0.85
imageDecodeToRgba32fFunction · 0.85
imageConvertFunction · 0.85
imageFreeFunction · 0.85
decodeBlockBc7Function · 0.85
decodeBlockEtc12Function · 0.85

Tested by

no test coverage detected