mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-08 06:15:31 +00:00
Add comparison operator for pixels
This commit is contained in:
parent
8bf682f04e
commit
fa37aba768
|
@ -163,5 +163,19 @@ namespace PVRTCC {
|
|||
return r;
|
||||
}
|
||||
|
||||
bool Pixel::operator==(const Pixel &other) const {
|
||||
uint8 depths[4];
|
||||
other.GetBitDepth(depths);
|
||||
|
||||
bool ok = true;
|
||||
for(int i = 0; i < 4; i++) {
|
||||
ok = ok && m_BitDepth[i] == depths[i];
|
||||
|
||||
uint8 mask = (1 << depths[i]) - 1;
|
||||
const uint8 c = other.Component(i) & mask;
|
||||
ok = ok && (c == (Component(i) & mask));
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
} // namespace PVRTCC
|
||||
|
|
|
@ -111,6 +111,9 @@ class Pixel {
|
|||
// up in the most-significant byte.
|
||||
uint32 PackRGBA() const;
|
||||
|
||||
// Tests for equality by comparing the values and the bit depths.
|
||||
bool operator==(const Pixel &) const;
|
||||
|
||||
private:
|
||||
union {
|
||||
struct {
|
||||
|
|
Loading…
Reference in a new issue