Browse Source

Removed libjpeg-turbo as a dependency (closes issue #1031.) Removed jpeg support for ImageData:encode. stb_image now handles jpeg image loading.

Alex Szpakowski 10 years ago
parent
commit
5dbf589d47

+ 0 - 3
CMakeLists.txt

@@ -364,8 +364,6 @@ set(LOVE_SRC_MODULE_IMAGE_MAGPIE
 	src/modules/image/magpie/Image.h
 	src/modules/image/magpie/ImageData.cpp
 	src/modules/image/magpie/ImageData.h
-	src/modules/image/magpie/JPEGHandler.cpp
-	src/modules/image/magpie/JPEGHandler.h
 	src/modules/image/magpie/KTXHandler.cpp
 	src/modules/image/magpie/KTXHandler.h
 	src/modules/image/magpie/PKMHandler.cpp
@@ -1217,7 +1215,6 @@ link_directories(${SDL_LINK_DIR})
 
 set(LOVE_MEGA_3P
 	${MEGA_FREETYPE}
-	${MEGA_JPEG_TURBO}
 	${MEGA_LIBOGG}
 	${MEGA_LIBVORBISFILE}
 	${MEGA_LIBVORBIS}

+ 0 - 1
platform/unix/configure.ac

@@ -64,7 +64,6 @@ PKG_CHECK_MODULES([zlib], [zlib], [], [LOVE_MSG_ERROR([zlib])])
 # Other libraries
 AC_SEARCH_LIBS([sqrt], [m], [], [LOVE_MSG_ERROR([the C math library])])
 AC_SEARCH_LIBS([PHYSFS_init], [physfs], [], [LOVE_MSG_ERROR([PhysicsFS])])
-AC_SEARCH_LIBS([tjInitCompress], [turbojpeg], [], [LOVE_MSG_ERROR([TurboJPEG])])
 
 # Lua, treated seperately because of --with-lua
 AS_VAR_IF([with_luaversion], [5.2], [luatest=lua_version], [luatest=lua_pcall]) # use lua_version for 5.2

+ 0 - 2
platform/unix/debian/control.in

@@ -18,7 +18,6 @@ Build-Depends: debhelper (>= 9),
                libmodplug-dev,
                libmpg123-dev,
                zlib1g-dev,
-               libjpeg-turbo8-dev
 Standards-Version: 3.9.5
 Homepage: http://love2d.org
 
@@ -40,7 +39,6 @@ Depends: ${misc:Depends},
          libmodplug1,
          libmpg123-0,
          zlib1g,
-         libjpeg-turbo8
 Description: LOVE is a free 2D game engine which enables easy game creation in Lua.
 
 Package: love@LOVE_SUFFIX@

+ 0 - 20
platform/xcode/liblove.xcodeproj/project.pbxproj

@@ -489,9 +489,6 @@
 		FA0B7D991A95902C000E1D17 /* ImageIOHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD41A95902C000E1D17 /* ImageIOHandler.cpp */; };
 		FA0B7D9A1A95902C000E1D17 /* ImageIOHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD41A95902C000E1D17 /* ImageIOHandler.cpp */; };
 		FA0B7D9B1A95902C000E1D17 /* ImageIOHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BD51A95902C000E1D17 /* ImageIOHandler.h */; };
-		FA0B7D9C1A95902C000E1D17 /* JPEGHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD61A95902C000E1D17 /* JPEGHandler.cpp */; };
-		FA0B7D9D1A95902C000E1D17 /* JPEGHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD61A95902C000E1D17 /* JPEGHandler.cpp */; };
-		FA0B7D9E1A95902C000E1D17 /* JPEGHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BD71A95902C000E1D17 /* JPEGHandler.h */; };
 		FA0B7D9F1A95902C000E1D17 /* KTXHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */; };
 		FA0B7DA01A95902C000E1D17 /* KTXHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */; };
 		FA0B7DA11A95902C000E1D17 /* KTXHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BD91A95902C000E1D17 /* KTXHandler.h */; };
@@ -823,7 +820,6 @@
 		FA0B7EEA1A95902D000E1D17 /* wrap_Window.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7CCC1A95902C000E1D17 /* wrap_Window.h */; };
 		FA0B7EF21A959D2C000E1D17 /* iOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7EF11A959D2C000E1D17 /* iOS.mm */; };
 		FA317EBA18F28B6D00B0BCD7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA317EB918F28B6D00B0BCD7 /* libz.dylib */; };
-		FA48E43918F10D6C007CF0BD /* jpeg-turbo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA48E43818F10D6C007CF0BD /* jpeg-turbo.framework */; };
 		FA4B66C91ABBCF1900558F15 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4B66C81ABBCF1900558F15 /* Timer.cpp */; };
 		FA4B66CA1ABBCF1900558F15 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA4B66C81ABBCF1900558F15 /* Timer.cpp */; };
 		FA577AB016C7507900860150 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA577A7916C71A1700860150 /* Cocoa.framework */; };
@@ -1251,8 +1247,6 @@
 		FA0B7BD31A95902C000E1D17 /* ImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageData.h; sourceTree = "<group>"; };
 		FA0B7BD41A95902C000E1D17 /* ImageIOHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageIOHandler.cpp; sourceTree = "<group>"; };
 		FA0B7BD51A95902C000E1D17 /* ImageIOHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageIOHandler.h; sourceTree = "<group>"; };
-		FA0B7BD61A95902C000E1D17 /* JPEGHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JPEGHandler.cpp; sourceTree = "<group>"; };
-		FA0B7BD71A95902C000E1D17 /* JPEGHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JPEGHandler.h; sourceTree = "<group>"; };
 		FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KTXHandler.cpp; sourceTree = "<group>"; };
 		FA0B7BD91A95902C000E1D17 /* KTXHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTXHandler.h; sourceTree = "<group>"; };
 		FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PKMHandler.cpp; sourceTree = "<group>"; };
@@ -1478,7 +1472,6 @@
 		FA0B7EF01A959D2C000E1D17 /* iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iOS.h; sourceTree = "<group>"; };
 		FA0B7EF11A959D2C000E1D17 /* iOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = iOS.mm; sourceTree = "<group>"; };
 		FA317EB918F28B6D00B0BCD7 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
-		FA48E43818F10D6C007CF0BD /* jpeg-turbo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "jpeg-turbo.framework"; path = "/Library/Frameworks/jpeg-turbo.framework"; sourceTree = "<absolute>"; };
 		FA4B66C81ABBCF1900558F15 /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = "<group>"; };
 		FA577A6716C719D900860150 /* FreeType.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FreeType.framework; path = /Library/Frameworks/FreeType.framework; sourceTree = "<absolute>"; };
 		FA577A6D16C719EA00860150 /* Lua.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lua.framework; path = /Library/Frameworks/Lua.framework; sourceTree = "<absolute>"; };
@@ -1544,7 +1537,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				FA317EBA18F28B6D00B0BCD7 /* libz.dylib in Frameworks */,
-				FA48E43918F10D6C007CF0BD /* jpeg-turbo.framework in Frameworks */,
 				FAA627CE18E7E1560080752D /* CoreServices.framework in Frameworks */,
 				FA9B4A0816E1578300074F42 /* SDL2.framework in Frameworks */,
 				FAAFF04416CB11C700CCDE45 /* OpenAL-Soft.framework in Frameworks */,
@@ -2305,8 +2297,6 @@
 				FA0B7BD31A95902C000E1D17 /* ImageData.h */,
 				FA0B7BD41A95902C000E1D17 /* ImageIOHandler.cpp */,
 				FA0B7BD51A95902C000E1D17 /* ImageIOHandler.h */,
-				FA0B7BD61A95902C000E1D17 /* JPEGHandler.cpp */,
-				FA0B7BD71A95902C000E1D17 /* JPEGHandler.h */,
 				FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */,
 				FA0B7BD91A95902C000E1D17 /* KTXHandler.h */,
 				FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */,
@@ -2704,7 +2694,6 @@
 				FA577A7916C71A1700860150 /* Cocoa.framework */,
 				FAA627CD18E7E1560080752D /* CoreServices.framework */,
 				FA577A6716C719D900860150 /* FreeType.framework */,
-				FA48E43818F10D6C007CF0BD /* jpeg-turbo.framework */,
 				FA577A8216C71A5300860150 /* libmodplug.framework */,
 				FA317EB918F28B6D00B0BCD7 /* libz.dylib */,
 				FA577A6D16C719EA00860150 /* Lua.framework */,
@@ -2843,7 +2832,6 @@
 				FA0B7E5F1A95902C000E1D17 /* wrap_MouseJoint.h in Headers */,
 				FAB17BED1ABFAF1800F9BA27 /* CompressedData.h in Headers */,
 				FA0B7B361A958EA3000E1D17 /* wuff_convert.h in Headers */,
-				FA0B7D9E1A95902C000E1D17 /* JPEGHandler.h in Headers */,
 				FA0B7D981A95902C000E1D17 /* ImageData.h in Headers */,
 				FA0B7CDE1A95902C000E1D17 /* Source.h in Headers */,
 				FA0B7E141A95902C000E1D17 /* GearJoint.h in Headers */,
@@ -3284,7 +3272,6 @@
 				FA0B7DC51A95902C000E1D17 /* wrap_JoystickModule.cpp in Sources */,
 				FA0B7E701A95902C000E1D17 /* wrap_RopeJoint.cpp in Sources */,
 				FA0B7A7B1A958EA3000E1D17 /* b2Contact.cpp in Sources */,
-				FA0B7D9D1A95902C000E1D17 /* JPEGHandler.cpp in Sources */,
 				FA0B7A6F1A958EA3000E1D17 /* b2WorldCallbacks.cpp in Sources */,
 				FA0B793C1A958E3B000E1D17 /* runtime.cpp in Sources */,
 				FA0B7DBC1A95902C000E1D17 /* Joystick.cpp in Sources */,
@@ -3570,7 +3557,6 @@
 				FA0B7DC41A95902C000E1D17 /* wrap_JoystickModule.cpp in Sources */,
 				FA0B7E6F1A95902C000E1D17 /* wrap_RopeJoint.cpp in Sources */,
 				FA0B7AB51A958EA3000E1D17 /* ddsparse.cpp in Sources */,
-				FA0B7D9C1A95902C000E1D17 /* JPEGHandler.cpp in Sources */,
 				FA0B7A441A958EA3000E1D17 /* b2EdgeShape.cpp in Sources */,
 				FA0B79461A958E3B000E1D17 /* Vector.cpp in Sources */,
 				FA0B7DBB1A95902C000E1D17 /* Joystick.cpp in Sources */,
@@ -3875,7 +3861,6 @@
 					"$(inherited)",
 					LOVE_SUPPORT_IMAGEIO,
 					LOVE_SUPPORT_COREAUDIO,
-					LOVE_NO_TURBOJPEG,
 					LOVE_NO_MODPLUG,
 					LOVE_NOMPG123,
 				);
@@ -3892,7 +3877,6 @@
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/ios/libraries/freetype",
-					"$(PROJECT_DIR)/ios/libraries/libjpeg-turbo",
 					"$(PROJECT_DIR)/ios/libraries/lua",
 					"$(PROJECT_DIR)/ios/libraries/ogg",
 					"$(PROJECT_DIR)/ios/libraries/physfs",
@@ -3919,7 +3903,6 @@
 					"$(inherited)",
 					LOVE_SUPPORT_IMAGEIO,
 					LOVE_SUPPORT_COREAUDIO,
-					LOVE_NO_TURBOJPEG,
 					LOVE_NO_MODPLUG,
 					LOVE_NOMPG123,
 				);
@@ -3935,7 +3918,6 @@
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/ios/libraries/freetype",
-					"$(PROJECT_DIR)/ios/libraries/libjpeg-turbo",
 					"$(PROJECT_DIR)/ios/libraries/lua",
 					"$(PROJECT_DIR)/ios/libraries/ogg",
 					"$(PROJECT_DIR)/ios/libraries/physfs",
@@ -3963,7 +3945,6 @@
 					"$(inherited)",
 					LOVE_SUPPORT_IMAGEIO,
 					LOVE_SUPPORT_COREAUDIO,
-					LOVE_NO_TURBOJPEG,
 					LOVE_NO_MODPLUG,
 					LOVE_NOMPG123,
 				);
@@ -3979,7 +3960,6 @@
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/ios/libraries/freetype",
-					"$(PROJECT_DIR)/ios/libraries/libjpeg-turbo",
 					"$(PROJECT_DIR)/ios/libraries/lua",
 					"$(PROJECT_DIR)/ios/libraries/ogg",
 					"$(PROJECT_DIR)/ios/libraries/physfs",

+ 0 - 4
platform/xcode/love.xcodeproj/project.pbxproj

@@ -35,7 +35,6 @@
 		FA5D249C1A96CF4300C6FC8F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA5D249A1A96CF4300C6FC8F /* Images.xcassets */; };
 		FA5D24C21A96D78000C6FC8F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA5D24C11A96D78000C6FC8F /* Foundation.framework */; };
 		FA5D24D11A96E73300C6FC8F /* liblove.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA0B7EEF1A95924A000E1D17 /* liblove.a */; };
-		FA77A36518F1172600D23AE9 /* jpeg-turbo.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA77A36418F1172600D23AE9 /* jpeg-turbo.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		FA7C636A1A9C49570000FD29 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA7C63691A9C49570000FD29 /* Launch Screen.xib */; };
 		FA9B4A0A16E1579F00074F42 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; };
 		FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
@@ -74,7 +73,6 @@
 			dstPath = "";
 			dstSubfolderSpec = 10;
 			files = (
-				FA77A36518F1172600D23AE9 /* jpeg-turbo.framework in Copy Frameworks */,
 				FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */,
 				FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */,
 				FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */,
@@ -122,7 +120,6 @@
 		FA5D24971A96CE1E00C6FC8F /* love-ios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "love-ios.plist"; path = "ios/love-ios.plist"; sourceTree = "<group>"; };
 		FA5D249A1A96CF4300C6FC8F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ios/Images.xcassets; sourceTree = "<group>"; };
 		FA5D24C11A96D78000C6FC8F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
-		FA77A36418F1172600D23AE9 /* jpeg-turbo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "jpeg-turbo.framework"; path = "/Library/Frameworks/jpeg-turbo.framework"; sourceTree = "<absolute>"; };
 		FA7C63691A9C49570000FD29 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Launch Screen.xib"; path = "ios/Launch Screen.xib"; sourceTree = "<group>"; };
 		FA9B4A0916E1579F00074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
 		FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = "<absolute>"; };
@@ -220,7 +217,6 @@
 			children = (
 				1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
 				A93E6E4810420B4A007D418B /* FreeType.framework */,
-				FA77A36418F1172600D23AE9 /* jpeg-turbo.framework */,
 				A9F16926109E7BAD00FC83D1 /* libmodplug.framework */,
 				FA08F69116C765A200F007B5 /* love.framework */,
 				A93E6E5310420B57007D418B /* Lua.framework */,

+ 0 - 1
readme.md

@@ -60,7 +60,6 @@ Dependencies
 - OpenGL 2.1+ / OpenGL ES 2+
 - OpenAL
 - Lua / LuaJIT / LLVM-lua
-- jpeg-turbo
 - FreeType
 - PhysicsFS
 - ModPlug

+ 1 - 2
src/modules/image/ImageData.cpp

@@ -28,7 +28,7 @@ namespace image
 {
 
 ImageData::ImageData()
-	: data(0)
+	: data(nullptr)
 {
 	mutex = thread::newMutex();
 }
@@ -179,7 +179,6 @@ bool ImageData::getConstant(ImageData::Format in, const char  *&out)
 StringMap<ImageData::Format, ImageData::FORMAT_MAX_ENUM>::Entry ImageData::formatEntries[] =
 {
 	{"tga", ImageData::FORMAT_TGA},
-	{"jpg", ImageData::FORMAT_JPG},
 	{"png", ImageData::FORMAT_PNG},
 };
 

+ 0 - 1
src/modules/image/ImageData.h

@@ -50,7 +50,6 @@ public:
 	enum Format
 	{
 		FORMAT_TGA,
-		FORMAT_JPG,
 		FORMAT_PNG,
 		FORMAT_MAX_ENUM
 	};

+ 0 - 6
src/modules/image/magpie/Image.cpp

@@ -23,7 +23,6 @@
 #include "ImageData.h"
 #include "CompressedImageData.h"
 
-#include "JPEGHandler.h"
 #include "PNGHandler.h"
 #include "STBHandler.h"
 #include "ImageIOHandler.h"
@@ -43,11 +42,6 @@ namespace magpie
 Image::Image()
 {
 	formatHandlers.push_back(new PNGHandler);
-
-#ifndef LOVE_NO_TURBOJPEG
-	formatHandlers.push_back(new JPEGHandler);
-#endif
-
 	formatHandlers.push_back(new STBHandler);
 
 #ifdef LOVE_SUPPORT_IMAGEIO

+ 0 - 2
src/modules/image/magpie/ImageIOHandler.cpp

@@ -55,8 +55,6 @@ static CFStringRef getFormatType(ImageData::Format format)
 {
 	switch (format)
 	{
-	case ImageData::FORMAT_JPG:
-		return kUTTypeJPEG;
 	case ImageData::FORMAT_TGA:
 		return CFSTR("com.truevision.tga-image");
 	case ImageData::FORMAT_PNG:

+ 0 - 168
src/modules/image/magpie/JPEGHandler.cpp

@@ -1,168 +0,0 @@
-/**
- * Copyright (c) 2006-2015 LOVE Development Team
- *
- * This software is provided 'as-is', without any express or implied
- * warranty.  In no event will the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- *
- * 1. The origin of this software must not be misrepresented; you must not
- *    claim that you wrote the original software. If you use this software
- *    in a product, an acknowledgment in the product documentation would be
- *    appreciated but is not required.
- * 2. Altered source versions must be plainly marked as such, and must not be
- *    misrepresented as being the original software.
- * 3. This notice may not be removed or altered from any source distribution.
- **/
-
-#include "JPEGHandler.h"
-
-#ifndef LOVE_NO_TURBOJPEG
-
-// LOVE
-#include "common/Exception.h"
-#include "common/math.h"
-
-namespace love
-{
-namespace image
-{
-namespace magpie
-{
-
-JPEGHandler::JPEGHandler()
-{
-	mutex = love::thread::newMutex();
-
-	decompressor = tjInitDecompress();
-	compressor = tjInitCompress();
-}
-
-JPEGHandler::~JPEGHandler()
-{
-	delete mutex;
-
-	if (decompressor)
-		tjDestroy(decompressor);
-
-	if (compressor)
-		tjDestroy(compressor);
-}
-
-bool JPEGHandler::canDecode(love::filesystem::FileData *data)
-{
-	if (!decompressor)
-		return false;
-
-	love::thread::Lock lock(mutex);
-
-	int w, h, subsamp;
-	int status = tjDecompressHeader2(decompressor,
-	                                 (unsigned char *) data->getData(),
-	                                 data->getSize(),
-	                                 &w, &h, &subsamp);
-
-	return (status == 0);
-}
-
-bool JPEGHandler::canEncode(ImageData::Format format)
-{
-	if (!compressor)
-		return false;
-
-	return format == ImageData::FORMAT_JPG;
-}
-
-FormatHandler::DecodedImage JPEGHandler::decode(love::filesystem::FileData *data)
-{
-	if (!decompressor)
-		throw love::Exception("Could not decode jpeg image: %s", tjGetErrorStr());
-
-	DecodedImage img;
-	unsigned char *jpegdata = (unsigned char *) data->getData();
-
-	love::thread::Lock lock(mutex);
-
-	int unused;
-	int status = tjDecompressHeader2(decompressor,
-	                                 jpegdata, data->getSize(),
-	                                 &img.width, &img.height,
-	                                 &unused);
-
-	if (status < 0)
-		throw love::Exception("Could not decode jpeg image: %s", tjGetErrorStr());
-
-	img.size = img.width * img.height * sizeof(pixel);
-
-	try
-	{
-		img.data = new unsigned char[img.size];
-	}
-	catch (std::bad_alloc &)
-	{
-		throw love::Exception("Out of memory.");
-	}
-
-	status = tjDecompress2(decompressor,
-	                       jpegdata, data->getSize(),
-	                       img.data, 0, 0, 0, TJPF_RGBA, 0);
-
-	if (status < 0)
-	{
-		delete[] img.data;
-		throw love::Exception("Could not decode jpeg image: %s", tjGetErrorStr());
-	}
-
-	return img;
-}
-
-FormatHandler::EncodedImage JPEGHandler::encode(const DecodedImage &img, ImageData::Format format)
-{
-	if (!canEncode(format))
-		throw love::Exception("JPEG encoder cannot encode specified format.");
-
-	EncodedImage encodedimage;
-
-	love::thread::Lock lock(mutex);
-
-	unsigned long tjsize = tjBufSize(img.width, img.height, TJSAMP_444);
-
-	try
-	{
-		// We want to allocate the memory ourselves instead of letting
-		// TurboJPEG do it, so we can safely use delete[] in ImageData.cpp.
-		encodedimage.data = new unsigned char[tjsize];
-	}
-	catch (std::bad_alloc &)
-	{
-		throw love::Exception("Out of memory.");
-	}
-
-	unsigned long jpegSize = tjsize;
-
-	int status = tjCompress2(compressor,
-	                         img.data,
-	                         img.width, 0, img.height,
-	                         TJPF_RGBA,
-	                         &encodedimage.data, &jpegSize,
-	                         TJSAMP_444, COMPRESS_QUALITY, TJFLAG_NOREALLOC);
-
-	if (status < 0)
-	{
-		delete[] encodedimage.data;
-		throw love::Exception("Could not encode jpeg image: %s", tjGetErrorStr());
-	}
-
-	encodedimage.size = jpegSize;
-
-	return encodedimage;
-}
-
-} // magpie
-} // image
-} // love
-
-#endif // LOVE_NO_TURBOJPEG

+ 0 - 81
src/modules/image/magpie/JPEGHandler.h

@@ -1,81 +0,0 @@
-/**
- * Copyright (c) 2006-2015 LOVE Development Team
- *
- * This software is provided 'as-is', without any express or implied
- * warranty.  In no event will the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- *
- * 1. The origin of this software must not be misrepresented; you must not
- *    claim that you wrote the original software. If you use this software
- *    in a product, an acknowledgment in the product documentation would be
- *    appreciated but is not required.
- * 2. Altered source versions must be plainly marked as such, and must not be
- *    misrepresented as being the original software.
- * 3. This notice may not be removed or altered from any source distribution.
- **/
-
-#ifndef LOVE_IMAGE_MAGPIE_JPEG_HANDLER_H
-#define LOVE_IMAGE_MAGPIE_JPEG_HANDLER_H
-
-#include "common/config.h"
-
-#ifndef LOVE_NO_TURBOJPEG
-
-// LOVE
-#include "FormatHandler.h"
-#include "thread/threads.h"
-
-// libjpeg-turbo
-#ifdef LOVE_APPLE_USE_FRAMEWORKS
-#include <jpeg-turbo/turbojpeg.h>
-#else
-#include <turbojpeg.h>
-#endif
-
-namespace love
-{
-namespace image
-{
-namespace magpie
-{
-
-/**
- * Interface between ImageData and TurboJPEG.
- **/
-class JPEGHandler : public FormatHandler
-{
-public:
-
-	// Implements FormatHandler.
-
-	JPEGHandler();
-	virtual ~JPEGHandler();
-
-	virtual bool canDecode(love::filesystem::FileData *data);
-	virtual bool canEncode(ImageData::Format format);
-
-	virtual DecodedImage decode(love::filesystem::FileData *data);
-	virtual EncodedImage encode(const DecodedImage &img, ImageData::Format format);
-
-private:
-
-	Mutex *mutex;
-
-	tjhandle decompressor;
-	tjhandle compressor;
-
-	static const int COMPRESS_QUALITY = 90;
-
-}; // JPEGHandler
-
-} // magpie
-} // image
-} // love
-
-#endif // LOVE_NO_TURBOJPEG
-
-#endif // LOVE_IMAGE_MAGPIE_JPEG_HANDLER_H

+ 4 - 4
src/modules/image/magpie/STBHandler.cpp

@@ -21,20 +21,20 @@
 // LOVE
 #include "STBHandler.h"
 
-static void loveSTBAssert(bool test, const char *teststr)
+static void loveSTBIAssert(bool test, const char *teststr)
 {
 	if (!test)
 		throw love::Exception("Could not decode image (stb_image assertion '%s' failed)", teststr);
 }
 
 // stb_image
-// #define STBI_ONLY_JPEG
+ #define STBI_ONLY_JPEG
 // #define STBI_ONLY_PNG
 #define STBI_ONLY_BMP
 #define STBI_ONLY_TGA
 #define STBI_NO_STDIO
 #define STB_IMAGE_IMPLEMENTATION
-#define STBI_ASSERT(A) loveSTBAssert((A), #A)
+#define STBI_ASSERT(A) loveSTBIAssert((A), #A)
 #include "libraries/stb/stb_image.h"
 
 // C
@@ -75,7 +75,7 @@ FormatHandler::DecodedImage STBHandler::decode(love::filesystem::FileData *data)
 	                                 &comp, 4);
 
 	if (img.data == nullptr || img.width <= 0 || img.height <= 0)
-		throw love::Exception("Could not decode TGA or BMP image.");
+		throw love::Exception("Could not decode image with stb_image.");
 
 	img.size = img.width * img.height * 4;