mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-09 01:35:38 +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;
|
||||
}
|
||||
|
||||
explicit Pixel(const uint8 *bits,
|
||||
const uint8 channelDepth[4] = static_cast<uint8 *>(0),
|
||||
uint8 bitOffset = 0) {
|
||||
explicit Pixel(uint32 rgba) {
|
||||
for(int i = 0; i < 4; i++) m_BitDepth[i] = 8;
|
||||
UnpackRGBA(rgba);
|
||||
}
|
||||
|
||||
Pixel(const uint8 *bits,
|
||||
const uint8 channelDepth[4] = static_cast<uint8 *>(0),
|
||||
uint8 bitOffset = 0) {
|
||||
FromBits(bits, channelDepth, bitOffset);
|
||||
}
|
||||
|
||||
|
|
|
@ -206,6 +206,12 @@ TEST(Pixel, UnpackRGBA) {
|
|||
EXPECT_EQ(p.G(), 0xB3);
|
||||
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
|
||||
p.ChangeBitDepth(newBitDepth);
|
||||
|
||||
|
|
Loading…
Reference in a new issue