Use vector for pixels in Image

This commit is contained in:
josh committed 2026-10-28 21:16:22 -04:00
1 parent 6849d583ae
commit 917bfe4821
2 files changed
+3 -9

No files matched your search

+1 -7
View File
@@ -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
View File
@@ -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)
{