| 730 | } |
| 731 | |
| 732 | void CompressImageDXT1( const uint8_t* inBuf, uint8_t* outBuf, int width, int height, ptrdiff_t& outputBytes, volatile const bool& cancel ) |
| 733 | { |
| 734 | uint8_t block[64]; |
| 735 | uint8_t minColor[4]; |
| 736 | uint8_t maxColor[4]; |
| 737 | uint8_t** outData = &outBuf; |
| 738 | for( int j = 0; j < height; j += 4, inBuf += width * 4 * 4 ) |
| 739 | { |
| 740 | if( cancel ) |
| 741 | { |
| 742 | return; |
| 743 | } |
| 744 | for( int i = 0; i < width; i += 4 ) |
| 745 | { |
| 746 | ExtractBlock( inBuf + i * 4, width, block ); |
| 747 | GetMinMaxColors( block, minColor, maxColor ); |
| 748 | EmitWord( ColorTo565( maxColor ), outData ); |
| 749 | EmitWord( ColorTo565( minColor ), outData ); |
| 750 | EmitColorIndices( block, minColor, maxColor, outData ); |
| 751 | } |
| 752 | } |
| 753 | outputBytes = *outData - outBuf; |
| 754 | } |
| 755 | |
| 756 | // below works fine, but doesn't support a material id in the alpha channel |
| 757 | void CompressNormalMapDXT5NoAlpha( const uint8_t* inBuf, uint8_t* outBuf, int width, int height, ptrdiff_t& outputBytes, volatile const bool& cancel ) |
no test coverage detected