mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-09 14:45:39 +00:00
Add RGBA pixel constructor
This commit is contained in:
parent
9f4fa671d9
commit
1d58ea2385
|
@ -63,9 +63,14 @@ class Pixel {
|
||||||
for(int i = 0; i < 4; i++) m_BitDepth[i] = 8;
|
for(int i = 0; i < 4; i++) m_BitDepth[i] = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit Pixel(const uint8 *bits,
|
explicit Pixel(uint32 rgba) {
|
||||||
const uint8 channelDepth[4] = static_cast<uint8 *>(0),
|
for(int i = 0; i < 4; i++) m_BitDepth[i] = 8;
|
||||||
uint8 bitOffset = 0) {
|
UnpackRGBA(rgba);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pixel(const uint8 *bits,
|
||||||
|
const uint8 channelDepth[4] = static_cast<uint8 *>(0),
|
||||||
|
uint8 bitOffset = 0) {
|
||||||
FromBits(bits, channelDepth, bitOffset);
|
FromBits(bits, channelDepth, bitOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,12 @@ TEST(Pixel, UnpackRGBA) {
|
||||||
EXPECT_EQ(p.G(), 0xB3);
|
EXPECT_EQ(p.G(), 0xB3);
|
||||||
EXPECT_EQ(p.R(), 0xFE);
|
EXPECT_EQ(p.R(), 0xFE);
|
||||||
|
|
||||||
|
p = PVRTCC::Pixel(rgba);
|
||||||
|
EXPECT_EQ(p.A(), 0x46);
|
||||||
|
EXPECT_EQ(p.B(), 0x19);
|
||||||
|
EXPECT_EQ(p.G(), 0xB3);
|
||||||
|
EXPECT_EQ(p.R(), 0xFE);
|
||||||
|
|
||||||
uint8 newBitDepth[4] = { 3, 5, 2, 1 }; // A R G B
|
uint8 newBitDepth[4] = { 3, 5, 2, 1 }; // A R G B
|
||||||
p.ChangeBitDepth(newBitDepth);
|
p.ChangeBitDepth(newBitDepth);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue