Use vector for pixels in Image
This commit is contained in:
1 parent
6849d583ae
commit
917bfe4821
2 files changed
+3
-9
No files matched your search
+1
-7
@@ -1,12 +1,6 @@
|
||||
#include <fart/Image.h>
|
||||
|
||||
Image::Image(size_t width, size_t height)
|
||||
: width(width), height(height)
|
||||
: width(width), height(height), pixels(width * height)
|
||||
{
|
||||
this->pixels = new Color[width * height];
|
||||
}
|
||||
|
||||
Image::~Image()
|
||||
{
|
||||
delete[] this->pixels;
|
||||
}
|
||||
+2
-2
@@ -2,14 +2,14 @@
|
||||
|
||||
#include <fart/Color.h>
|
||||
#include <stddef.h>
|
||||
#include <vector>
|
||||
|
||||
struct Image
|
||||
{
|
||||
size_t width;
|
||||
size_t height;
|
||||
Color * pixels;
|
||||
std::vector<Color> pixels;
|
||||
Image(size_t width, size_t height);
|
||||
~Image();
|
||||
|
||||
Color & operator[](size_t x, size_t y)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user