mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
Quick shortcut for all-black blocks since they are very common
This commit is contained in:
parent
9435003553
commit
193ac22eb5
@ -277,8 +277,12 @@ void BC1Encoder::EncodeBlockSingleColor(Color color, BC1Block *dest) const {
|
||||
uint8_t mask = 0xAA; // 2222
|
||||
uint16_t min16, max16;
|
||||
|
||||
bool using_3color = false;
|
||||
|
||||
if ((color.r | color.g | color.g) == 0) {
|
||||
// quick shortcut for all-black blocks
|
||||
min16 = 0;
|
||||
max16 = 1;
|
||||
mask = 0x55; // 1111 (Min value only, max is ignored)
|
||||
} else {
|
||||
// why is there no subscript operator for shared_ptr<array>
|
||||
EncodeResults result;
|
||||
FindEndpointsSingleColor(result, color, false);
|
||||
@ -312,7 +316,8 @@ void BC1Encoder::EncodeBlockSingleColor(Color color, BC1Block *dest) const {
|
||||
}
|
||||
assert(max16 > min16);
|
||||
} else if (max16 > min16) {
|
||||
std::swap(min16, max16);
|
||||
std::swap(min16, max16); // assure 3-color blocks
|
||||
}
|
||||
}
|
||||
|
||||
dest->SetLowColor(max16);
|
||||
|
Loading…
Reference in New Issue
Block a user