mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-27 10:04:19 +01:00
astc: In-class initialize member variables where appropriate
This commit is contained in:
parent
8e28af6f89
commit
4cd52a34b9
@ -25,16 +25,15 @@
|
|||||||
|
|
||||||
class BitStream {
|
class BitStream {
|
||||||
public:
|
public:
|
||||||
BitStream(unsigned char* ptr, int nBits = 0, int start_offset = 0)
|
explicit BitStream(unsigned char* ptr, int nBits = 0, int start_offset = 0)
|
||||||
: m_BitsWritten(0), m_BitsRead(0), m_NumBits(nBits), m_CurByte(ptr),
|
: m_NumBits(nBits), m_CurByte(ptr), m_NextBit(start_offset % 8) {}
|
||||||
m_NextBit(start_offset % 8), done(false) {}
|
|
||||||
|
~BitStream() = default;
|
||||||
|
|
||||||
int GetBitsWritten() const {
|
int GetBitsWritten() const {
|
||||||
return m_BitsWritten;
|
return m_BitsWritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
~BitStream() {}
|
|
||||||
|
|
||||||
void WriteBitsR(unsigned int val, unsigned int nBits) {
|
void WriteBitsR(unsigned int val, unsigned int nBits) {
|
||||||
for (unsigned int i = 0; i < nBits; i++) {
|
for (unsigned int i = 0; i < nBits; i++) {
|
||||||
WriteBit((val >> (nBits - i - 1)) & 1);
|
WriteBit((val >> (nBits - i - 1)) & 1);
|
||||||
@ -95,13 +94,13 @@ private:
|
|||||||
done = done || ++m_BitsWritten >= m_NumBits;
|
done = done || ++m_BitsWritten >= m_NumBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_BitsWritten;
|
int m_BitsWritten = 0;
|
||||||
const int m_NumBits;
|
const int m_NumBits;
|
||||||
unsigned char* m_CurByte;
|
unsigned char* m_CurByte;
|
||||||
int m_NextBit;
|
int m_NextBit = 0;
|
||||||
int m_BitsRead;
|
int m_BitsRead = 0;
|
||||||
|
|
||||||
bool done;
|
bool done = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename IntType>
|
template <typename IntType>
|
||||||
@ -382,17 +381,13 @@ private:
|
|||||||
namespace ASTCC {
|
namespace ASTCC {
|
||||||
|
|
||||||
struct TexelWeightParams {
|
struct TexelWeightParams {
|
||||||
uint32_t m_Width;
|
uint32_t m_Width = 0;
|
||||||
uint32_t m_Height;
|
uint32_t m_Height = 0;
|
||||||
bool m_bDualPlane;
|
bool m_bDualPlane = false;
|
||||||
uint32_t m_MaxWeight;
|
uint32_t m_MaxWeight = 0;
|
||||||
bool m_bError;
|
bool m_bError = false;
|
||||||
bool m_bVoidExtentLDR;
|
bool m_bVoidExtentLDR = false;
|
||||||
bool m_bVoidExtentHDR;
|
bool m_bVoidExtentHDR = false;
|
||||||
|
|
||||||
TexelWeightParams() {
|
|
||||||
memset(this, 0, sizeof(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t GetPackedBitSize() {
|
uint32_t GetPackedBitSize() {
|
||||||
// How many indices do we have?
|
// How many indices do we have?
|
||||||
@ -668,27 +663,15 @@ IntType Replicate(const IntType& val, uint32_t numBits, uint32_t toBit) {
|
|||||||
|
|
||||||
class Pixel {
|
class Pixel {
|
||||||
protected:
|
protected:
|
||||||
typedef int16_t ChannelType;
|
using ChannelType = int16_t;
|
||||||
uint8_t m_BitDepth[4];
|
uint8_t m_BitDepth[4] = {8, 8, 8, 8};
|
||||||
int16_t color[4];
|
int16_t color[4] = {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Pixel() {
|
Pixel() = default;
|
||||||
for (int i = 0; i < 4; i++) {
|
Pixel(ChannelType a, ChannelType r, ChannelType g, ChannelType b, unsigned bitDepth = 8)
|
||||||
m_BitDepth[i] = 8;
|
: m_BitDepth{uint8_t(bitDepth), uint8_t(bitDepth), uint8_t(bitDepth), uint8_t(bitDepth)},
|
||||||
color[i] = 0;
|
color{a, r, g, b} {}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Pixel(ChannelType a, ChannelType r, ChannelType g, ChannelType b, unsigned bitDepth = 8) {
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
m_BitDepth[i] = bitDepth;
|
|
||||||
|
|
||||||
color[0] = a;
|
|
||||||
color[1] = r;
|
|
||||||
color[2] = g;
|
|
||||||
color[3] = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Changes the depth of each pixel. This scales the values to
|
// Changes the depth of each pixel. This scales the values to
|
||||||
// the appropriate bit depth by either truncating the least
|
// the appropriate bit depth by either truncating the least
|
||||||
|
Loading…
Reference in New Issue
Block a user