aboutsummaryrefslogtreecommitdiff
path: root/src/image.cpp
diff options
context:
space:
mode:
authorBossCode45 <boss@tehbox.org>2025-06-28 00:44:40 +1200
committerBossCode45 <boss@tehbox.org>2025-07-24 12:48:21 +1200
commit3e4cad0bfd36536ffc870d16a6e26aac5049dd0b (patch)
tree3f0ecd09760267a108f5d97e43d31cfb8741cf55 /src/image.cpp
parent078b4e08fe3bccb7424dac76e158bf8bf48a182d (diff)
downloadtehimage-3e4cad0bfd36536ffc870d16a6e26aac5049dd0b.tar.gz
tehimage-3e4cad0bfd36536ffc870d16a6e26aac5049dd0b.zip
fixup: Updated some stuff
Mainly just cleaning up code
Diffstat (limited to 'src/image.cpp')
-rw-r--r--src/image.cpp22
1 files changed, 17 insertions, 5 deletions
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 <algorithm>
+#include <cstdint>
-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<uint8_t[]>(imageDataSize);
+ std::copy_n(other.imageData.get(), imageDataSize, imageData.get());
}