Data:clone ported to minor

minor tweaks

--HG--
branch : minor
This commit is contained in:
Raidho
2017-02-10 06:19:53 +03:00
parent bc6a2db22f
commit 6ea1ebde9c
22 changed files with 203 additions and 0 deletions
+19
View File
@@ -78,6 +78,20 @@ ImageData::ImageData(std::list<FormatHandler *> formatHandlers, int width, int h
handler->retain();
}
ImageData::ImageData(const ImageData &c)
: formatHandlers(c.formatHandlers)
, decodeHandler(nullptr)
{
width = c.width;
height = c.height;
format = c.format;
for (FormatHandler *handler : formatHandlers)
handler->retain();
create(width, height, format, c.getData());
}
ImageData::~ImageData()
{
if (decodeHandler)
@@ -89,6 +103,11 @@ ImageData::~ImageData()
handler->release();
}
Data *ImageData::clone() const
{
return new ImageData(*this);
}
void ImageData::create(int width, int height, PixelFormat format, void *data)
{
size_t datasize = width * height * getPixelFormatSize(format);