| 759 | } |
| 760 | |
| 761 | static ax::backend::PixelFormat convertRGBA4ToFormat(const unsigned char* data, |
| 762 | size_t dataLen, |
| 763 | PixelFormat format, |
| 764 | unsigned char** outData, |
| 765 | size_t* outDataLen) |
| 766 | { |
| 767 | switch (format) |
| 768 | { |
| 769 | case PixelFormat::RGBA8: |
| 770 | *outDataLen = dataLen / 2 * 4; |
| 771 | *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); |
| 772 | convertRGBA4ToRGBA8(data, dataLen, *outData); |
| 773 | break; |
| 774 | case PixelFormat::RGBA4: |
| 775 | *outDataLen = dataLen; |
| 776 | *outData = (unsigned char*)data; |
| 777 | break; |
| 778 | default: |
| 779 | // unsupported conversion or don't need to convert |
| 780 | if (format != PixelFormat::RGBA8) |
| 781 | { |
| 782 | AXLOGW( |
| 783 | "Can not convert image format PixelFormat::RGBA444 to format ID:{}, we will use it's origin format " |
| 784 | "PixelFormat::RGBA4", |
| 785 | static_cast<int>(format)); |
| 786 | } |
| 787 | *outData = (unsigned char*)data; |
| 788 | *outDataLen = dataLen; |
| 789 | return PixelFormat::RGBA8; |
| 790 | } |
| 791 | |
| 792 | return format; |
| 793 | } |
| 794 | |
| 795 | static PixelFormat convertBGRA8ToFormat(const unsigned char* data, |
| 796 | size_t dataLen, |
no test coverage detected