mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Fixed memory overwrite bug. This fixes the png writer and led control.
This commit is contained in:
@@ -10,19 +10,16 @@
|
||||
RgbImage::RgbImage(const unsigned width, const unsigned height, const RgbColor background) :
|
||||
mWidth(width),
|
||||
mHeight(height),
|
||||
mColors(nullptr)
|
||||
mColors(new RgbColor[width*height])
|
||||
{
|
||||
mColors = new RgbColor[width*height];
|
||||
for (RgbColor* color = mColors; color <= mColors+(mWidth*mHeight); ++color)
|
||||
for (unsigned i=0; i<width*height; ++i)
|
||||
{
|
||||
*color = background;
|
||||
mColors[i] = background;
|
||||
}
|
||||
}
|
||||
|
||||
RgbImage::~RgbImage()
|
||||
{
|
||||
std::cout << "RgbImage(" << this << ") is being deleted" << std::endl;
|
||||
|
||||
delete[] mColors;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user