mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Merge Image and Canvas GL backend classes into new common Texture class.
This commit is contained in:
@@ -84,7 +84,7 @@ love::image::ImageData *ImageData::clone() const
|
||||
|
||||
void ImageData::create(int width, int height, PixelFormat format, void *data)
|
||||
{
|
||||
size_t datasize = width * height * getPixelFormatSize(format);
|
||||
size_t datasize = getPixelFormatSliceSize(format, width, height);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -140,7 +140,7 @@ void ImageData::decode(Data *data)
|
||||
throw love::Exception("Could not decode data to ImageData: unsupported encoded format");
|
||||
}
|
||||
|
||||
if (decodedimage.size != decodedimage.width * decodedimage.height * getPixelFormatSize(decodedimage.format))
|
||||
if (decodedimage.size != getPixelFormatSliceSize(decodedimage.format, decodedimage.width, decodedimage.height))
|
||||
{
|
||||
decoder->freeRawPixels(decodedimage.data);
|
||||
throw love::Exception("Could not convert image!");
|
||||
@@ -782,7 +782,7 @@ love::thread::Mutex *ImageData::getMutex() const
|
||||
|
||||
size_t ImageData::getPixelSize() const
|
||||
{
|
||||
return getPixelFormatSize(format);
|
||||
return getPixelFormatBlockSize(format);
|
||||
}
|
||||
|
||||
bool ImageData::validPixelFormat(PixelFormat format)
|
||||
|
||||
@@ -193,7 +193,7 @@ FormatHandler::DecodedImage EXRHandler::decode(Data *data)
|
||||
throw love::Exception("Could not decode EXR image: unknown pixel format.");
|
||||
}
|
||||
|
||||
img.size = img.width * img.height * getPixelFormatSize(img.format);
|
||||
img.size = getPixelFormatSliceSize(img.format, img.width, img.height);
|
||||
|
||||
FreeEXRImage(&exrImage);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user