Initial test bootstrap.
This commit is contained in:
parent
6c618749f1
commit
4b308f6c32
94 changed files with 2543 additions and 681 deletions
|
@ -10,26 +10,46 @@ std::string PngHeader::toString() const
|
|||
sstr << "PngHeader" << "\n";
|
||||
sstr << "width: " << mWidth << "\n";
|
||||
sstr << "height: " << mHeight << "\n";
|
||||
sstr << "bitDepth: " << (int)mBitDepth << "\n";
|
||||
sstr << "bitDepth: " << static_cast<int>(mBitDepth) << "\n";
|
||||
sstr << "cached CRC: " << mCachedCrc << "\n";
|
||||
|
||||
sstr << mPngInfo.toString();
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
uint32_t PngHeader::getLength() const
|
||||
DWord PngHeader::getWidth() const
|
||||
{
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
DWord PngHeader::getHeight() const
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
Byte PngHeader::getBitDepth() const
|
||||
{
|
||||
return mBitDepth;
|
||||
}
|
||||
|
||||
const PngInfo& PngHeader::getPngInfo() const
|
||||
{
|
||||
return mPngInfo;
|
||||
}
|
||||
|
||||
DWord PngHeader::getLength() const
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
|
||||
unsigned char PngHeader::getHighBitCheck() const
|
||||
Byte PngHeader::getHighBitCheck() const
|
||||
{
|
||||
return 0x89;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> PngHeader::getSignature() const
|
||||
void PngHeader::getSignature(VecBytes& sig) const
|
||||
{
|
||||
return {13, 10, 26, 10};
|
||||
sig = {13, 10, 26, 10};
|
||||
}
|
||||
|
||||
std::string PngHeader::getFileName() const
|
||||
|
@ -42,7 +62,7 @@ const std::string& PngHeader::getChunkName() const
|
|||
return mName;
|
||||
}
|
||||
|
||||
const std::vector<unsigned char>& PngHeader::getData() const
|
||||
const VecBytes& PngHeader::getData() const
|
||||
{
|
||||
return mData;
|
||||
}
|
||||
|
@ -50,9 +70,9 @@ const std::vector<unsigned char>& PngHeader::getData() const
|
|||
void PngHeader::updateData()
|
||||
{
|
||||
mData.clear();
|
||||
unsigned num_bytes = sizeof(uint32_t);
|
||||
const auto num_bytes = sizeof(DWord);
|
||||
|
||||
for(unsigned idx=0; idx<num_bytes;idx++)
|
||||
for(std::size_t idx=0; idx<num_bytes;idx++)
|
||||
{
|
||||
mData.push_back(ByteUtils::getByteN(mWidth, idx));
|
||||
}
|
||||
|
@ -62,13 +82,13 @@ void PngHeader::updateData()
|
|||
mData.push_back(ByteUtils::getByteN(mHeight, idx));
|
||||
}
|
||||
mData.push_back(mBitDepth);
|
||||
mData.push_back(static_cast<unsigned char>(mPngInfo.mColorType));
|
||||
mData.push_back(static_cast<unsigned char>(mPngInfo.mCompressionMethod));
|
||||
mData.push_back(static_cast<unsigned char>(mPngInfo.mFilterMethod));
|
||||
mData.push_back(static_cast<unsigned char>(mPngInfo.mInterlaceMethod));
|
||||
mData.push_back(static_cast<Byte>(mPngInfo.mColorType));
|
||||
mData.push_back(static_cast<Byte>(mPngInfo.mCompressionMethod));
|
||||
mData.push_back(static_cast<Byte>(mPngInfo.mFilterMethod));
|
||||
mData.push_back(static_cast<Byte>(mPngInfo.mInterlaceMethod));
|
||||
}
|
||||
|
||||
uint32_t PngHeader::getCrc()
|
||||
DWord PngHeader::getCrc()
|
||||
{
|
||||
CyclicRedundancyChecker crc_check;
|
||||
std::vector<unsigned char> char_data = StringUtils::toBytes(mName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue