From 917bfe4821fc383aaf64866ae21d15f94fdaa547 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 28 Oct 2026 21:16:22 -0400 Subject: [PATCH] Use vector for pixels in Image --- src/fart/Image.cpp | 8 +------- src/fart/Image.h | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/fart/Image.cpp b/src/fart/Image.cpp index c520094..960358c 100644 --- a/src/fart/Image.cpp +++ b/src/fart/Image.cpp @@ -1,12 +1,6 @@ #include 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; } diff --git a/src/fart/Image.h b/src/fart/Image.h index a7bbd6f..f4c7078 100644 --- a/src/fart/Image.h +++ b/src/fart/Image.h @@ -2,14 +2,14 @@ #include #include +#include struct Image { size_t width; size_t height; - Color * pixels; + std::vector pixels; Image(size_t width, size_t height); - ~Image(); Color & operator[](size_t x, size_t y) {