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:
@@ -25,6 +25,8 @@ public:
|
||||
|
||||
void operator() (const RgbImage& inputImage);
|
||||
|
||||
private:
|
||||
void writeImage(const RgbImage& inputImage);
|
||||
|
||||
private:
|
||||
RgbImage* mBuffer;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
// Local includes
|
||||
#include "RgbColor.h"
|
||||
@@ -33,13 +34,17 @@ public:
|
||||
|
||||
inline void copy(const RgbImage& other)
|
||||
{
|
||||
std::cout << "This image size: [" << width() << "x" << height() << "]. Other image size: [" << other.width() << "x" << other.height() << "]" << std::endl;
|
||||
assert(other.mWidth == mWidth);
|
||||
assert(other.mHeight == mHeight);
|
||||
|
||||
memcpy(mColors, other.mColors, mWidth*mHeight*sizeof(RgbColor));
|
||||
}
|
||||
|
||||
RgbColor* memptr()
|
||||
{
|
||||
return mColors;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
inline unsigned toIndex(const unsigned x, const unsigned y) const
|
||||
@@ -47,19 +52,9 @@ private:
|
||||
return y*mWidth + x;
|
||||
}
|
||||
|
||||
RgbImage(const RgbImage&)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
RgbImage& operator=(const RgbImage& other)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned mWidth;
|
||||
unsigned mHeight;
|
||||
const unsigned mWidth;
|
||||
const unsigned mHeight;
|
||||
|
||||
/** The colors of the image */
|
||||
RgbColor* mColors;
|
||||
|
Reference in New Issue
Block a user