Merge Image and Canvas GL backend classes into new common Texture class.

This commit is contained in:
Alex Szpakowski
2020-02-07 20:29:21 -04:00
parent 17f77407bb
commit 12c90b3dca
21 changed files with 521 additions and 679 deletions
+3 -3
View File
@@ -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)
+1 -1
View File
@@ -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);