constify some method declarations

This commit is contained in:
Pavel Krajcevski 2013-08-29 11:57:46 -04:00
parent c5fb5ba0b1
commit 55a61b5d8d
2 changed files with 8 additions and 6 deletions

View file

@ -57,7 +57,9 @@
namespace PVRTCC { namespace PVRTCC {
void Pixel::FromBits(uint8 *bits, uint8 channelDepth[4], uint8 bitOffset) { void Pixel::FromBits(const uint8 *bits,
const uint8 channelDepth[4],
uint8 bitOffset) {
memcpy(m_BitDepth, channelDepth, sizeof(m_BitDepth)); memcpy(m_BitDepth, channelDepth, sizeof(m_BitDepth));
uint32 nBits = bitOffset; uint32 nBits = bitOffset;

View file

@ -61,18 +61,18 @@ class Pixel {
public: public:
Pixel(): m_R(0), m_G(0), m_B(0), m_A(0) { } Pixel(): m_R(0), m_G(0), m_B(0), m_A(0) { }
explicit Pixel(uint8 *bits, explicit Pixel(const uint8 *bits,
uint8 channelDepth[4] = static_cast<uint8 *>(0), const uint8 channelDepth[4] = static_cast<uint8 *>(0),
uint8 bitOffset = 0) { uint8 bitOffset = 0) {
FromBits(bits, channelDepth); FromBits(bits, channelDepth, bitOffset);
} }
// Reads a pixel from memory given the bit depth. If NULL then // Reads a pixel from memory given the bit depth. If NULL then
// it is assumed to be 8 bit RGBA. The bit offset is the offset // it is assumed to be 8 bit RGBA. The bit offset is the offset
// from the least significant bit from which we start reading // from the least significant bit from which we start reading
// the pixel values. // the pixel values.
void FromBits(uint8 *bits, void FromBits(const uint8 *bits,
uint8 channelDepth[4] = static_cast<uint8 *>(0), const uint8 channelDepth[4] = static_cast<uint8 *>(0),
uint8 bitOffset = 0); uint8 bitOffset = 0);
// Changes the depth of each pixel. This scales the values to // Changes the depth of each pixel. This scales the values to