mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
Data:clone ported to minor
minor tweaks --HG-- branch : minor
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user