Clean up compiltaiton.
This commit is contained in:
parent
3c6756d7a1
commit
a19567508e
5 changed files with 18 additions and 12 deletions
|
@ -22,6 +22,11 @@ public:
|
||||||
return idx * this->mNumZ + jdx * this->mNumX * this->mNumZ + kdx;
|
return idx * this->mNumZ + jdx * this->mNumX * this->mNumZ + kdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setData(const std::vector<T>& data)
|
||||||
|
{
|
||||||
|
this->mData->setData(data);
|
||||||
|
}
|
||||||
|
|
||||||
void setItem(std::size_t idx, std::size_t jdx, std::size_t kdx, const T& value) override
|
void setItem(std::size_t idx, std::size_t jdx, std::size_t kdx, const T& value) override
|
||||||
{
|
{
|
||||||
this->mData->setItem(getOffset(idx, jdx, kdx), value);
|
this->mData->setItem(getOffset(idx, jdx, kdx), value);
|
||||||
|
|
|
@ -47,14 +47,14 @@ void Image::setPixelValues(const Indices& indices, const std::vector<Color>& col
|
||||||
|
|
||||||
if (mDataType == DataType::UCHAR)
|
if (mDataType == DataType::UCHAR)
|
||||||
{
|
{
|
||||||
auto data_t = getDataT<unsigned char>();
|
auto grid = getGridT<unsigned char>();
|
||||||
for (std::size_t idx=0; idx< indices.size(); idx++)
|
for (std::size_t idx=0; idx< indices.size(); idx++)
|
||||||
{
|
{
|
||||||
auto id = indices[idx];
|
auto id = indices[idx];
|
||||||
auto color = colors[idx];
|
auto color = colors[idx];
|
||||||
data_t->setItem(id.first, id.second, 0, color.getR());
|
grid->setItem(id.first, id.second, 0, color.getR());
|
||||||
data_t->setItem(id.first, id.second, 1, color.getG());
|
grid->setItem(id.first, id.second, 1, color.getG());
|
||||||
data_t->setItem(id.first, id.second, 2, color.getB());
|
grid->setItem(id.first, id.second, 2, color.getB());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,13 +89,13 @@ PlatformImage* Image::getPlatformImage()
|
||||||
return mPlatformImage.get();
|
return mPlatformImage.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractGrid* Image::getData() const
|
AbstractGrid* Image::getGrid() const
|
||||||
{
|
{
|
||||||
return mData.get();
|
return mData.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Grid<T>* Image::getDataT() const
|
Grid<T>* Image::getGridT() const
|
||||||
{
|
{
|
||||||
return dynamic_cast<Grid<T>*>(this->mData.get());
|
return dynamic_cast<Grid<T>*>(this->mData.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@ public:
|
||||||
unsigned getBitDepth() const;
|
unsigned getBitDepth() const;
|
||||||
unsigned getNumChannels() const;
|
unsigned getNumChannels() const;
|
||||||
|
|
||||||
AbstractGrid* getData() const;
|
AbstractGrid* getGrid() const;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Grid<T>* getDataT() const;
|
Grid<T>* getGridT() const;
|
||||||
|
|
||||||
DataType getType() const;
|
DataType getType() const;
|
||||||
PlatformImage* getPlatformImage();
|
PlatformImage* getPlatformImage();
|
||||||
|
|
|
@ -11,7 +11,7 @@ ImageBitStream::ImageBitStream(Image* image)
|
||||||
|
|
||||||
bool ImageBitStream::isFinished() const
|
bool ImageBitStream::isFinished() const
|
||||||
{
|
{
|
||||||
return mByteOffset == mImage->getData()->getDataSize();
|
return mByteOffset == mImage->getGrid()->getDataSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<unsigned char> ImageBitStream::peekNextNBytes(unsigned n) const
|
std::vector<unsigned char> ImageBitStream::peekNextNBytes(unsigned n) const
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "ByteUtils.h"
|
#include "ByteUtils.h"
|
||||||
|
#include "Grid.h"
|
||||||
#include "ImagePrimitives.h"
|
#include "ImagePrimitives.h"
|
||||||
|
|
||||||
#include "TestFramework.h"
|
#include "TestFramework.h"
|
||||||
|
@ -26,7 +27,7 @@ TEST_CASE(TestCompressedPng, "image")
|
||||||
data[idx] = val;
|
data[idx] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic_cast<ImageDataT<unsigned char>*>(image->getData())->setData(data);
|
image->getGridT<unsigned char>()->setData(data);
|
||||||
|
|
||||||
PngWriter writer;
|
PngWriter writer;
|
||||||
writer.setPath(TestUtils::getTestOutputDir() / "test_compressed.png");
|
writer.setPath(TestUtils::getTestOutputDir() / "test_compressed.png");
|
||||||
|
@ -60,7 +61,7 @@ TEST_CASE(TestFixedPng, "image")
|
||||||
data[idx] = val;
|
data[idx] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic_cast<ImageDataT<unsigned char>*>(image->getData())->setData(data);
|
image->getGridT<unsigned char>()->setData(data);
|
||||||
|
|
||||||
PngWriter writer;
|
PngWriter writer;
|
||||||
writer.setPath(TestUtils::getTestOutputDir() / "test_fixed.png");
|
writer.setPath(TestUtils::getTestOutputDir() / "test_fixed.png");
|
||||||
|
@ -90,7 +91,7 @@ TEST_CASE(TestDynamicCompressedPng, "image")
|
||||||
data[idx] = val;
|
data[idx] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic_cast<ImageDataT<unsigned char>*>(image->getData())->setData(data);
|
image->getGridT<unsigned char>()->setData(data);
|
||||||
|
|
||||||
PngWriter writer;
|
PngWriter writer;
|
||||||
writer.setPath(TestUtils::getTestOutputDir() / "test_dynamic.png");
|
writer.setPath(TestUtils::getTestOutputDir() / "test_dynamic.png");
|
||||||
|
|
Loading…
Reference in a new issue