Move decoder-agnostic love.image code out of the magpie backend folder.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-08-01 23:22:24 -03:00
parent 217552b5ff
commit 84d5d8b636
37 changed files with 631 additions and 921 deletions
+3 -3
View File
@@ -140,9 +140,9 @@ bool PNGHandler::canDecode(love::filesystem::FileData *data)
return status == 0 && width > 0 && height > 0;
}
bool PNGHandler::canEncode(PixelFormat rawFormat, ImageData::EncodedFormat encodedFormat)
bool PNGHandler::canEncode(PixelFormat rawFormat, EncodedFormat encodedFormat)
{
return encodedFormat == ImageData::ENCODED_PNG
return encodedFormat == ENCODED_PNG
&& (rawFormat == PIXELFORMAT_RGBA8 || rawFormat == PIXELFORMAT_RGBA16);
}
@@ -199,7 +199,7 @@ PNGHandler::DecodedImage PNGHandler::decode(love::filesystem::FileData *fdata)
return img;
}
PNGHandler::EncodedImage PNGHandler::encode(const DecodedImage &img, ImageData::EncodedFormat encodedFormat)
FormatHandler::EncodedImage PNGHandler::encode(const DecodedImage &img, EncodedFormat encodedFormat)
{
if (!canEncode(img.format, encodedFormat))
throw love::Exception("PNG encoder cannot encode to non-PNG format.");