Circle buffer and png cleaning.
This commit is contained in:
parent
59cc910d58
commit
5400a232dd
13 changed files with 353 additions and 122 deletions
|
@ -14,6 +14,7 @@ list(APPEND TestFiles
|
|||
core/TestBinaryStream.cpp
|
||||
core/TestBitStream.cpp
|
||||
core/TestTomlReader.cpp
|
||||
core/TestDataStructures.cpp
|
||||
compiler/TestLexer.cpp
|
||||
compiler/TestTemplatingEngine.cpp
|
||||
compression/TestStreamCompressor.cpp
|
||||
|
|
34
test/core/TestDataStructures.cpp
Normal file
34
test/core/TestDataStructures.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "CircleBuffer.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
CircleBuffer<unsigned> buffer(3);
|
||||
|
||||
for (auto item : {1, 2, 3})
|
||||
{
|
||||
std::cout << "Add item: " << item << std::endl;
|
||||
buffer.addItem(item);
|
||||
}
|
||||
|
||||
for (std::size_t idx=0; idx<3; idx++)
|
||||
{
|
||||
auto item = buffer.getItem(idx);
|
||||
std::cout << "Got item: " << idx << " " << item << std::endl;
|
||||
}
|
||||
|
||||
for (auto item : {4, 5})
|
||||
{
|
||||
std::cout << "Add item: " << item << std::endl;
|
||||
buffer.addItem(item);
|
||||
}
|
||||
|
||||
for (std::size_t idx=0; idx<3; idx++)
|
||||
{
|
||||
auto item = buffer.getItem(idx);
|
||||
std::cout << "Got item: " << idx << " " << item << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -9,15 +9,15 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
unsigned width = 200;
|
||||
unsigned height = 200;
|
||||
unsigned width = 20;
|
||||
unsigned height = 20;
|
||||
unsigned numChannels = 3;
|
||||
auto image = Image<unsigned char>::Create(width, height);
|
||||
image->setNumChannels(numChannels);
|
||||
|
||||
std::vector<unsigned char> data(image->getBytesPerRow()*height, 0);
|
||||
|
||||
ImagePrimitives::drawAlternatingStrips(data, width,height, numChannels, image->getBytesPerRow());
|
||||
ImagePrimitives::drawAlternatingStrips(data, width, height, numChannels, image->getBytesPerRow());
|
||||
image->setData(data);
|
||||
|
||||
PngWriter writer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue