aboutsummaryrefslogtreecommitdiff
path: root/src/image.cpp
diff options
context:
space:
mode:
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());
}