mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Move decoder-agnostic love.image code out of the magpie backend folder.
--HG-- branch : minor
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
// LOVE
|
||||
#include "STBHandler.h"
|
||||
#include "image/ImageData.h"
|
||||
|
||||
static void loveSTBIAssert(bool test, const char *teststr)
|
||||
{
|
||||
@@ -60,9 +61,9 @@ bool STBHandler::canDecode(love::filesystem::FileData *data)
|
||||
return status == 1 && w > 0 && h > 0;
|
||||
}
|
||||
|
||||
bool STBHandler::canEncode(PixelFormat rawFormat, ImageData::EncodedFormat encodedFormat)
|
||||
bool STBHandler::canEncode(PixelFormat rawFormat, EncodedFormat encodedFormat)
|
||||
{
|
||||
return encodedFormat == ImageData::ENCODED_TGA && rawFormat == PIXELFORMAT_RGBA8;
|
||||
return encodedFormat == ENCODED_TGA && rawFormat == PIXELFORMAT_RGBA8;
|
||||
}
|
||||
|
||||
FormatHandler::DecodedImage STBHandler::decode(love::filesystem::FileData *data)
|
||||
@@ -97,7 +98,7 @@ FormatHandler::DecodedImage STBHandler::decode(love::filesystem::FileData *data)
|
||||
return img;
|
||||
}
|
||||
|
||||
FormatHandler::EncodedImage STBHandler::encode(const DecodedImage &img, ImageData::EncodedFormat encodedFormat)
|
||||
FormatHandler::EncodedImage STBHandler::encode(const DecodedImage &img, EncodedFormat encodedFormat)
|
||||
{
|
||||
if (!canEncode(img.format, encodedFormat))
|
||||
throw love::Exception("Invalid format.");
|
||||
|
||||
Reference in New Issue
Block a user