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