Circle buffer and png cleaning.

This commit is contained in:
James Grogan 2022-11-24 09:05:39 +00:00
parent 59cc910d58
commit 5400a232dd
13 changed files with 353 additions and 122 deletions

View file

@ -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

View 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;
}

View file

@ -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;