From 3e4cad0bfd36536ffc870d16a6e26aac5049dd0b Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Sat, 28 Jun 2025 00:44:40 +1200 Subject: fixup: Updated some stuff Mainly just cleaning up code --- src/image.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/image.cpp') diff --git a/src/image.cpp b/src/image.cpp index f819b94..e23e3f6 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1,9 +1,21 @@ #include "image.h" +#include +#include -Image::~Image() +Image::Image(const Image& other) { - if(width != 0) - { - delete[] imageData; - } + this->colorValues = other.colorValues; + this->bpp = other.bpp; + + this->width = other.width; + this->height = other.height; + this->bitDepth = other.bitDepth; + this->colorType = other.colorType; + this->compressionMethod = other.compressionMethod; + this->filterMethod = other.filterMethod; + this->interlaceMethod = other.interlaceMethod; + + unsigned long imageDataSize = width * height * bpp; + imageData = std::make_unique(imageDataSize); + std::copy_n(other.imageData.get(), imageDataSize, imageData.get()); } -- cgit v1.2.3