mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Fixed detection of TGA and BMP images and updated stb_image to the latest version.
--HG-- branch : minor
This commit is contained in:
@@ -1021,7 +1021,6 @@ add_library(love_3p_noise1234 ${LOVE_SRC_3P_NOISE1234})
|
||||
#
|
||||
|
||||
set(LOVE_SRC_3P_STB
|
||||
src/libraries/stb/stb_image.c
|
||||
src/libraries/stb/stb_image.h
|
||||
)
|
||||
|
||||
|
||||
@@ -231,7 +231,6 @@
|
||||
FA48E43618F10D00007CF0BD /* JPEGHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA48E43418F10D00007CF0BD /* JPEGHandler.cpp */; };
|
||||
FA48E43718F10D00007CF0BD /* JPEGHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA48E43518F10D00007CF0BD /* JPEGHandler.h */; };
|
||||
FA48E43918F10D6C007CF0BD /* jpeg-turbo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA48E43818F10D6C007CF0BD /* jpeg-turbo.framework */; };
|
||||
FA4B5B7519369009006C6D93 /* stb_image.c in Sources */ = {isa = PBXBuildFile; fileRef = FA4B5B7319369009006C6D93 /* stb_image.c */; };
|
||||
FA4B5B7A1936B688006C6D93 /* stb_image.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4B5B781936B688006C6D93 /* stb_image.h */; };
|
||||
FA4BBCDE18A5DC5D0027707D /* lodepng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4BBCDC18A5DC5D0027707D /* lodepng.cpp */; };
|
||||
FA4BBCDF18A5DC5D0027707D /* lodepng.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4BBCDD18A5DC5D0027707D /* lodepng.h */; };
|
||||
@@ -791,7 +790,6 @@
|
||||
FA48E43418F10D00007CF0BD /* JPEGHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JPEGHandler.cpp; sourceTree = "<group>"; };
|
||||
FA48E43518F10D00007CF0BD /* JPEGHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JPEGHandler.h; sourceTree = "<group>"; };
|
||||
FA48E43818F10D6C007CF0BD /* jpeg-turbo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "jpeg-turbo.framework"; path = "/Library/Frameworks/jpeg-turbo.framework"; sourceTree = "<absolute>"; };
|
||||
FA4B5B7319369009006C6D93 /* stb_image.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stb_image.c; sourceTree = "<group>"; };
|
||||
FA4B5B781936B688006C6D93 /* stb_image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stb_image.h; sourceTree = "<group>"; };
|
||||
FA4BBCDC18A5DC5D0027707D /* lodepng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lodepng.cpp; sourceTree = "<group>"; };
|
||||
FA4BBCDD18A5DC5D0027707D /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = "<group>"; };
|
||||
@@ -1859,7 +1857,6 @@
|
||||
FA4B5B7219369009006C6D93 /* stb */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FA4B5B7319369009006C6D93 /* stb_image.c */,
|
||||
FA4B5B781936B688006C6D93 /* stb_image.h */,
|
||||
);
|
||||
path = stb;
|
||||
@@ -2206,7 +2203,6 @@
|
||||
FA08F5EF16C7538F00F007B5 /* b2RevoluteJoint.cpp in Sources */,
|
||||
FA08F5F016C7538F00F007B5 /* b2RopeJoint.cpp in Sources */,
|
||||
FA08F5F116C7538F00F007B5 /* b2WeldJoint.cpp in Sources */,
|
||||
FA4B5B7519369009006C6D93 /* stb_image.c in Sources */,
|
||||
FA4BBCDE18A5DC5D0027707D /* lodepng.cpp in Sources */,
|
||||
FA08F5F216C7538F00F007B5 /* b2WheelJoint.cpp in Sources */,
|
||||
FA08F5F316C7539B00F007B5 /* b2Rope.cpp in Sources */,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+4425
-52
File diff suppressed because it is too large
Load Diff
@@ -21,11 +21,18 @@
|
||||
// LOVE
|
||||
#include "STBHandler.h"
|
||||
|
||||
// stb_image
|
||||
#include "libraries/stb/stb_image.h"
|
||||
static void loveSTBAssert(bool test, const char *teststr)
|
||||
{
|
||||
if (!test)
|
||||
throw love::Exception("Could not decode image (stb_image assertion '%s' failed)", teststr);
|
||||
}
|
||||
|
||||
// C++
|
||||
#include <algorithm>
|
||||
// stb_image
|
||||
#define STBI_NO_HDR
|
||||
#define STBI_NO_STDIO
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STBI_ASSERT(A) loveSTBAssert((A), #A)
|
||||
#include "libraries/stb/stb_image.h"
|
||||
|
||||
// C
|
||||
#include <cstdlib>
|
||||
@@ -39,10 +46,11 @@ namespace magpie
|
||||
|
||||
bool STBHandler::canDecode(love::filesystem::FileData *data)
|
||||
{
|
||||
std::string ext = data->getExtension();
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), tolower);
|
||||
stbi__context s = {};
|
||||
stbi__start_mem(&s, (const stbi_uc *) data->getData(), (int) data->getSize());
|
||||
|
||||
return (ext.compare("tga") == 0) || (ext.compare("bmp") == 0);
|
||||
// These are internal stb_image functions, but we can still use them!
|
||||
return stbi__bmp_test(&s) || stbi__tga_test(&s);
|
||||
}
|
||||
|
||||
bool STBHandler::canEncode(ImageData::Format format)
|
||||
|
||||
Reference in New Issue
Block a user