mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-09 01:55:33 +00:00
Pixels are actually 4vecs of ints
This commit is contained in:
parent
473a1c1869
commit
85c3f9fc90
|
@ -58,17 +58,18 @@
|
||||||
|
|
||||||
namespace FasTC {
|
namespace FasTC {
|
||||||
|
|
||||||
class Pixel : public Vector4<uint8> {
|
class Pixel {
|
||||||
private:
|
private:
|
||||||
|
Vector4<uint8> m_Vec;
|
||||||
uint8 m_BitDepth[4];
|
uint8 m_BitDepth[4];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Pixel() : Vector4<uint8>(0, 0, 0, 0) {
|
Pixel() : m_Vec(0, 0, 0, 0) {
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
m_BitDepth[i] = 8;
|
m_BitDepth[i] = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit Pixel(uint32 rgba) : Vector4<uint8>() {
|
explicit Pixel(uint32 rgba) {
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
m_BitDepth[i] = 8;
|
m_BitDepth[i] = 8;
|
||||||
Unpack(rgba);
|
Unpack(rgba);
|
||||||
|
@ -76,7 +77,7 @@ class Pixel : public Vector4<uint8> {
|
||||||
|
|
||||||
Pixel(const uint8 *bits,
|
Pixel(const uint8 *bits,
|
||||||
const uint8 channelDepth[4] = static_cast<uint8 *>(0),
|
const uint8 channelDepth[4] = static_cast<uint8 *>(0),
|
||||||
uint8 bitOffset = 0) : Vector4<uint8>() {
|
uint8 bitOffset = 0) {
|
||||||
FromBits(bits, channelDepth, bitOffset);
|
FromBits(bits, channelDepth, bitOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,16 +107,16 @@ class Pixel : public Vector4<uint8> {
|
||||||
// above for how we do this.
|
// above for how we do this.
|
||||||
static uint8 ChangeBitDepth(uint8 val, uint8 oldDepth, uint8 newDepth);
|
static uint8 ChangeBitDepth(uint8 val, uint8 oldDepth, uint8 newDepth);
|
||||||
|
|
||||||
const uint8 &A() const { return X(); }
|
const uint8 &A() const { return m_Vec.X(); }
|
||||||
uint8 &A() { return X(); }
|
uint8 &A() { return m_Vec.X(); }
|
||||||
const uint8 &R() const { return Y(); }
|
const uint8 &R() const { return m_Vec.Y(); }
|
||||||
uint8 &R() { return Y(); }
|
uint8 &R() { return m_Vec.Y(); }
|
||||||
const uint8 &G() const { return Z(); }
|
const uint8 &G() const { return m_Vec.Z(); }
|
||||||
uint8 &G() { return Z(); }
|
uint8 &G() { return m_Vec.Z(); }
|
||||||
const uint8 &B() const { return W(); }
|
const uint8 &B() const { return m_Vec.W(); }
|
||||||
uint8 &B() { return W(); }
|
uint8 &B() { return m_Vec.W(); }
|
||||||
const uint8 &Component(uint32 idx) const { return vec[idx]; }
|
const uint8 &Component(uint32 idx) const { return m_Vec[idx]; }
|
||||||
uint8 &Component(uint32 idx) { return vec[idx]; }
|
uint8 &Component(uint32 idx) { return m_Vec[idx]; }
|
||||||
|
|
||||||
void GetBitDepth(uint8 (&outDepth)[4]) const {
|
void GetBitDepth(uint8 (&outDepth)[4]) const {
|
||||||
for(int i = 0; i < 4; i++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
|
|
Loading…
Reference in a new issue