| 725 | } |
| 726 | |
| 727 | static ax::backend::PixelFormat convertRGB565ToFormat(const unsigned char* data, |
| 728 | size_t dataLen, |
| 729 | PixelFormat format, |
| 730 | unsigned char** outData, |
| 731 | size_t* outDataLen) |
| 732 | { |
| 733 | switch (format) |
| 734 | { |
| 735 | case PixelFormat::RGBA8: |
| 736 | *outDataLen = dataLen / 2 * 4; |
| 737 | *outData = (unsigned char*)malloc(sizeof(unsigned char) * (*outDataLen)); |
| 738 | convertRGB565ToRGBA8(data, dataLen, *outData); |
| 739 | break; |
| 740 | case PixelFormat::RGB565: |
| 741 | *outDataLen = dataLen; |
| 742 | *outData = (unsigned char*)data; |
| 743 | break; |
| 744 | default: |
| 745 | // unsupported conversion or don't need to convert |
| 746 | if (format != PixelFormat::RGBA8) |
| 747 | { |
| 748 | AXLOGW( |
| 749 | "Can not convert image format PixelFormat::RGB565 to format ID:{}, we will use it's origin format " |
| 750 | "PixelFormat::RGB565", |
| 751 | static_cast<int>(format)); |
| 752 | } |
| 753 | *outData = (unsigned char*)data; |
| 754 | *outDataLen = dataLen; |
| 755 | return PixelFormat::RGBA8; |
| 756 | } |
| 757 | |
| 758 | return format; |
| 759 | } |
| 760 | |
| 761 | static ax::backend::PixelFormat convertRGBA4ToFormat(const unsigned char* data, |
| 762 | size_t dataLen, |
no test coverage detected