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
+5 -7
View File
@@ -575,8 +575,13 @@ source_group("modules\\graphics\\opengl" FILES ${LOVE_SRC_MODULE_GRAPHICS_OPENGL
# #
set(LOVE_SRC_MODULE_IMAGE_ROOT set(LOVE_SRC_MODULE_IMAGE_ROOT
src/modules/image/CompressedFormatHandler.h
src/modules/image/CompressedImageData.cpp src/modules/image/CompressedImageData.cpp
src/modules/image/CompressedImageData.h src/modules/image/CompressedImageData.h
src/modules/image/CompressedSlice.cpp
src/modules/image/CompressedSlice.h
src/modules/image/FormatHandler.cpp
src/modules/image/FormatHandler.h
src/modules/image/Image.cpp src/modules/image/Image.cpp
src/modules/image/Image.h src/modules/image/Image.h
src/modules/image/ImageData.cpp src/modules/image/ImageData.cpp
@@ -594,17 +599,10 @@ set(LOVE_SRC_MODULE_IMAGE_ROOT
set(LOVE_SRC_MODULE_IMAGE_MAGPIE set(LOVE_SRC_MODULE_IMAGE_MAGPIE
src/modules/image/magpie/ASTCHandler.cpp src/modules/image/magpie/ASTCHandler.cpp
src/modules/image/magpie/ASTCHandler.h src/modules/image/magpie/ASTCHandler.h
src/modules/image/magpie/CompressedImageData.cpp
src/modules/image/magpie/CompressedImageData.h
src/modules/image/magpie/CompressedFormatHandler.h
src/modules/image/magpie/ddsHandler.cpp src/modules/image/magpie/ddsHandler.cpp
src/modules/image/magpie/ddsHandler.h src/modules/image/magpie/ddsHandler.h
src/modules/image/magpie/EXRHandler.cpp src/modules/image/magpie/EXRHandler.cpp
src/modules/image/magpie/EXRHandler.h src/modules/image/magpie/EXRHandler.h
src/modules/image/magpie/FormatHandler.cpp
src/modules/image/magpie/FormatHandler.h
src/modules/image/magpie/Image.cpp
src/modules/image/magpie/Image.h
src/modules/image/magpie/ImageData.cpp src/modules/image/magpie/ImageData.cpp
src/modules/image/magpie/ImageData.h src/modules/image/magpie/ImageData.h
src/modules/image/magpie/KTXHandler.cpp src/modules/image/magpie/KTXHandler.cpp
@@ -469,22 +469,9 @@
FA0B7D861A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC61A95902C000E1D17 /* ImageData.cpp */; }; FA0B7D861A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC61A95902C000E1D17 /* ImageData.cpp */; };
FA0B7D871A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC61A95902C000E1D17 /* ImageData.cpp */; }; FA0B7D871A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC61A95902C000E1D17 /* ImageData.cpp */; };
FA0B7D881A95902C000E1D17 /* ImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BC71A95902C000E1D17 /* ImageData.h */; }; FA0B7D881A95902C000E1D17 /* ImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BC71A95902C000E1D17 /* ImageData.h */; };
FA0B7D891A95902C000E1D17 /* CompressedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC91A95902C000E1D17 /* CompressedImageData.cpp */; };
FA0B7D8A1A95902C000E1D17 /* CompressedImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BC91A95902C000E1D17 /* CompressedImageData.cpp */; };
FA0B7D8B1A95902C000E1D17 /* CompressedImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BCA1A95902C000E1D17 /* CompressedImageData.h */; };
FA0B7D8C1A95902C000E1D17 /* CompressedFormatHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BCB1A95902C000E1D17 /* CompressedFormatHandler.h */; };
FA0B7D8D1A95902C000E1D17 /* ddsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */; }; FA0B7D8D1A95902C000E1D17 /* ddsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */; };
FA0B7D8E1A95902C000E1D17 /* ddsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */; }; FA0B7D8E1A95902C000E1D17 /* ddsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */; };
FA0B7D8F1A95902C000E1D17 /* ddsHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */; }; FA0B7D8F1A95902C000E1D17 /* ddsHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */; };
FA0B7D901A95902C000E1D17 /* FormatHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCE1A95902C000E1D17 /* FormatHandler.cpp */; };
FA0B7D911A95902C000E1D17 /* FormatHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BCE1A95902C000E1D17 /* FormatHandler.cpp */; };
FA0B7D921A95902C000E1D17 /* FormatHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BCF1A95902C000E1D17 /* FormatHandler.h */; };
FA0B7D931A95902C000E1D17 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD01A95902C000E1D17 /* Image.cpp */; };
FA0B7D941A95902C000E1D17 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD01A95902C000E1D17 /* Image.cpp */; };
FA0B7D951A95902C000E1D17 /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BD11A95902C000E1D17 /* Image.h */; };
FA0B7D961A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD21A95902C000E1D17 /* ImageData.cpp */; };
FA0B7D971A95902C000E1D17 /* ImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD21A95902C000E1D17 /* ImageData.cpp */; };
FA0B7D981A95902C000E1D17 /* ImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BD31A95902C000E1D17 /* ImageData.h */; };
FA0B7D9F1A95902C000E1D17 /* KTXHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */; }; FA0B7D9F1A95902C000E1D17 /* KTXHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */; };
FA0B7DA01A95902C000E1D17 /* 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 */; }; FA0B7DA11A95902C000E1D17 /* KTXHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B7BD91A95902C000E1D17 /* KTXHandler.h */; };
@@ -948,6 +935,9 @@
FA91591E1CF1ED7500A7053F /* halffloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91591C1CF1ED7500A7053F /* halffloat.cpp */; }; FA91591E1CF1ED7500A7053F /* halffloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91591C1CF1ED7500A7053F /* halffloat.cpp */; };
FA91591F1CF1ED7500A7053F /* halffloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91591C1CF1ED7500A7053F /* halffloat.cpp */; }; FA91591F1CF1ED7500A7053F /* halffloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA91591C1CF1ED7500A7053F /* halffloat.cpp */; };
FA9159201CF1ED7500A7053F /* halffloat.h in Headers */ = {isa = PBXBuildFile; fileRef = FA91591D1CF1ED7500A7053F /* halffloat.h */; }; FA9159201CF1ED7500A7053F /* halffloat.h in Headers */ = {isa = PBXBuildFile; fileRef = FA91591D1CF1ED7500A7053F /* halffloat.h */; };
FA93C4521F315B960087CCD4 /* CompressedFormatHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA93C44F1F315B960087CCD4 /* CompressedFormatHandler.h */; };
FA93C4531F315B960087CCD4 /* FormatHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA93C4501F315B960087CCD4 /* FormatHandler.h */; };
FA93C4541F315B960087CCD4 /* FormatHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA93C4511F315B960087CCD4 /* FormatHandler.cpp */; };
FA9B4A0816E1578300074F42 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0716E1578300074F42 /* SDL2.framework */; }; FA9B4A0816E1578300074F42 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0716E1578300074F42 /* SDL2.framework */; };
FA9D8DD11DEB56C3002CD881 /* pixelformat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */; }; FA9D8DD11DEB56C3002CD881 /* pixelformat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */; };
FA9D8DD21DEB56C3002CD881 /* pixelformat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */; }; FA9D8DD21DEB56C3002CD881 /* pixelformat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */; };
@@ -1036,6 +1026,10 @@
FADF543D1E3DAFF700012CC0 /* wrap_Graphics.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */; }; FADF543D1E3DAFF700012CC0 /* wrap_Graphics.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */; };
FAE272521C05A15B00A67640 /* ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE272501C05A15B00A67640 /* ParticleSystem.cpp */; }; FAE272521C05A15B00A67640 /* ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE272501C05A15B00A67640 /* ParticleSystem.cpp */; };
FAE272531C05A15B00A67640 /* ParticleSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE272511C05A15B00A67640 /* ParticleSystem.h */; }; FAE272531C05A15B00A67640 /* ParticleSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE272511C05A15B00A67640 /* ParticleSystem.h */; };
FAECA1B21F3164700095D008 /* CompressedSlice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAECA1B01F3164700095D008 /* CompressedSlice.cpp */; };
FAECA1B31F3164700095D008 /* CompressedSlice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAECA1B01F3164700095D008 /* CompressedSlice.cpp */; };
FAECA1B41F3164700095D008 /* CompressedSlice.h in Headers */ = {isa = PBXBuildFile; fileRef = FAECA1B11F3164700095D008 /* CompressedSlice.h */; };
FAECA1B51F31648A0095D008 /* FormatHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA93C4511F315B960087CCD4 /* FormatHandler.cpp */; };
FAF140531E20934C00F898D2 /* CodeGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC21E20934C00F898D2 /* CodeGen.cpp */; }; FAF140531E20934C00F898D2 /* CodeGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC21E20934C00F898D2 /* CodeGen.cpp */; };
FAF140541E20934C00F898D2 /* CodeGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC21E20934C00F898D2 /* CodeGen.cpp */; }; FAF140541E20934C00F898D2 /* CodeGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC21E20934C00F898D2 /* CodeGen.cpp */; };
FAF140551E20934C00F898D2 /* Link.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC31E20934C00F898D2 /* Link.cpp */; }; FAF140551E20934C00F898D2 /* Link.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAF13FC31E20934C00F898D2 /* Link.cpp */; };
@@ -1482,17 +1476,8 @@
FA0B7BC51A95902C000E1D17 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; }; FA0B7BC51A95902C000E1D17 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; };
FA0B7BC61A95902C000E1D17 /* ImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageData.cpp; sourceTree = "<group>"; }; FA0B7BC61A95902C000E1D17 /* ImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageData.cpp; sourceTree = "<group>"; };
FA0B7BC71A95902C000E1D17 /* ImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageData.h; sourceTree = "<group>"; }; FA0B7BC71A95902C000E1D17 /* ImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageData.h; sourceTree = "<group>"; };
FA0B7BC91A95902C000E1D17 /* CompressedImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompressedImageData.cpp; sourceTree = "<group>"; };
FA0B7BCA1A95902C000E1D17 /* CompressedImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressedImageData.h; sourceTree = "<group>"; };
FA0B7BCB1A95902C000E1D17 /* CompressedFormatHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressedFormatHandler.h; sourceTree = "<group>"; };
FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ddsHandler.cpp; sourceTree = "<group>"; }; FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ddsHandler.cpp; sourceTree = "<group>"; };
FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ddsHandler.h; sourceTree = "<group>"; }; FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ddsHandler.h; sourceTree = "<group>"; };
FA0B7BCE1A95902C000E1D17 /* FormatHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatHandler.cpp; sourceTree = "<group>"; };
FA0B7BCF1A95902C000E1D17 /* FormatHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatHandler.h; sourceTree = "<group>"; };
FA0B7BD01A95902C000E1D17 /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Image.cpp; sourceTree = "<group>"; };
FA0B7BD11A95902C000E1D17 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; };
FA0B7BD21A95902C000E1D17 /* ImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageData.cpp; sourceTree = "<group>"; };
FA0B7BD31A95902C000E1D17 /* ImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageData.h; sourceTree = "<group>"; };
FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KTXHandler.cpp; 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>"; }; 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>"; }; FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PKMHandler.cpp; sourceTree = "<group>"; };
@@ -1808,6 +1793,9 @@
FA8951A11AA2EDF300EC385A /* wrap_Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Event.h; sourceTree = "<group>"; }; FA8951A11AA2EDF300EC385A /* wrap_Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Event.h; sourceTree = "<group>"; };
FA91591C1CF1ED7500A7053F /* halffloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = halffloat.cpp; sourceTree = "<group>"; }; FA91591C1CF1ED7500A7053F /* halffloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = halffloat.cpp; sourceTree = "<group>"; };
FA91591D1CF1ED7500A7053F /* halffloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = halffloat.h; sourceTree = "<group>"; }; FA91591D1CF1ED7500A7053F /* halffloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = halffloat.h; sourceTree = "<group>"; };
FA93C44F1F315B960087CCD4 /* CompressedFormatHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressedFormatHandler.h; sourceTree = "<group>"; };
FA93C4501F315B960087CCD4 /* FormatHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatHandler.h; sourceTree = "<group>"; };
FA93C4511F315B960087CCD4 /* FormatHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatHandler.cpp; sourceTree = "<group>"; };
FA9B4A0716E1578300074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; }; FA9B4A0716E1578300074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pixelformat.cpp; sourceTree = "<group>"; }; FA9D8DCF1DEB56C3002CD881 /* pixelformat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pixelformat.cpp; sourceTree = "<group>"; };
FA9D8DD01DEB56C3002CD881 /* pixelformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixelformat.h; sourceTree = "<group>"; }; FA9D8DD01DEB56C3002CD881 /* pixelformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixelformat.h; sourceTree = "<group>"; };
@@ -1870,6 +1858,8 @@
FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Graphics.h; sourceTree = "<group>"; }; FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Graphics.h; sourceTree = "<group>"; };
FAE272501C05A15B00A67640 /* ParticleSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParticleSystem.cpp; sourceTree = "<group>"; }; FAE272501C05A15B00A67640 /* ParticleSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParticleSystem.cpp; sourceTree = "<group>"; };
FAE272511C05A15B00A67640 /* ParticleSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParticleSystem.h; sourceTree = "<group>"; }; FAE272511C05A15B00A67640 /* ParticleSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParticleSystem.h; sourceTree = "<group>"; };
FAECA1B01F3164700095D008 /* CompressedSlice.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CompressedSlice.cpp; sourceTree = "<group>"; };
FAECA1B11F3164700095D008 /* CompressedSlice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CompressedSlice.h; sourceTree = "<group>"; };
FAF13FC21E20934C00F898D2 /* CodeGen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGen.cpp; sourceTree = "<group>"; }; FAF13FC21E20934C00F898D2 /* CodeGen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGen.cpp; sourceTree = "<group>"; };
FAF13FC31E20934C00F898D2 /* Link.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Link.cpp; sourceTree = "<group>"; }; FAF13FC31E20934C00F898D2 /* Link.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Link.cpp; sourceTree = "<group>"; };
FAF13FC51E20934C00F898D2 /* arrays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arrays.h; sourceTree = "<group>"; }; FAF13FC51E20934C00F898D2 /* arrays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arrays.h; sourceTree = "<group>"; };
@@ -2760,8 +2750,13 @@
FA0B7BC21A95902C000E1D17 /* image */ = { FA0B7BC21A95902C000E1D17 /* image */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FA93C44F1F315B960087CCD4 /* CompressedFormatHandler.h */,
FA0B7BC31A95902C000E1D17 /* CompressedImageData.cpp */, FA0B7BC31A95902C000E1D17 /* CompressedImageData.cpp */,
FA0B7BC41A95902C000E1D17 /* CompressedImageData.h */, FA0B7BC41A95902C000E1D17 /* CompressedImageData.h */,
FAECA1B01F3164700095D008 /* CompressedSlice.cpp */,
FAECA1B11F3164700095D008 /* CompressedSlice.h */,
FA93C4511F315B960087CCD4 /* FormatHandler.cpp */,
FA93C4501F315B960087CCD4 /* FormatHandler.h */,
FA9D8DDF1DEF843D002CD881 /* Image.cpp */, FA9D8DDF1DEF843D002CD881 /* Image.cpp */,
FA0B7BC51A95902C000E1D17 /* Image.h */, FA0B7BC51A95902C000E1D17 /* Image.h */,
FA0B7BC61A95902C000E1D17 /* ImageData.cpp */, FA0B7BC61A95902C000E1D17 /* ImageData.cpp */,
@@ -2785,19 +2780,10 @@
children = ( children = (
FA41A3C61C0A1F950084430C /* ASTCHandler.cpp */, FA41A3C61C0A1F950084430C /* ASTCHandler.cpp */,
FA41A3C71C0A1F950084430C /* ASTCHandler.h */, FA41A3C71C0A1F950084430C /* ASTCHandler.h */,
FA0B7BCB1A95902C000E1D17 /* CompressedFormatHandler.h */,
FA0B7BC91A95902C000E1D17 /* CompressedImageData.cpp */,
FA0B7BCA1A95902C000E1D17 /* CompressedImageData.h */,
FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */, FA0B7BCC1A95902C000E1D17 /* ddsHandler.cpp */,
FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */, FA0B7BCD1A95902C000E1D17 /* ddsHandler.h */,
FA1557C11CE90BD200AFF582 /* EXRHandler.cpp */, FA1557C11CE90BD200AFF582 /* EXRHandler.cpp */,
FA1557C21CE90BD200AFF582 /* EXRHandler.h */, FA1557C21CE90BD200AFF582 /* EXRHandler.h */,
FA0B7BCE1A95902C000E1D17 /* FormatHandler.cpp */,
FA0B7BCF1A95902C000E1D17 /* FormatHandler.h */,
FA0B7BD01A95902C000E1D17 /* Image.cpp */,
FA0B7BD11A95902C000E1D17 /* Image.h */,
FA0B7BD21A95902C000E1D17 /* ImageData.cpp */,
FA0B7BD31A95902C000E1D17 /* ImageData.h */,
FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */, FA0B7BD81A95902C000E1D17 /* KTXHandler.cpp */,
FA0B7BD91A95902C000E1D17 /* KTXHandler.h */, FA0B7BD91A95902C000E1D17 /* KTXHandler.h */,
FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */, FA0B7BDA1A95902C000E1D17 /* PKMHandler.cpp */,
@@ -3550,7 +3536,6 @@
FA76344C1E28722A0066EF9E /* StreamBuffer.h in Headers */, FA76344C1E28722A0066EF9E /* StreamBuffer.h in Headers */,
217DFBF31D9F6D490055D849 /* mime.h in Headers */, 217DFBF31D9F6D490055D849 /* mime.h in Headers */,
FA0B7B361A958EA3000E1D17 /* wuff_convert.h in Headers */, FA0B7B361A958EA3000E1D17 /* wuff_convert.h in Headers */,
FA0B7D981A95902C000E1D17 /* ImageData.h in Headers */,
FA0B7CDE1A95902C000E1D17 /* Source.h in Headers */, FA0B7CDE1A95902C000E1D17 /* Source.h in Headers */,
FA0B7E141A95902C000E1D17 /* GearJoint.h in Headers */, FA0B7E141A95902C000E1D17 /* GearJoint.h in Headers */,
FA0B7D051A95902C000E1D17 /* wrap_DroppedFile.h in Headers */, FA0B7D051A95902C000E1D17 /* wrap_DroppedFile.h in Headers */,
@@ -3612,6 +3597,7 @@
FA0B7CD21A95902C000E1D17 /* Audio.h in Headers */, FA0B7CD21A95902C000E1D17 /* Audio.h in Headers */,
FA0B79421A958E3B000E1D17 /* utf8.h in Headers */, FA0B79421A958E3B000E1D17 /* utf8.h in Headers */,
FA0B7D171A95902C000E1D17 /* Font.h in Headers */, FA0B7D171A95902C000E1D17 /* Font.h in Headers */,
FAECA1B41F3164700095D008 /* CompressedSlice.h in Headers */,
FA0B7A6D1A958EA3000E1D17 /* b2World.h in Headers */, FA0B7A6D1A958EA3000E1D17 /* b2World.h in Headers */,
FA0B7EAE1A95902C000E1D17 /* wrap_SoundData.h in Headers */, FA0B7EAE1A95902C000E1D17 /* wrap_SoundData.h in Headers */,
FA0B7CFF1A95902C000E1D17 /* File.h in Headers */, FA0B7CFF1A95902C000E1D17 /* File.h in Headers */,
@@ -3661,6 +3647,7 @@
FA0B7E351A95902C000E1D17 /* WeldJoint.h in Headers */, FA0B7E351A95902C000E1D17 /* WeldJoint.h in Headers */,
FA0B7E2F1A95902C000E1D17 /* RopeJoint.h in Headers */, FA0B7E2F1A95902C000E1D17 /* RopeJoint.h in Headers */,
FA0B7D141A95902C000E1D17 /* Font.h in Headers */, FA0B7D141A95902C000E1D17 /* Font.h in Headers */,
FA93C4521F315B960087CCD4 /* CompressedFormatHandler.h in Headers */,
FA0B7D411A95902C000E1D17 /* Mesh.h in Headers */, FA0B7D411A95902C000E1D17 /* Mesh.h in Headers */,
FA0B7E591A95902C000E1D17 /* wrap_Joint.h in Headers */, FA0B7E591A95902C000E1D17 /* wrap_Joint.h in Headers */,
FA0B79351A958E3B000E1D17 /* macosx.h in Headers */, FA0B79351A958E3B000E1D17 /* macosx.h in Headers */,
@@ -3720,6 +3707,7 @@
FA0B7ECD1A95902C000E1D17 /* wrap_Channel.h in Headers */, FA0B7ECD1A95902C000E1D17 /* wrap_Channel.h in Headers */,
FAF140AF1E20934C00F898D2 /* osinclude.h in Headers */, FAF140AF1E20934C00F898D2 /* osinclude.h in Headers */,
FA0B7A431A958EA3000E1D17 /* b2CircleShape.h in Headers */, FA0B7A431A958EA3000E1D17 /* b2CircleShape.h in Headers */,
FA93C4531F315B960087CCD4 /* FormatHandler.h in Headers */,
FA0B7CD81A95902C000E1D17 /* Audio.h in Headers */, FA0B7CD81A95902C000E1D17 /* Audio.h in Headers */,
FA0B7CF61A95902C000E1D17 /* File.h in Headers */, FA0B7CF61A95902C000E1D17 /* File.h in Headers */,
FA0B7E961A95902C000E1D17 /* Mpg123Decoder.h in Headers */, FA0B7E961A95902C000E1D17 /* Mpg123Decoder.h in Headers */,
@@ -3728,7 +3716,6 @@
FA0B7DD51A95902C000E1D17 /* BezierCurve.h in Headers */, FA0B7DD51A95902C000E1D17 /* BezierCurve.h in Headers */,
FA0B79271A958E3B000E1D17 /* int.h in Headers */, FA0B79271A958E3B000E1D17 /* int.h in Headers */,
FA27B3A21B498151008A9DCE /* VideoStream.h in Headers */, FA27B3A21B498151008A9DCE /* VideoStream.h in Headers */,
FA0B7D8C1A95902C000E1D17 /* CompressedFormatHandler.h in Headers */,
FA0B7E531A95902C000E1D17 /* wrap_FrictionJoint.h in Headers */, FA0B7E531A95902C000E1D17 /* wrap_FrictionJoint.h in Headers */,
FA0B7EB71A95902C000E1D17 /* wrap_System.h in Headers */, FA0B7EB71A95902C000E1D17 /* wrap_System.h in Headers */,
FA27B3A91B498151008A9DCE /* Video.h in Headers */, FA27B3A91B498151008A9DCE /* Video.h in Headers */,
@@ -3738,7 +3725,6 @@
FAB17BF21ABFB37500F9BA27 /* wrap_CompressedData.h in Headers */, FAB17BF21ABFB37500F9BA27 /* wrap_CompressedData.h in Headers */,
FA0B7E801A95902C000E1D17 /* Joint.h in Headers */, FA0B7E801A95902C000E1D17 /* Joint.h in Headers */,
FA0B7D2F1A95902C000E1D17 /* Drawable.h in Headers */, FA0B7D2F1A95902C000E1D17 /* Drawable.h in Headers */,
FA0B7D951A95902C000E1D17 /* Image.h in Headers */,
217DFBE21D9F6D490055D849 /* ftp.lua.h in Headers */, 217DFBE21D9F6D490055D849 /* ftp.lua.h in Headers */,
FA0B7EC41A95902C000E1D17 /* Thread.h in Headers */, FA0B7EC41A95902C000E1D17 /* Thread.h in Headers */,
FA0B7DFF1A95902C000E1D17 /* ChainShape.h in Headers */, FA0B7DFF1A95902C000E1D17 /* ChainShape.h in Headers */,
@@ -3794,7 +3780,6 @@
FA0B7CF91A95902C000E1D17 /* FileData.h in Headers */, FA0B7CF91A95902C000E1D17 /* FileData.h in Headers */,
FA0B7DA71A95902C000E1D17 /* PNGHandler.h in Headers */, FA0B7DA71A95902C000E1D17 /* PNGHandler.h in Headers */,
FA0B7AC41A958EA3000E1D17 /* protocol.h in Headers */, FA0B7AC41A958EA3000E1D17 /* protocol.h in Headers */,
FA0B7D8B1A95902C000E1D17 /* CompressedImageData.h in Headers */,
FAF140601E20934C00F898D2 /* revision.h in Headers */, FAF140601E20934C00F898D2 /* revision.h in Headers */,
FAF140A21E20934C00F898D2 /* RemoveTree.h in Headers */, FAF140A21E20934C00F898D2 /* RemoveTree.h in Headers */,
FA0B7A8E1A958EA3000E1D17 /* b2DistanceJoint.h in Headers */, FA0B7A8E1A958EA3000E1D17 /* b2DistanceJoint.h in Headers */,
@@ -3895,7 +3880,6 @@
FADF54041E3D77B500012CC0 /* wrap_Text.h in Headers */, FADF54041E3D77B500012CC0 /* wrap_Text.h in Headers */,
FA0B7ED31A95902C000E1D17 /* wrap_ThreadModule.h in Headers */, FA0B7ED31A95902C000E1D17 /* wrap_ThreadModule.h in Headers */,
FA0B7A511A958EA3000E1D17 /* b2GrowableStack.h in Headers */, FA0B7A511A958EA3000E1D17 /* b2GrowableStack.h in Headers */,
FA0B7D921A95902C000E1D17 /* FormatHandler.h in Headers */,
FAC756F61E4F99B400B91289 /* Effect.h in Headers */, FAC756F61E4F99B400B91289 /* Effect.h in Headers */,
FA0B7ADD1A958EA3000E1D17 /* gladfuncs.hpp in Headers */, FA0B7ADD1A958EA3000E1D17 /* gladfuncs.hpp in Headers */,
FAF1405D1E20934C00F898D2 /* intermediate.h in Headers */, FAF1405D1E20934C00F898D2 /* intermediate.h in Headers */,
@@ -4051,7 +4035,6 @@
FA0B7ABE1A958EA3000E1D17 /* compress.c in Sources */, FA0B7ABE1A958EA3000E1D17 /* compress.c in Sources */,
FA0B7CF21A95902C000E1D17 /* DroppedFile.cpp in Sources */, FA0B7CF21A95902C000E1D17 /* DroppedFile.cpp in Sources */,
FA4F2C141DE936FE00CA37D7 /* usocket.c in Sources */, FA4F2C141DE936FE00CA37D7 /* usocket.c in Sources */,
FA0B7D8A1A95902C000E1D17 /* CompressedImageData.cpp in Sources */,
FAF140831E20934C00F898D2 /* ParseContextBase.cpp in Sources */, FAF140831E20934C00F898D2 /* ParseContextBase.cpp in Sources */,
FA0B7AD21A958EA3000E1D17 /* protocol.c in Sources */, FA0B7AD21A958EA3000E1D17 /* protocol.c in Sources */,
FAF140A41E20934C00F898D2 /* Scan.cpp in Sources */, FAF140A41E20934C00F898D2 /* Scan.cpp in Sources */,
@@ -4190,15 +4173,14 @@
FADF54211E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */, FADF54211E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */,
FA0B791C1A958E3B000E1D17 /* b64.cpp in Sources */, FA0B791C1A958E3B000E1D17 /* b64.cpp in Sources */,
FA1E88851DF363E100E808AA /* Filter.cpp in Sources */, FA1E88851DF363E100E808AA /* Filter.cpp in Sources */,
FA0B7D941A95902C000E1D17 /* Image.cpp in Sources */,
FA0B7DA01A95902C000E1D17 /* KTXHandler.cpp in Sources */, FA0B7DA01A95902C000E1D17 /* KTXHandler.cpp in Sources */,
FA27B3A11B498151008A9DCE /* VideoStream.cpp in Sources */, FA27B3A11B498151008A9DCE /* VideoStream.cpp in Sources */,
FA0B7A5C1A958EA3000E1D17 /* b2Timer.cpp in Sources */, FA0B7A5C1A958EA3000E1D17 /* b2Timer.cpp in Sources */,
FA0B7CEC1A95902C000E1D17 /* Event.cpp in Sources */, FA0B7CEC1A95902C000E1D17 /* Event.cpp in Sources */,
FA27B3AB1B498151008A9DCE /* VideoStream.cpp in Sources */, FA27B3AB1B498151008A9DCE /* VideoStream.cpp in Sources */,
FA0B7A7E1A958EA3000E1D17 /* b2ContactSolver.cpp in Sources */, FA0B7A7E1A958EA3000E1D17 /* b2ContactSolver.cpp in Sources */,
FA0B7D971A95902C000E1D17 /* ImageData.cpp in Sources */,
FA0B7E581A95902C000E1D17 /* wrap_Joint.cpp in Sources */, FA0B7E581A95902C000E1D17 /* wrap_Joint.cpp in Sources */,
FAECA1B51F31648A0095D008 /* FormatHandler.cpp in Sources */,
FA4F2C0A1DE936E600CA37D7 /* mime.c in Sources */, FA4F2C0A1DE936E600CA37D7 /* mime.c in Sources */,
FA0B7E311A95902C000E1D17 /* Shape.cpp in Sources */, FA0B7E311A95902C000E1D17 /* Shape.cpp in Sources */,
FA0B7E491A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */, FA0B7E491A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */,
@@ -4287,13 +4269,13 @@
FA0B7DB21A95902C000E1D17 /* wrap_Image.cpp in Sources */, FA0B7DB21A95902C000E1D17 /* wrap_Image.cpp in Sources */,
FA0B7E891A95902C000E1D17 /* Decoder.cpp in Sources */, FA0B7E891A95902C000E1D17 /* Decoder.cpp in Sources */,
FA0B7A591A958EA3000E1D17 /* b2StackAllocator.cpp in Sources */, FA0B7A591A958EA3000E1D17 /* b2StackAllocator.cpp in Sources */,
FAECA1B31F3164700095D008 /* CompressedSlice.cpp in Sources */,
FA0B7E3D1A95902C000E1D17 /* wrap_Body.cpp in Sources */, FA0B7E3D1A95902C000E1D17 /* wrap_Body.cpp in Sources */,
FA0B7D7A1A95902C000E1D17 /* Quad.cpp in Sources */, FA0B7D7A1A95902C000E1D17 /* Quad.cpp in Sources */,
FA620A3B1AA305F6005DB4C2 /* types.cpp in Sources */, FA620A3B1AA305F6005DB4C2 /* types.cpp in Sources */,
FA0B7DD41A95902C000E1D17 /* BezierCurve.cpp in Sources */, FA0B7DD41A95902C000E1D17 /* BezierCurve.cpp in Sources */,
FA0B7E7C1A95902C000E1D17 /* wrap_World.cpp in Sources */, FA0B7E7C1A95902C000E1D17 /* wrap_World.cpp in Sources */,
FA4F2C0E1DE936FE00CA37D7 /* tcp.c in Sources */, FA4F2C0E1DE936FE00CA37D7 /* tcp.c in Sources */,
FA0B7D911A95902C000E1D17 /* FormatHandler.cpp in Sources */,
FA0B7D431A95902C000E1D17 /* OpenGL.cpp in Sources */, FA0B7D431A95902C000E1D17 /* OpenGL.cpp in Sources */,
FA0B7DBF1A95902C000E1D17 /* JoystickModule.cpp in Sources */, FA0B7DBF1A95902C000E1D17 /* JoystickModule.cpp in Sources */,
FA0B7D4F1A95902C000E1D17 /* SpriteBatch.cpp in Sources */, FA0B7D4F1A95902C000E1D17 /* SpriteBatch.cpp in Sources */,
@@ -4410,7 +4392,6 @@
FA0B7D091A95902C000E1D17 /* wrap_FileData.cpp in Sources */, FA0B7D091A95902C000E1D17 /* wrap_FileData.cpp in Sources */,
FA0B7B341A958EA3000E1D17 /* wuff_convert.c in Sources */, FA0B7B341A958EA3000E1D17 /* wuff_convert.c in Sources */,
FA0B7CF11A95902C000E1D17 /* DroppedFile.cpp in Sources */, FA0B7CF11A95902C000E1D17 /* DroppedFile.cpp in Sources */,
FA0B7D891A95902C000E1D17 /* CompressedImageData.cpp in Sources */,
FAF140821E20934C00F898D2 /* ParseContextBase.cpp in Sources */, FAF140821E20934C00F898D2 /* ParseContextBase.cpp in Sources */,
FA0B7D1E1A95902C000E1D17 /* ImageRasterizer.cpp in Sources */, FA0B7D1E1A95902C000E1D17 /* ImageRasterizer.cpp in Sources */,
FAF140A31E20934C00F898D2 /* Scan.cpp in Sources */, FAF140A31E20934C00F898D2 /* Scan.cpp in Sources */,
@@ -4545,7 +4526,6 @@
FA0B7A4E1A958EA3000E1D17 /* b2Draw.cpp in Sources */, FA0B7A4E1A958EA3000E1D17 /* b2Draw.cpp in Sources */,
FAD19A171DFF8CA200D5398A /* ImageDataBase.cpp in Sources */, FAD19A171DFF8CA200D5398A /* ImageDataBase.cpp in Sources */,
FA27B3C01B4985BF008A9DCE /* wrap_VideoStream.cpp in Sources */, FA27B3C01B4985BF008A9DCE /* wrap_VideoStream.cpp in Sources */,
FA0B7D931A95902C000E1D17 /* Image.cpp in Sources */,
FADF54201E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */, FADF54201E3DA52C00012CC0 /* wrap_ParticleSystem.cpp in Sources */,
FA0B7D9F1A95902C000E1D17 /* KTXHandler.cpp in Sources */, FA0B7D9F1A95902C000E1D17 /* KTXHandler.cpp in Sources */,
FA1E88831DF363DB00E808AA /* Filter.cpp in Sources */, FA1E88831DF363DB00E808AA /* Filter.cpp in Sources */,
@@ -4554,9 +4534,9 @@
FA0B7CEB1A95902C000E1D17 /* Event.cpp in Sources */, FA0B7CEB1A95902C000E1D17 /* Event.cpp in Sources */,
FA1557C31CE90BD200AFF582 /* EXRHandler.cpp in Sources */, FA1557C31CE90BD200AFF582 /* EXRHandler.cpp in Sources */,
FA27B3AA1B498151008A9DCE /* VideoStream.cpp in Sources */, FA27B3AA1B498151008A9DCE /* VideoStream.cpp in Sources */,
FA0B7D961A95902C000E1D17 /* ImageData.cpp in Sources */,
FA0B7E571A95902C000E1D17 /* wrap_Joint.cpp in Sources */, FA0B7E571A95902C000E1D17 /* wrap_Joint.cpp in Sources */,
FA0B7E301A95902C000E1D17 /* Shape.cpp in Sources */, FA0B7E301A95902C000E1D17 /* Shape.cpp in Sources */,
FA93C4541F315B960087CCD4 /* FormatHandler.cpp in Sources */,
FA0B7E481A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */, FA0B7E481A95902C000E1D17 /* wrap_DistanceJoint.cpp in Sources */,
FA0B7A8F1A958EA3000E1D17 /* b2FrictionJoint.cpp in Sources */, FA0B7A8F1A958EA3000E1D17 /* b2FrictionJoint.cpp in Sources */,
FA0B792F1A958E3B000E1D17 /* Module.cpp in Sources */, FA0B792F1A958E3B000E1D17 /* Module.cpp in Sources */,
@@ -4597,6 +4577,7 @@
FA0B7E8B1A95902C000E1D17 /* FLACDecoder.cpp in Sources */, FA0B7E8B1A95902C000E1D17 /* FLACDecoder.cpp in Sources */,
FA0B7B3A1A958EA3000E1D17 /* wuff_memory.c in Sources */, FA0B7B3A1A958EA3000E1D17 /* wuff_memory.c in Sources */,
FA0B7A381A958EA3000E1D17 /* b2DynamicTree.cpp in Sources */, FA0B7A381A958EA3000E1D17 /* b2DynamicTree.cpp in Sources */,
FAECA1B21F3164700095D008 /* CompressedSlice.cpp in Sources */,
FA0B7D481A95902C000E1D17 /* Polyline.cpp in Sources */, FA0B7D481A95902C000E1D17 /* Polyline.cpp in Sources */,
217DFC111D9F6D490055D849 /* usocket.c in Sources */, 217DFC111D9F6D490055D849 /* usocket.c in Sources */,
FAF140751E20934C00F898D2 /* IntermTraverse.cpp in Sources */, FAF140751E20934C00F898D2 /* IntermTraverse.cpp in Sources */,
@@ -4647,7 +4628,6 @@
FA91591E1CF1ED7500A7053F /* halffloat.cpp in Sources */, FA91591E1CF1ED7500A7053F /* halffloat.cpp in Sources */,
FA0B7E7B1A95902C000E1D17 /* wrap_World.cpp in Sources */, FA0B7E7B1A95902C000E1D17 /* wrap_World.cpp in Sources */,
FA0B7B281A958EA3000E1D17 /* simplexnoise1234.cpp in Sources */, FA0B7B281A958EA3000E1D17 /* simplexnoise1234.cpp in Sources */,
FA0B7D901A95902C000E1D17 /* FormatHandler.cpp in Sources */,
FA0B7D421A95902C000E1D17 /* OpenGL.cpp in Sources */, FA0B7D421A95902C000E1D17 /* OpenGL.cpp in Sources */,
FA0B7A671A958EA3000E1D17 /* b2Island.cpp in Sources */, FA0B7A671A958EA3000E1D17 /* b2Island.cpp in Sources */,
FA0B7DBE1A95902C000E1D17 /* JoystickModule.cpp in Sources */, FA0B7DBE1A95902C000E1D17 /* JoystickModule.cpp in Sources */,
+2 -2
View File
@@ -447,7 +447,7 @@ static int screenshotSaveToFile(lua_State *L)
const char *filename = luaL_checkstring(L, lua_upvalueindex(1)); const char *filename = luaL_checkstring(L, lua_upvalueindex(1));
const char *ext = luaL_checkstring(L, lua_upvalueindex(2)); const char *ext = luaL_checkstring(L, lua_upvalueindex(2));
image::ImageData::EncodedFormat format; image::FormatHandler::EncodedFormat format;
if (!image::ImageData::getConstant(ext, format)) if (!image::ImageData::getConstant(ext, format))
return 0; return 0;
@@ -478,7 +478,7 @@ int w_captureScreenshot(lua_State *L)
std::transform(ext.begin(), ext.end(), ext.begin(), tolower); std::transform(ext.begin(), ext.end(), ext.begin(), tolower);
image::ImageData::EncodedFormat format; image::FormatHandler::EncodedFormat format;
if (!image::ImageData::getConstant(ext.c_str(), format)) if (!image::ImageData::getConstant(ext.c_str(), format))
return luaL_error(L, "Invalid encoded image format: %s", ext.c_str()); return luaL_error(L, "Invalid encoded image format: %s", ext.c_str());
@@ -18,20 +18,17 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_COMPRESSED_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_COMPRESSED_HANDLER_H
// LOVE // LOVE
#include "filesystem/FileData.h"
#include "image/CompressedImageData.h"
#include "common/Object.h" #include "common/Object.h"
#include "filesystem/FileData.h"
#include "CompressedSlice.h"
namespace love namespace love
{ {
namespace image namespace image
{ {
namespace magpie
{
/** /**
* Base class for all CompressedImageData parser library interfaces. * Base class for all CompressedImageData parser library interfaces.
@@ -45,8 +42,8 @@ public:
virtual ~CompressedFormatHandler() {} virtual ~CompressedFormatHandler() {}
/** /**
* Determines whether a particular FileData can be parsed as CompressedImageData * Determines whether a particular FileData can be parsed as
* by this handler. * CompressedImageData by this handler.
* @param data The data to parse. * @param data The data to parse.
**/ **/
virtual bool canParse(const filesystem::FileData *data) = 0; virtual bool canParse(const filesystem::FileData *data) = 0;
@@ -56,21 +53,18 @@ public:
* a single block of memory containing all the images. * a single block of memory containing all the images.
* *
* @param[in] filedata The data to parse. * @param[in] filedata The data to parse.
* @param[out] images The list of sub-images generated. Byte data is a pointer * @param[out] images The list of sub-images generated. Byte data is a
* to the returned data. * pointer to the returned data.
* @param[out] format The format of the Compressed Data. * @param[out] format The format of the Compressed Data.
* @param[out] sRGB Whether the texture is sRGB-encoded. * @param[out] sRGB Whether the texture is sRGB-encoded.
* *
* @return The single block of memory containing the parsed images. * @return The single block of memory containing the parsed images.
**/ **/
virtual StrongRef<CompressedImageData::Memory> parse(filesystem::FileData *filedata, virtual StrongRef<CompressedMemory> parse(filesystem::FileData *filedata,
std::vector<StrongRef<CompressedImageData::Slice>> &images, std::vector<StrongRef<CompressedSlice>> &images,
PixelFormat &format, bool &sRGB) = 0; PixelFormat &format, bool &sRGB) = 0;
}; // CompressedFormatHandler }; // CompressedFormatHandler
} // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_COMPRESSED_HANDLER_H
+46 -50
View File
@@ -27,58 +27,54 @@ namespace image
love::Type CompressedImageData::type("CompressedImageData", &Data::type); love::Type CompressedImageData::type("CompressedImageData", &Data::type);
CompressedImageData::Memory::Memory(size_t size) CompressedImageData::CompressedImageData(const std::list<CompressedFormatHandler *> &formats, love::filesystem::FileData *filedata)
: data(nullptr)
, size(size)
{
try
{
data = new uint8[size];
}
catch (std::exception &)
{
throw love::Exception("Out of memory.");
}
}
CompressedImageData::Memory::~Memory()
{
delete[] data;
}
CompressedImageData::Slice::Slice(PixelFormat format, int width, int height, Memory *memory, size_t offset, size_t size)
: memory(memory)
, offset(offset)
, dataSize(size)
{
this->format = format;
this->width = width;
this->height = height;
}
CompressedImageData::Slice::Slice(const Slice &s)
: memory(s.memory)
, offset(s.offset)
, dataSize(s.dataSize)
{
this->format = s.getFormat();
this->width = s.getWidth();
this->height = s.getHeight();
}
CompressedImageData::Slice::~Slice()
{
}
CompressedImageData::Slice *CompressedImageData::Slice::clone() const
{
return new Slice(*this);
}
CompressedImageData::CompressedImageData()
: format(PIXELFORMAT_UNKNOWN) : format(PIXELFORMAT_UNKNOWN)
, sRGB(false) , sRGB(false)
{ {
CompressedFormatHandler *parser = nullptr;
for (CompressedFormatHandler *handler : formats)
{
if (handler->canParse(filedata))
{
parser = handler;
break;
}
}
if (parser == nullptr)
throw love::Exception("Could not parse compressed data: Unknown format.");
memory = parser->parse(filedata, dataImages, format, sRGB);
if (memory == nullptr)
throw love::Exception("Could not parse compressed data.");
if (format == PIXELFORMAT_UNKNOWN)
throw love::Exception("Could not parse compressed data: Unknown format.");
if (dataImages.size() == 0 || memory->size == 0)
throw love::Exception("Could not parse compressed data: No valid data?");
}
CompressedImageData::CompressedImageData(const CompressedImageData &c)
: format(c.format)
, sRGB(c.sRGB)
{
memory.set(new CompressedMemory(c.memory->size), Acquire::NORETAIN);
memcpy(memory->data, c.memory->data, memory->size);
for (const auto &i : c.dataImages)
{
auto slice = new CompressedSlice(i->getFormat(), i->getWidth(), i->getHeight(), memory, i->getOffset(), i->getSize());
dataImages.push_back(slice);
slice->release();
}
}
CompressedImageData *CompressedImageData::clone() const
{
return new CompressedImageData(*this);
} }
CompressedImageData::~CompressedImageData() CompressedImageData::~CompressedImageData()
@@ -143,7 +139,7 @@ bool CompressedImageData::isSRGB() const
return sRGB; return sRGB;
} }
CompressedImageData::Slice *CompressedImageData::getSlice(int slice, int miplevel) const CompressedSlice *CompressedImageData::getSlice(int slice, int miplevel) const
{ {
checkSliceExists(slice, miplevel); checkSliceExists(slice, miplevel);
+12 -47
View File
@@ -25,10 +25,13 @@
#include "common/StringMap.h" #include "common/StringMap.h"
#include "common/int.h" #include "common/int.h"
#include "common/pixelformat.h" #include "common/pixelformat.h"
#include "ImageDataBase.h" #include "filesystem/FileData.h"
#include "CompressedSlice.h"
#include "CompressedFormatHandler.h"
// STL // STL
#include <vector> #include <vector>
#include <list>
namespace love namespace love
{ {
@@ -44,53 +47,16 @@ class CompressedImageData : public Data
{ {
public: public:
class Memory : public Object
{
public:
Memory(size_t size);
virtual ~Memory();
uint8 *data;
size_t size;
}; // Memory
// Compressed image data can have multiple mipmap levels, each represented
// by a sub-image.
class Slice : public ImageDataBase
{
public:
Slice(PixelFormat format, int width, int height, Memory *memory, size_t offset, size_t size);
Slice(const Slice &slice);
virtual ~Slice();
Slice *clone() const override;
void *getData() const override { return memory->data + offset; }
size_t getSize() const override { return dataSize; }
bool isSRGB() const override { return sRGB; }
size_t getOffset() const { return offset; }
private:
StrongRef<Memory> memory;
size_t offset;
size_t dataSize;
bool sRGB;
}; // Slice
static love::Type type; static love::Type type;
CompressedImageData(); CompressedImageData(const std::list<CompressedFormatHandler *> &formats, love::filesystem::FileData *filedata);
CompressedImageData(const CompressedImageData &c);
virtual ~CompressedImageData(); virtual ~CompressedImageData();
// Implements Data. // Implements Data.
virtual CompressedImageData *clone() const = 0; CompressedImageData *clone() const override;
virtual void *getData() const; void *getData() const override;
virtual size_t getSize() const; size_t getSize() const override;
/** /**
* Gets the number of mipmaps in this Compressed Image Data. * Gets the number of mipmaps in this Compressed Image Data.
@@ -130,19 +96,18 @@ public:
bool isSRGB() const; bool isSRGB() const;
Slice *getSlice(int slice, int miplevel) const; CompressedSlice *getSlice(int slice, int miplevel) const;
protected: protected:
PixelFormat format; PixelFormat format;
bool sRGB; bool sRGB;
// Single block of memory containing all of the sub-images. // Single block of memory containing all of the sub-images.
StrongRef<Memory> memory; StrongRef<CompressedMemory> memory;
// Texture info for each mipmap level. // Texture info for each mipmap level.
std::vector<StrongRef<Slice>> dataImages; std::vector<StrongRef<CompressedSlice>> dataImages;
void checkSliceExists(int slice, int miplevel) const; void checkSliceExists(int slice, int miplevel) const;
@@ -18,37 +18,61 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_COMPRESSED_IMAGE_DATA_H #include "CompressedSlice.h"
#define LOVE_IMAGE_MAGPIE_COMPRESSED_IMAGE_DATA_H #include "common/Exception.h"
// LOVE
#include "CompressedFormatHandler.h"
#include "filesystem/FileData.h"
#include "image/CompressedImageData.h"
// C++
#include <list>
namespace love namespace love
{ {
namespace image namespace image
{ {
namespace magpie
CompressedMemory::CompressedMemory(size_t size)
: data(nullptr)
, size(size)
{ {
try
{
data = new uint8[size];
}
catch (std::exception &)
{
throw love::Exception("Out of memory.");
}
}
class CompressedImageData : public love::image::CompressedImageData CompressedMemory::~CompressedMemory()
{ {
public: delete[] data;
}
CompressedImageData(std::list<CompressedFormatHandler *> formats, love::filesystem::FileData *filedata); CompressedSlice::CompressedSlice(PixelFormat format, int width, int height, CompressedMemory *memory, size_t offset, size_t size)
CompressedImageData(const CompressedImageData &c); : memory(memory)
virtual ~CompressedImageData(); , offset(offset)
, dataSize(size)
{
this->format = format;
this->width = width;
this->height = height;
}
virtual CompressedImageData *clone() const; CompressedSlice::CompressedSlice(const CompressedSlice &s)
}; // CompressedImageData : memory(s.memory)
, offset(s.offset)
, dataSize(s.dataSize)
{
this->format = s.getFormat();
this->width = s.getWidth();
this->height = s.getHeight();
}
CompressedSlice::~CompressedSlice()
{
}
CompressedSlice *CompressedSlice::clone() const
{
return new CompressedSlice(*this);
}
} // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_COMPRESSED_IMAGE_DATA_H
+72
View File
@@ -0,0 +1,72 @@
/**
* Copyright (c) 2006-2017 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.
**/
#pragma once
// LOVE
#include "common/int.h"
#include "common/pixelformat.h"
#include "common/Object.h"
#include "ImageDataBase.h"
namespace love
{
namespace image
{
class CompressedMemory : public Object
{
public:
CompressedMemory(size_t size);
virtual ~CompressedMemory();
uint8 *data;
size_t size;
}; // CompressedMemory
// Compressed image data can have multiple mipmap levels, each represented by a
// sub-image.
class CompressedSlice : public ImageDataBase
{
public:
CompressedSlice(PixelFormat format, int width, int height, CompressedMemory *memory, size_t offset, size_t size);
CompressedSlice(const CompressedSlice &slice);
virtual ~CompressedSlice();
CompressedSlice *clone() const override;
void *getData() const override { return memory->data + offset; }
size_t getSize() const override { return dataSize; }
bool isSRGB() const override { return sRGB; }
size_t getOffset() const { return offset; }
private:
StrongRef<CompressedMemory> memory;
size_t offset;
size_t dataSize;
bool sRGB;
}; // CompressedSlice
} // image
} // love
@@ -26,8 +26,6 @@ namespace love
{ {
namespace image namespace image
{ {
namespace magpie
{
FormatHandler::FormatHandler() FormatHandler::FormatHandler()
{ {
@@ -42,7 +40,7 @@ bool FormatHandler::canDecode(love::filesystem::FileData* /*data*/)
return false; return false;
} }
bool FormatHandler::canEncode(PixelFormat /*rawFormat*/, ImageData::EncodedFormat /*encodedFormat*/) bool FormatHandler::canEncode(PixelFormat /*rawFormat*/, EncodedFormat /*encodedFormat*/)
{ {
return false; return false;
} }
@@ -52,7 +50,7 @@ FormatHandler::DecodedImage FormatHandler::decode(love::filesystem::FileData* /*
throw love::Exception("Image decoding is not implemented for this format backend."); throw love::Exception("Image decoding is not implemented for this format backend.");
} }
FormatHandler::EncodedImage FormatHandler::encode(const DecodedImage& /*img*/, ImageData::EncodedFormat /*format*/) FormatHandler::EncodedImage FormatHandler::encode(const DecodedImage& /*img*/, EncodedFormat /*format*/)
{ {
throw love::Exception("Image encoding is not implemented for this format backend."); throw love::Exception("Image encoding is not implemented for this format backend.");
} }
@@ -62,6 +60,5 @@ void FormatHandler::free(unsigned char *mem)
delete[] mem; delete[] mem;
} }
} // magpie
} // image } // image
} // love } // love
@@ -18,20 +18,17 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_FORMAT_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_FORMAT_HANDLER_H
// LOVE // LOVE
#include "image/ImageData.h"
#include "filesystem/FileData.h"
#include "common/Object.h" #include "common/Object.h"
#include "common/pixelformat.h"
#include "filesystem/FileData.h"
namespace love namespace love
{ {
namespace image namespace image
{ {
namespace magpie
{
/** /**
* Base class for all ImageData encoder/decoder library interfaces. * Base class for all ImageData encoder/decoder library interfaces.
@@ -41,6 +38,13 @@ class FormatHandler : public love::Object
{ {
public: public:
enum EncodedFormat
{
ENCODED_TGA,
ENCODED_PNG,
ENCODED_MAX_ENUM
};
// Raw RGBA pixel data. // Raw RGBA pixel data.
struct DecodedImage struct DecodedImage
{ {
@@ -76,7 +80,7 @@ public:
/** /**
* Whether this format handler can encode to a particular format. * Whether this format handler can encode to a particular format.
**/ **/
virtual bool canEncode(PixelFormat rawFormat, ImageData::EncodedFormat encodedFormat); virtual bool canEncode(PixelFormat rawFormat, EncodedFormat encodedFormat);
/** /**
* Decodes an image from its encoded form into raw pixel data. * Decodes an image from its encoded form into raw pixel data.
@@ -91,7 +95,7 @@ public:
* @param format The format to encode to. * @param format The format to encode to.
* @return The encoded image data. * @return The encoded image data.
**/ **/
virtual EncodedImage encode(const DecodedImage &img, ImageData::EncodedFormat format); virtual EncodedImage encode(const DecodedImage &img, EncodedFormat format);
/** /**
* Frees memory allocated by the format handler. * Frees memory allocated by the format handler.
@@ -100,8 +104,5 @@ public:
}; // FormatHandler }; // FormatHandler
} // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_FORMAT_HANDLER_H
+84
View File
@@ -20,6 +20,17 @@
// LOVE // LOVE
#include "Image.h" #include "Image.h"
#include "common/config.h"
#include "magpie/PNGHandler.h"
#include "magpie/STBHandler.h"
#include "magpie/EXRHandler.h"
#include "magpie/ddsHandler.h"
#include "magpie/PVRHandler.h"
#include "magpie/KTXHandler.h"
#include "magpie/PKMHandler.h"
#include "magpie/ASTCHandler.h"
namespace love namespace love
{ {
@@ -28,6 +39,79 @@ namespace image
love::Type Image::type("image", &Module::type); love::Type Image::type("image", &Module::type);
Image::Image()
{
using namespace magpie;
halfInit(); // Makes sure half-float conversions can be used.
formatHandlers = {
new PNGHandler,
new STBHandler,
new EXRHandler,
};
compressedFormatHandlers = {
new DDSHandler,
new PVRHandler,
new KTXHandler,
new PKMHandler,
new ASTCHandler,
};
}
Image::~Image()
{
// ImageData objects reference the FormatHandlers in our list, so we should
// release them instead of deleting them completely here.
for (FormatHandler *handler : formatHandlers)
handler->release();
for (CompressedFormatHandler *handler : compressedFormatHandlers)
handler->release();
}
const char *Image::getName() const
{
return "love.image.magpie";
}
love::image::ImageData *Image::newImageData(love::filesystem::FileData *data)
{
return new ImageData(data);
}
love::image::ImageData *Image::newImageData(int width, int height, PixelFormat format)
{
return new ImageData(width, height, format);
}
love::image::ImageData *Image::newImageData(int width, int height, PixelFormat format, void *data, bool own)
{
return new ImageData(width, height, format, data, own);
}
love::image::CompressedImageData *Image::newCompressedData(love::filesystem::FileData *data)
{
return new CompressedImageData(compressedFormatHandlers, data);
}
bool Image::isCompressed(love::filesystem::FileData *data)
{
for (CompressedFormatHandler *handler : compressedFormatHandlers)
{
if (handler->canParse(data))
return true;
}
return false;
}
const std::list<FormatHandler *> &Image::getFormatHandlers() const
{
return formatHandlers;
}
ImageData *Image::newPastedImageData(ImageData *src, int sx, int sy, int w, int h) ImageData *Image::newPastedImageData(ImageData *src, int sx, int sy, int w, int h)
{ {
ImageData *res = newImageData(w, h, src->getFormat()); ImageData *res = newImageData(w, h, src->getFormat());
+20 -7
View File
@@ -28,6 +28,9 @@
#include "ImageData.h" #include "ImageData.h"
#include "CompressedImageData.h" #include "CompressedImageData.h"
// C++
#include <list>
namespace love namespace love
{ {
namespace image namespace image
@@ -46,17 +49,19 @@ public:
static love::Type type; static love::Type type;
virtual ~Image() {} Image();
virtual ~Image();
// Implements Module. // Implements Module.
virtual ModuleType getModuleType() const { return M_IMAGE; } ModuleType getModuleType() const override { return M_IMAGE; }
const char *getName() const override;
/** /**
* Creates new ImageData from FileData. * Creates new ImageData from FileData.
* @param data The FileData containing the encoded image data. * @param data The FileData containing the encoded image data.
* @return The new ImageData. * @return The new ImageData.
**/ **/
virtual ImageData *newImageData(love::filesystem::FileData *data) = 0; ImageData *newImageData(love::filesystem::FileData *data);
/** /**
* Creates empty ImageData with the given size. * Creates empty ImageData with the given size.
@@ -64,7 +69,7 @@ public:
* @param height The height of the ImageData. * @param height The height of the ImageData.
* @return The new ImageData. * @return The new ImageData.
**/ **/
virtual ImageData *newImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8) = 0; ImageData *newImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8);
/** /**
* Creates empty ImageData with the given size. * Creates empty ImageData with the given size.
@@ -75,28 +80,36 @@ public:
* copy it. * copy it.
* @return The new ImageData. * @return The new ImageData.
**/ **/
virtual ImageData *newImageData(int width, int height, PixelFormat format, void *data, bool own = false) = 0; ImageData *newImageData(int width, int height, PixelFormat format, void *data, bool own = false);
/** /**
* Creates new CompressedImageData from FileData. * Creates new CompressedImageData from FileData.
* @param data The FileData containing the compressed image data. * @param data The FileData containing the compressed image data.
* @return The new CompressedImageData. * @return The new CompressedImageData.
**/ **/
virtual CompressedImageData *newCompressedData(love::filesystem::FileData *data) = 0; CompressedImageData *newCompressedData(love::filesystem::FileData *data);
/** /**
* Determines whether a FileData is Compressed image data or not. * Determines whether a FileData is Compressed image data or not.
* @param data The FileData to test. * @param data The FileData to test.
**/ **/
virtual bool isCompressed(love::filesystem::FileData *data) = 0; bool isCompressed(love::filesystem::FileData *data);
std::vector<StrongRef<ImageData>> newCubeFaces(ImageData *src); std::vector<StrongRef<ImageData>> newCubeFaces(ImageData *src);
std::vector<StrongRef<ImageData>> newVolumeLayers(ImageData *src); std::vector<StrongRef<ImageData>> newVolumeLayers(ImageData *src);
const std::list<FormatHandler *> &getFormatHandlers() const;
private: private:
ImageData *newPastedImageData(ImageData *src, int sx, int sy, int w, int h); ImageData *newPastedImageData(ImageData *src, int sx, int sy, int w, int h);
// Image format handlers we can use for decoding and encoding ImageData.
std::list<FormatHandler *> formatHandlers;
// Compressed image format handers we can use for parsing CompressedImageData.
std::list<CompressedFormatHandler *> compressedFormatHandlers;
}; // Image }; // Image
} // image } // image
+204 -8
View File
@@ -19,6 +19,8 @@
**/ **/
#include "ImageData.h" #include "ImageData.h"
#include "Image.h"
#include "filesystem/Filesystem.h"
using love::thread::Lock; using love::thread::Lock;
@@ -29,13 +31,207 @@ namespace image
love::Type ImageData::type("ImageData", &Data::type); love::Type ImageData::type("ImageData", &Data::type);
ImageData::ImageData() ImageData::ImageData(love::filesystem::FileData *data)
: data(nullptr)
{ {
decode(data);
}
ImageData::ImageData(int width, int height, PixelFormat format)
{
if (!validPixelFormat(format))
throw love::Exception("Unsupported pixel format for ImageData");
this->width = width;
this->height = height;
this->format = format;
create(width, height, format);
// Set to black/transparency.
memset(data, 0, getSize());
}
ImageData::ImageData(int width, int height, PixelFormat format, void *data, bool own)
{
if (!validPixelFormat(format))
throw love::Exception("Unsupported pixel format for ImageData");
this->width = width;
this->height = height;
this->format = format;
if (own)
this->data = (unsigned char *) data;
else
create(width, height, format, data);
}
ImageData::ImageData(const ImageData &c)
{
width = c.width;
height = c.height;
format = c.format;
create(width, height, format, c.getData());
} }
ImageData::~ImageData() ImageData::~ImageData()
{ {
if (decodeHandler.get())
decodeHandler->free(data);
else
delete[] data;
}
love::image::ImageData *ImageData::clone() const
{
return new ImageData(*this);
}
void ImageData::create(int width, int height, PixelFormat format, void *data)
{
size_t datasize = width * height * getPixelFormatSize(format);
try
{
this->data = new unsigned char[datasize];
}
catch(std::bad_alloc &)
{
throw love::Exception("Out of memory");
}
if (data)
memcpy(this->data, data, datasize);
decodeHandler = nullptr;
this->format = format;
}
void ImageData::decode(love::filesystem::FileData *data)
{
FormatHandler *decoder = nullptr;
FormatHandler::DecodedImage decodedimage;
auto module = Module::getInstance<Image>(Module::M_IMAGE);
if (module == nullptr)
throw love::Exception("love.image must be loaded in order to decode an ImageData.");
for (FormatHandler *handler : module->getFormatHandlers())
{
if (handler->canDecode(data))
{
decoder = handler;
break;
}
}
if (decoder)
decodedimage = decoder->decode(data);
if (decodedimage.data == nullptr)
{
const std::string &name = data->getFilename();
throw love::Exception("Could not decode file '%s' to ImageData: unsupported file format", name.c_str());
}
if (decodedimage.size != decodedimage.width * decodedimage.height * getPixelFormatSize(decodedimage.format))
{
decoder->free(decodedimage.data);
throw love::Exception("Could not convert image!");
}
// Clean up any old data.
if (decodeHandler)
decodeHandler->free(this->data);
else
delete[] this->data;
this->width = decodedimage.width;
this->height = decodedimage.height;
this->data = decodedimage.data;
this->format = decodedimage.format;
decodeHandler = decoder;
}
love::filesystem::FileData *ImageData::encode(FormatHandler::EncodedFormat encodedFormat, const char *filename, bool writefile) const
{
FormatHandler *encoder = nullptr;
FormatHandler::EncodedImage encodedimage;
FormatHandler::DecodedImage rawimage;
rawimage.width = width;
rawimage.height = height;
rawimage.size = getSize();
rawimage.data = data;
rawimage.format = format;
auto module = Module::getInstance<Image>(Module::M_IMAGE);
if (module == nullptr)
throw love::Exception("love.image must be loaded in order to encode an ImageData.");
for (FormatHandler *handler : module->getFormatHandlers())
{
if (handler->canEncode(format, encodedFormat))
{
encoder = handler;
break;
}
}
if (encoder != nullptr)
{
thread::Lock lock(mutex);
encodedimage = encoder->encode(rawimage, encodedFormat);
}
if (encoder == nullptr || encodedimage.data == nullptr)
{
const char *fname = "unknown";
love::getConstant(format, fname);
throw love::Exception("No suitable image encoder for %s format.", fname);
}
love::filesystem::FileData *filedata = nullptr;
try
{
filedata = new love::filesystem::FileData(encodedimage.size, filename);
}
catch (love::Exception &)
{
encoder->free(encodedimage.data);
throw;
}
memcpy(filedata->getData(), encodedimage.data, encodedimage.size);
encoder->free(encodedimage.data);
if (writefile)
{
auto fs = Module::getInstance<filesystem::Filesystem>(Module::M_FILESYSTEM);
if (fs == nullptr)
{
filedata->release();
throw love::Exception("love.filesystem must be loaded in order to write an encoded ImageData to a file.");
}
try
{
fs->write(filename, filedata->getData(), filedata->getSize());
}
catch (love::Exception &)
{
filedata->release();
throw;
}
}
return filedata;
} }
size_t ImageData::getSize() const size_t ImageData::getSize() const
@@ -289,23 +485,23 @@ bool ImageData::validPixelFormat(PixelFormat format)
} }
} }
bool ImageData::getConstant(const char *in, EncodedFormat &out) bool ImageData::getConstant(const char *in, FormatHandler::EncodedFormat &out)
{ {
return encodedFormats.find(in, out); return encodedFormats.find(in, out);
} }
bool ImageData::getConstant(EncodedFormat in, const char *&out) bool ImageData::getConstant(FormatHandler::EncodedFormat in, const char *&out)
{ {
return encodedFormats.find(in, out); return encodedFormats.find(in, out);
} }
StringMap<ImageData::EncodedFormat, ImageData::ENCODED_MAX_ENUM>::Entry ImageData::encodedFormatEntries[] = StringMap<FormatHandler::EncodedFormat, FormatHandler::ENCODED_MAX_ENUM>::Entry ImageData::encodedFormatEntries[] =
{ {
{"tga", ENCODED_TGA}, {"tga", FormatHandler::ENCODED_TGA},
{"png", ENCODED_PNG}, {"png", FormatHandler::ENCODED_PNG},
}; };
StringMap<ImageData::EncodedFormat, ImageData::ENCODED_MAX_ENUM> ImageData::encodedFormats(ImageData::encodedFormatEntries, sizeof(ImageData::encodedFormatEntries)); StringMap<FormatHandler::EncodedFormat, FormatHandler::ENCODED_MAX_ENUM> ImageData::encodedFormats(ImageData::encodedFormatEntries, sizeof(ImageData::encodedFormatEntries));
} // image } // image
} // love } // love
+26 -24
View File
@@ -29,6 +29,7 @@
#include "filesystem/FileData.h" #include "filesystem/FileData.h"
#include "thread/threads.h" #include "thread/threads.h"
#include "ImageDataBase.h" #include "ImageDataBase.h"
#include "FormatHandler.h"
using love::thread::Mutex; using love::thread::Mutex;
@@ -61,14 +62,10 @@ public:
static love::Type type; static love::Type type;
enum EncodedFormat ImageData(love::filesystem::FileData *data);
{ ImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8);
ENCODED_TGA, ImageData(int width, int height, PixelFormat format, void *data, bool own);
ENCODED_PNG, ImageData(const ImageData &c);
ENCODED_MAX_ENUM
};
ImageData();
virtual ~ImageData(); virtual ~ImageData();
/** /**
@@ -111,12 +108,12 @@ public:
* @param f The file to save the encoded image data to. * @param f The file to save the encoded image data to.
* @param format The format of the encoded data. * @param format The format of the encoded data.
**/ **/
virtual love::filesystem::FileData *encode(EncodedFormat format, const char *filename, bool writefile) = 0; love::filesystem::FileData *encode(FormatHandler::EncodedFormat format, const char *filename, bool writefile) const;
love::thread::Mutex *getMutex() const; love::thread::Mutex *getMutex() const;
// Implements ImageDataBase. // Implements ImageDataBase.
virtual ImageData *clone() const override = 0; ImageData *clone() const override;
void *getData() const override; void *getData() const override;
size_t getSize() const override; size_t getSize() const override;
bool isSRGB() const override; bool isSRGB() const override;
@@ -125,18 +122,8 @@ public:
static bool validPixelFormat(PixelFormat format); static bool validPixelFormat(PixelFormat format);
static bool getConstant(const char *in, EncodedFormat &out); static bool getConstant(const char *in, FormatHandler::EncodedFormat &out);
static bool getConstant(EncodedFormat in, const char *&out); static bool getConstant(FormatHandler::EncodedFormat in, const char *&out);
protected:
// The actual data.
unsigned char *data;
// We need to be thread-safe
// so we lock when we're accessing our
// data
love::thread::MutexRef mutex;
private: private:
@@ -148,6 +135,21 @@ private:
float *f32; float *f32;
}; };
// Create imagedata. Initialize with data if not null.
void create(int width, int height, PixelFormat format, void *data = nullptr);
// Decode and load an encoded format.
void decode(love::filesystem::FileData *data);
// The actual data.
unsigned char *data = nullptr;
love::thread::MutexRef mutex;
// The format handler that was used to decode the ImageData. We need to know
// this so we can properly delete memory allocated by the decoder.
StrongRef<FormatHandler> decodeHandler;
static void pasteRGBA8toRGBA16(Row src, Row dst, int w); static void pasteRGBA8toRGBA16(Row src, Row dst, int w);
static void pasteRGBA8toRGBA16F(Row src, Row dst, int w); static void pasteRGBA8toRGBA16F(Row src, Row dst, int w);
static void pasteRGBA8toRGBA32F(Row src, Row dst, int w); static void pasteRGBA8toRGBA32F(Row src, Row dst, int w);
@@ -164,8 +166,8 @@ private:
static void pasteRGBA32FtoRGBA16(Row src, Row dst, int w); static void pasteRGBA32FtoRGBA16(Row src, Row dst, int w);
static void pasteRGBA32FtoRGBA16F(Row src, Row dst, int w); static void pasteRGBA32FtoRGBA16F(Row src, Row dst, int w);
static StringMap<EncodedFormat, ENCODED_MAX_ENUM>::Entry encodedFormatEntries[]; static StringMap<FormatHandler::EncodedFormat, FormatHandler::ENCODED_MAX_ENUM>::Entry encodedFormatEntries[];
static StringMap<EncodedFormat, ENCODED_MAX_ENUM> encodedFormats; static StringMap<FormatHandler::EncodedFormat, FormatHandler::ENCODED_MAX_ENUM> encodedFormats;
}; // ImageData }; // ImageData
+3 -3
View File
@@ -104,7 +104,7 @@ bool ASTCHandler::canParse(const filesystem::FileData *data)
return true; return true;
} }
StrongRef<CompressedImageData::Memory> ASTCHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedImageData::Slice>> &images, PixelFormat &format, bool &sRGB) StrongRef<CompressedMemory> ASTCHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedSlice>> &images, PixelFormat &format, bool &sRGB)
{ {
if (!canParse(filedata)) if (!canParse(filedata))
throw love::Exception("Could not decode compressed data (not an .astc file?)"); throw love::Exception("Could not decode compressed data (not an .astc file?)");
@@ -129,12 +129,12 @@ StrongRef<CompressedImageData::Memory> ASTCHandler::parse(filesystem::FileData *
if (totalsize + sizeof(header) > filedata->getSize()) if (totalsize + sizeof(header) > filedata->getSize())
throw love::Exception("Could not parse .astc file: file is too small."); throw love::Exception("Could not parse .astc file: file is too small.");
StrongRef<CompressedImageData::Memory> memory(new CompressedImageData::Memory(totalsize), Acquire::NORETAIN); StrongRef<CompressedMemory> memory(new CompressedMemory(totalsize), Acquire::NORETAIN);
// .astc files only store a single mipmap level. // .astc files only store a single mipmap level.
memcpy(memory->data, (uint8 *) filedata->getData() + sizeof(ASTCHeader), totalsize); memcpy(memory->data, (uint8 *) filedata->getData() + sizeof(ASTCHeader), totalsize);
images.emplace_back(new CompressedImageData::Slice(cformat, sizeX, sizeY, memory, 0, totalsize), Acquire::NORETAIN); images.emplace_back(new CompressedSlice(cformat, sizeX, sizeY, memory, 0, totalsize), Acquire::NORETAIN);
format = cformat; format = cformat;
sRGB = false; sRGB = false;
+4 -7
View File
@@ -18,11 +18,10 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_ASTC_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_ASTC_HANDLER_H
#include "common/config.h" #include "common/config.h"
#include "CompressedFormatHandler.h" #include "image/CompressedFormatHandler.h"
namespace love namespace love
{ {
@@ -44,8 +43,8 @@ public:
// Implements CompressedFormatHandler. // Implements CompressedFormatHandler.
bool canParse(const filesystem::FileData *data) override; bool canParse(const filesystem::FileData *data) override;
StrongRef<CompressedImageData::Memory> parse(filesystem::FileData *filedata, StrongRef<CompressedMemory> parse(filesystem::FileData *filedata,
std::vector<StrongRef<CompressedImageData::Slice>> &images, std::vector<StrongRef<CompressedSlice>> &images,
PixelFormat &format, bool &sRGB) override; PixelFormat &format, bool &sRGB) override;
}; // ASTCHandler }; // ASTCHandler
@@ -53,5 +52,3 @@ public:
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_ASTC_HANDLER_H
@@ -1,85 +0,0 @@
/**
* Copyright (c) 2006-2017 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 "CompressedImageData.h"
namespace love
{
namespace image
{
namespace magpie
{
CompressedImageData::CompressedImageData(std::list<CompressedFormatHandler *> formats, love::filesystem::FileData *filedata)
{
CompressedFormatHandler *parser = nullptr;
for (CompressedFormatHandler *handler : formats)
{
if (handler->canParse(filedata))
{
parser = handler;
break;
}
}
if (parser == nullptr)
throw love::Exception("Could not parse compressed data: Unknown format.");
memory = parser->parse(filedata, dataImages, format, sRGB);
if (memory == nullptr)
throw love::Exception("Could not parse compressed data.");
if (format == PIXELFORMAT_UNKNOWN)
throw love::Exception("Could not parse compressed data: Unknown format.");
if (dataImages.size() == 0 || memory->size == 0)
throw love::Exception("Could not parse compressed data: No valid data?");
}
CompressedImageData::CompressedImageData(const CompressedImageData &c)
{
format = c.format;
sRGB = c.sRGB;
memory.set(new Memory(c.memory->size), Acquire::NORETAIN);
memcpy(memory->data, c.memory->data, memory->size);
for (const auto &i : c.dataImages)
{
Slice *slice = new Slice(i->getFormat(), i->getWidth(), i->getHeight(), memory, i->getOffset(), i->getSize());
dataImages.push_back(slice);
slice->release();
}
}
CompressedImageData *CompressedImageData::clone() const
{
return new CompressedImageData(*this);
}
CompressedImageData::~CompressedImageData()
{
}
} // magpie
} // image
} // love
+3 -2
View File
@@ -20,6 +20,7 @@
// LOVE // LOVE
#include "EXRHandler.h" #include "EXRHandler.h"
#include "common/halffloat.h"
// tinyexr // tinyexr
#define TINYEXR_IMPLEMENTATION #define TINYEXR_IMPLEMENTATION
@@ -41,7 +42,7 @@ bool EXRHandler::canDecode(love::filesystem::FileData *data)
return ParseEXRVersionFromMemory(&version, (const unsigned char *) data->getData(), data->getSize()) == TINYEXR_SUCCESS; return ParseEXRVersionFromMemory(&version, (const unsigned char *) data->getData(), data->getSize()) == TINYEXR_SUCCESS;
} }
bool EXRHandler::canEncode(PixelFormat /*rawFormat*/, ImageData::EncodedFormat /*encodedFormat*/) bool EXRHandler::canEncode(PixelFormat /*rawFormat*/, EncodedFormat /*encodedFormat*/)
{ {
return false; return false;
} }
@@ -186,7 +187,7 @@ FormatHandler::DecodedImage EXRHandler::decode(love::filesystem::FileData *data)
return img; return img;
} }
FormatHandler::EncodedImage EXRHandler::encode(const DecodedImage & /*img*/, ImageData::EncodedFormat /*encodedFormat*/) FormatHandler::EncodedImage EXRHandler::encode(const DecodedImage & /*img*/, EncodedFormat /*encodedFormat*/)
{ {
throw love::Exception("Invalid format."); throw love::Exception("Invalid format.");
} }
+4 -7
View File
@@ -18,10 +18,9 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_EXR_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_EXR_HANDLER_H
#include "FormatHandler.h" #include "image/FormatHandler.h"
namespace love namespace love
{ {
@@ -40,10 +39,10 @@ public:
// Implements FormatHandler. // Implements FormatHandler.
virtual bool canDecode(love::filesystem::FileData *data); virtual bool canDecode(love::filesystem::FileData *data);
virtual bool canEncode(PixelFormat rawFormat, ImageData::EncodedFormat encodedFormat); virtual bool canEncode(PixelFormat rawFormat, EncodedFormat encodedFormat);
virtual DecodedImage decode(love::filesystem::FileData *data); virtual DecodedImage decode(love::filesystem::FileData *data);
virtual EncodedImage encode(const DecodedImage &img, ImageData::EncodedFormat format); virtual EncodedImage encode(const DecodedImage &img, EncodedFormat format);
virtual void free(unsigned char *mem); virtual void free(unsigned char *mem);
@@ -52,5 +51,3 @@ public:
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_EXR_HANDLER_H
-118
View File
@@ -1,118 +0,0 @@
/**
* Copyright (c) 2006-2017 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 "common/config.h"
#include "Image.h"
#include "ImageData.h"
#include "CompressedImageData.h"
#include "PNGHandler.h"
#include "STBHandler.h"
#include "EXRHandler.h"
#include "ddsHandler.h"
#include "PVRHandler.h"
#include "KTXHandler.h"
#include "PKMHandler.h"
#include "ASTCHandler.h"
namespace love
{
namespace image
{
namespace magpie
{
Image::Image()
{
halfInit(); // Makes sure half-float conversions can be used.
formatHandlers = {
new PNGHandler,
new STBHandler,
new EXRHandler,
};
compressedFormatHandlers = {
new DDSHandler,
new PVRHandler,
new KTXHandler,
new PKMHandler,
new ASTCHandler,
};
}
Image::~Image()
{
// ImageData objects reference the FormatHandlers in our list, so we should
// release them instead of deleting them completely here.
for (FormatHandler *handler : formatHandlers)
handler->release();
for (CompressedFormatHandler *handler : compressedFormatHandlers)
handler->release();
}
const char *Image::getName() const
{
return "love.image.magpie";
}
love::image::ImageData *Image::newImageData(love::filesystem::FileData *data)
{
return new ImageData(data);
}
love::image::ImageData *Image::newImageData(int width, int height, PixelFormat format)
{
return new ImageData(width, height, format);
}
love::image::ImageData *Image::newImageData(int width, int height, PixelFormat format, void *data, bool own)
{
return new ImageData(width, height, format, data, own);
}
love::image::CompressedImageData *Image::newCompressedData(love::filesystem::FileData *data)
{
return new CompressedImageData(compressedFormatHandlers, data);
}
bool Image::isCompressed(love::filesystem::FileData *data)
{
for (CompressedFormatHandler *handler : compressedFormatHandlers)
{
if (handler->canParse(data))
return true;
}
return false;
}
const std::list<FormatHandler *> &Image::getFormatHandlers() const
{
return formatHandlers;
}
} // magpie
} // image
} // love
-78
View File
@@ -1,78 +0,0 @@
/**
* Copyright (c) 2006-2017 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_IMAGE_H
#define LOVE_IMAGE_MAGPIE_IMAGE_H
// LOVE
#include "image/Image.h"
#include "FormatHandler.h"
#include "CompressedFormatHandler.h"
// C++
#include <list>
namespace love
{
namespace image
{
namespace magpie
{
/**
* Similar to love.sound's Lullaby module, love.image.magpie interfaces with
* multiple image libraries and determines the correct one to use on a
* per-image basis at runtime.
**/
class Image final : public love::image::Image
{
public:
Image();
~Image();
// Implements Module.
const char *getName() const override;
love::image::ImageData *newImageData(love::filesystem::FileData *data) override;
love::image::ImageData *newImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8) override;
love::image::ImageData *newImageData(int width, int height, PixelFormat format, void *data, bool own = false) override;
love::image::CompressedImageData *newCompressedData(love::filesystem::FileData *data) override;
bool isCompressed(love::filesystem::FileData *data) override;
const std::list<FormatHandler *> &getFormatHandlers() const;
private:
// Image format handlers we can use for decoding and encoding ImageData.
std::list<FormatHandler *> formatHandlers;
// Compressed image format handers we can use for parsing CompressedImageData.
std::list<CompressedFormatHandler *> compressedFormatHandlers;
}; // Image
} // magpie
} // image
} // love
#endif // LOVE_IMAGE_MAGPIE_IMAGE_H
-239
View File
@@ -1,239 +0,0 @@
/**
* Copyright (c) 2006-2017 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.
**/
// LOVE
#include "ImageData.h"
#include "Image.h"
#include "filesystem/Filesystem.h"
namespace love
{
namespace image
{
namespace magpie
{
ImageData::ImageData(love::filesystem::FileData *data)
{
decode(data);
}
ImageData::ImageData(int width, int height, PixelFormat format)
{
if (!validPixelFormat(format))
throw love::Exception("Unsupported pixel format for ImageData");
this->width = width;
this->height = height;
this->format = format;
create(width, height, format);
// Set to black/transparency.
memset(data, 0, getSize());
}
ImageData::ImageData(int width, int height, PixelFormat format, void *data, bool own)
{
if (!validPixelFormat(format))
throw love::Exception("Unsupported pixel format for ImageData");
this->width = width;
this->height = height;
this->format = format;
if (own)
this->data = (unsigned char *) data;
else
create(width, height, format, data);
}
ImageData::ImageData(const ImageData &c)
{
width = c.width;
height = c.height;
format = c.format;
create(width, height, format, c.getData());
}
ImageData::~ImageData()
{
if (decodeHandler.get())
decodeHandler->free(data);
else
delete[] data;
}
love::image::ImageData *ImageData::clone() const
{
return new ImageData(*this);
}
void ImageData::create(int width, int height, PixelFormat format, void *data)
{
size_t datasize = width * height * getPixelFormatSize(format);
try
{
this->data = new unsigned char[datasize];
}
catch(std::bad_alloc &)
{
throw love::Exception("Out of memory");
}
if (data)
memcpy(this->data, data, datasize);
decodeHandler = nullptr;
this->format = format;
}
void ImageData::decode(love::filesystem::FileData *data)
{
FormatHandler *decoder = nullptr;
FormatHandler::DecodedImage decodedimage;
auto module = dynamic_cast<Image *>(Module::getInstance<love::image::Image>(Module::M_IMAGE));
if (module == nullptr)
throw love::Exception("love.image must be loaded in order to decode an ImageData.");
for (FormatHandler *handler : module->getFormatHandlers())
{
if (handler->canDecode(data))
{
decoder = handler;
break;
}
}
if (decoder)
decodedimage = decoder->decode(data);
if (decodedimage.data == nullptr)
{
const std::string &name = data->getFilename();
throw love::Exception("Could not decode file '%s' to ImageData: unsupported file format", name.c_str());
}
if (decodedimage.size != decodedimage.width * decodedimage.height * getPixelFormatSize(decodedimage.format))
{
decoder->free(decodedimage.data);
throw love::Exception("Could not convert image!");
}
// Clean up any old data.
if (decodeHandler)
decodeHandler->free(this->data);
else
delete[] this->data;
this->width = decodedimage.width;
this->height = decodedimage.height;
this->data = decodedimage.data;
this->format = decodedimage.format;
decodeHandler = decoder;
}
love::filesystem::FileData *ImageData::encode(EncodedFormat encodedFormat, const char *filename, bool writefile)
{
FormatHandler *encoder = nullptr;
FormatHandler::EncodedImage encodedimage;
FormatHandler::DecodedImage rawimage;
rawimage.width = width;
rawimage.height = height;
rawimage.size = getSize();
rawimage.data = data;
rawimage.format = format;
auto module = dynamic_cast<Image *>(Module::getInstance<love::image::Image>(Module::M_IMAGE));
if (module == nullptr)
throw love::Exception("love.image must be loaded in order to encode an ImageData.");
for (FormatHandler *handler : module->getFormatHandlers())
{
if (handler->canEncode(format, encodedFormat))
{
encoder = handler;
break;
}
}
if (encoder != nullptr)
{
thread::Lock lock(mutex);
encodedimage = encoder->encode(rawimage, encodedFormat);
}
if (encoder == nullptr || encodedimage.data == nullptr)
{
const char *fname = "unknown";
love::getConstant(format, fname);
throw love::Exception("No suitable image encoder for %s format.", fname);
}
love::filesystem::FileData *filedata = nullptr;
try
{
filedata = new love::filesystem::FileData(encodedimage.size, filename);
}
catch (love::Exception &)
{
encoder->free(encodedimage.data);
throw;
}
memcpy(filedata->getData(), encodedimage.data, encodedimage.size);
encoder->free(encodedimage.data);
if (writefile)
{
auto fs = Module::getInstance<filesystem::Filesystem>(Module::M_FILESYSTEM);
if (fs == nullptr)
{
filedata->release();
throw love::Exception("love.filesystem must be loaded in order to write an encoded ImageData to a file.");
}
try
{
fs->write(filename, filedata->getData(), filedata->getSize());
}
catch (love::Exception &)
{
filedata->release();
throw;
}
}
return filedata;
}
} // magpie
} // image
} // love
-70
View File
@@ -1,70 +0,0 @@
/**
* Copyright (c) 2006-2017 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_IMAGE_DATA_H
#define LOVE_IMAGE_MAGPIE_IMAGE_DATA_H
// LOVE
#include "FormatHandler.h"
#include "image/ImageData.h"
// C++
#include <list>
namespace love
{
namespace image
{
namespace magpie
{
class ImageData : public love::image::ImageData
{
public:
ImageData(love::filesystem::FileData *data);
ImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8);
ImageData(int width, int height, PixelFormat format, void *data, bool own);
ImageData(const ImageData &c);
virtual ~ImageData();
// Implements image::ImageData.
virtual love::image::ImageData *clone() const;
virtual love::filesystem::FileData *encode(EncodedFormat encodedFormat, const char *filename, bool writefile);
private:
// Create imagedata. Initialize with data if not null.
void create(int width, int height, PixelFormat format, void *data = nullptr);
// Decode and load an encoded format.
void decode(love::filesystem::FileData *data);
// The format handler that was used to decode the ImageData. We need to know
// this so we can properly delete memory allocated by the decoder.
StrongRef<FormatHandler> decodeHandler;
}; // ImageData
} // magpie
} // image
} // love
#endif // LOVE_IMAGE_MAGPIE_IMAGE_DATA_H
+4 -4
View File
@@ -297,7 +297,7 @@ bool KTXHandler::canParse(const filesystem::FileData *data)
return true; return true;
} }
StrongRef<CompressedImageData::Memory> KTXHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedImageData::Slice>> &images, PixelFormat &format, bool &sRGB) StrongRef<CompressedMemory> KTXHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedSlice>> &images, PixelFormat &format, bool &sRGB)
{ {
if (!canParse(filedata)) if (!canParse(filedata))
throw love::Exception("Could not decode compressed data (not a KTX file?)"); throw love::Exception("Could not decode compressed data (not a KTX file?)");
@@ -353,8 +353,8 @@ StrongRef<CompressedImageData::Memory> KTXHandler::parse(filesystem::FileData *f
fileoffset += mipsizepadded; fileoffset += mipsizepadded;
} }
StrongRef<CompressedImageData::Memory> memory; StrongRef<CompressedMemory> memory;
memory.set(new CompressedImageData::Memory(totalsize), Acquire::NORETAIN); memory.set(new CompressedMemory(totalsize), Acquire::NORETAIN);
// Reset the file offset to the start of the file's image data. // Reset the file offset to the start of the file's image data.
fileoffset = sizeof(KTXHeader) + header.bytesOfKeyValueData; fileoffset = sizeof(KTXHeader) + header.bytesOfKeyValueData;
@@ -377,7 +377,7 @@ StrongRef<CompressedImageData::Memory> KTXHandler::parse(filesystem::FileData *f
memcpy(memory->data + dataoffset, filebytes + fileoffset, mipsize); memcpy(memory->data + dataoffset, filebytes + fileoffset, mipsize);
auto slice = new CompressedImageData::Slice(cformat, width, height, memory, dataoffset, mipsize); auto slice = new CompressedSlice(cformat, width, height, memory, dataoffset, mipsize);
images.push_back(slice); images.push_back(slice);
slice->release(); slice->release();
+4 -7
View File
@@ -18,11 +18,10 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_KTX_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_KTX_HANDLER_H
#include "common/config.h" #include "common/config.h"
#include "CompressedFormatHandler.h" #include "image/CompressedFormatHandler.h"
namespace love namespace love
{ {
@@ -43,8 +42,8 @@ public:
// Implements CompressedFormatHandler. // Implements CompressedFormatHandler.
bool canParse(const filesystem::FileData *data) override; bool canParse(const filesystem::FileData *data) override;
StrongRef<CompressedImageData::Memory> parse(filesystem::FileData *filedata, StrongRef<CompressedMemory> parse(filesystem::FileData *filedata,
std::vector<StrongRef<CompressedImageData::Slice>> &images, std::vector<StrongRef<CompressedSlice>> &images,
PixelFormat &format, bool &sRGB) override; PixelFormat &format, bool &sRGB) override;
}; // KTXHandler }; // KTXHandler
@@ -52,5 +51,3 @@ public:
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_KTX_HANDLER_H
+4 -4
View File
@@ -113,7 +113,7 @@ bool PKMHandler::canParse(const filesystem::FileData *data)
return true; return true;
} }
StrongRef<CompressedImageData::Memory> PKMHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedImageData::Slice>> &images, PixelFormat &format, bool &sRGB) StrongRef<CompressedMemory> PKMHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedSlice>> &images, PixelFormat &format, bool &sRGB)
{ {
if (!canParse(filedata)) if (!canParse(filedata))
throw love::Exception("Could not decode compressed data (not a PKM file?)"); throw love::Exception("Could not decode compressed data (not a PKM file?)");
@@ -134,8 +134,8 @@ StrongRef<CompressedImageData::Memory> PKMHandler::parse(filesystem::FileData *f
// The rest of the file after the header is all texture data. // The rest of the file after the header is all texture data.
size_t totalsize = filedata->getSize() - sizeof(PKMHeader); size_t totalsize = filedata->getSize() - sizeof(PKMHeader);
StrongRef<CompressedImageData::Memory> memory; StrongRef<CompressedMemory> memory;
memory.set(new CompressedImageData::Memory(totalsize), Acquire::NORETAIN); memory.set(new CompressedMemory(totalsize), Acquire::NORETAIN);
// PKM files only store a single mipmap level. // PKM files only store a single mipmap level.
memcpy(memory->data, (uint8 *) filedata->getData() + sizeof(PKMHeader), totalsize); memcpy(memory->data, (uint8 *) filedata->getData() + sizeof(PKMHeader), totalsize);
@@ -145,7 +145,7 @@ StrongRef<CompressedImageData::Memory> PKMHandler::parse(filesystem::FileData *f
int width = header.widthBig; int width = header.widthBig;
int height = header.heightBig; int height = header.heightBig;
images.emplace_back(new CompressedImageData::Slice(cformat, width, height, memory, 0, totalsize), Acquire::NORETAIN); images.emplace_back(new CompressedSlice(cformat, width, height, memory, 0, totalsize), Acquire::NORETAIN);
format = cformat; format = cformat;
sRGB = false; sRGB = false;
+4 -7
View File
@@ -18,11 +18,10 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_PKM_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_PKM_HANDLER_H
#include "common/config.h" #include "common/config.h"
#include "CompressedFormatHandler.h" #include "image/CompressedFormatHandler.h"
namespace love namespace love
{ {
@@ -43,8 +42,8 @@ public:
// Implements CompressedFormatHandler. // Implements CompressedFormatHandler.
bool canParse(const filesystem::FileData *data) override; bool canParse(const filesystem::FileData *data) override;
StrongRef<CompressedImageData::Memory> parse(filesystem::FileData *filedata, StrongRef<CompressedMemory> parse(filesystem::FileData *filedata,
std::vector<StrongRef<CompressedImageData::Slice>> &images, std::vector<StrongRef<CompressedSlice>> &images,
PixelFormat &format, bool &sRGB) override; PixelFormat &format, bool &sRGB) override;
}; // PKMHandler }; // PKMHandler
@@ -52,5 +51,3 @@ public:
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_PKM_HANDLER_H
+3 -3
View File
@@ -140,9 +140,9 @@ bool PNGHandler::canDecode(love::filesystem::FileData *data)
return status == 0 && width > 0 && height > 0; 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); && (rawFormat == PIXELFORMAT_RGBA8 || rawFormat == PIXELFORMAT_RGBA16);
} }
@@ -199,7 +199,7 @@ PNGHandler::DecodedImage PNGHandler::decode(love::filesystem::FileData *fdata)
return img; 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)) if (!canEncode(img.format, encodedFormat))
throw love::Exception("PNG encoder cannot encode to non-PNG format."); throw love::Exception("PNG encoder cannot encode to non-PNG format.");
+4 -7
View File
@@ -18,11 +18,10 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_PNG_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_PNG_HANDLER_H
// LOVE // LOVE
#include "FormatHandler.h" #include "image/FormatHandler.h"
namespace love namespace love
{ {
@@ -41,10 +40,10 @@ public:
// Implements FormatHandler. // Implements FormatHandler.
virtual bool canDecode(love::filesystem::FileData *data); virtual bool canDecode(love::filesystem::FileData *data);
virtual bool canEncode(PixelFormat rawFormat, ImageData::EncodedFormat encodedFormat); virtual bool canEncode(PixelFormat rawFormat, EncodedFormat encodedFormat);
virtual DecodedImage decode(love::filesystem::FileData *data); virtual DecodedImage decode(love::filesystem::FileData *data);
virtual EncodedImage encode(const DecodedImage &img, ImageData::EncodedFormat format); virtual EncodedImage encode(const DecodedImage &img, EncodedFormat format);
virtual void free(unsigned char *mem); virtual void free(unsigned char *mem);
@@ -53,5 +52,3 @@ public:
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_PNG_HANDLER_H
+4 -4
View File
@@ -474,7 +474,7 @@ bool PVRHandler::canParse(const filesystem::FileData *data)
return false; return false;
} }
StrongRef<CompressedImageData::Memory> PVRHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedImageData::Slice>> &images, PixelFormat &format, bool &sRGB) StrongRef<CompressedMemory> PVRHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedSlice>> &images, PixelFormat &format, bool &sRGB)
{ {
if (!canParse(filedata)) if (!canParse(filedata))
throw love::Exception("Could not decode compressed data (not a PVR file?)"); throw love::Exception("Could not decode compressed data (not a PVR file?)");
@@ -524,8 +524,8 @@ StrongRef<CompressedImageData::Memory> PVRHandler::parse(filesystem::FileData *f
if (filedata->getSize() < fileoffset + totalsize) if (filedata->getSize() < fileoffset + totalsize)
throw love::Exception("Could not parse PVR file: invalid size calculation."); throw love::Exception("Could not parse PVR file: invalid size calculation.");
StrongRef<CompressedImageData::Memory> memory; StrongRef<CompressedMemory> memory;
memory.set(new CompressedImageData::Memory(totalsize), Acquire::NORETAIN); memory.set(new CompressedMemory(totalsize), Acquire::NORETAIN);
size_t curoffset = 0; size_t curoffset = 0;
const uint8 *filebytes = (uint8 *) filedata->getData() + fileoffset; const uint8 *filebytes = (uint8 *) filedata->getData() + fileoffset;
@@ -542,7 +542,7 @@ StrongRef<CompressedImageData::Memory> PVRHandler::parse(filesystem::FileData *f
memcpy(memory->data + curoffset, filebytes + curoffset, mipsize); memcpy(memory->data + curoffset, filebytes + curoffset, mipsize);
auto slice = new CompressedImageData::Slice(cformat, width, height, memory, curoffset, mipsize); auto slice = new CompressedSlice(cformat, width, height, memory, curoffset, mipsize);
images.push_back(slice); images.push_back(slice);
slice->release(); slice->release();
+4 -7
View File
@@ -18,12 +18,11 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_PVR_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_PVR_HANDLER_H
// LOVE // LOVE
#include "common/config.h" #include "common/config.h"
#include "CompressedFormatHandler.h" #include "image/CompressedFormatHandler.h"
namespace love namespace love
{ {
@@ -41,8 +40,8 @@ public:
// Implements CompressedFormatHandler. // Implements CompressedFormatHandler.
bool canParse(const filesystem::FileData *data) override; bool canParse(const filesystem::FileData *data) override;
StrongRef<CompressedImageData::Memory> parse(filesystem::FileData *filedata, StrongRef<CompressedMemory> parse(filesystem::FileData *filedata,
std::vector<StrongRef<CompressedImageData::Slice>> &images, std::vector<StrongRef<CompressedSlice>> &images,
PixelFormat &format, bool &sRGB) override; PixelFormat &format, bool &sRGB) override;
}; // PVRHandler }; // PVRHandler
@@ -50,5 +49,3 @@ public:
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_PVR_HANDLER_H
+4 -3
View File
@@ -20,6 +20,7 @@
// LOVE // LOVE
#include "STBHandler.h" #include "STBHandler.h"
#include "image/ImageData.h"
static void loveSTBIAssert(bool test, const char *teststr) 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; 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) FormatHandler::DecodedImage STBHandler::decode(love::filesystem::FileData *data)
@@ -97,7 +98,7 @@ FormatHandler::DecodedImage STBHandler::decode(love::filesystem::FileData *data)
return img; 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)) if (!canEncode(img.format, encodedFormat))
throw love::Exception("Invalid format."); throw love::Exception("Invalid format.");
+8 -11
View File
@@ -18,10 +18,9 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_STB_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_STB_HANDLER_H
#include "FormatHandler.h" #include "image/FormatHandler.h"
namespace love namespace love
{ {
@@ -37,24 +36,22 @@ namespace magpie
* We could use stb_image to decode PNG as well, but performance and * We could use stb_image to decode PNG as well, but performance and
* comprehensive format support is lacking compared to some alternatives. * comprehensive format support is lacking compared to some alternatives.
**/ **/
class STBHandler : public FormatHandler class STBHandler final : public FormatHandler
{ {
public: public:
// Implements FormatHandler. // Implements FormatHandler.
virtual bool canDecode(love::filesystem::FileData *data); bool canDecode(love::filesystem::FileData *data) override;
virtual bool canEncode(PixelFormat rawFormat, ImageData::EncodedFormat encodedFormat); bool canEncode(PixelFormat rawFormat, EncodedFormat encodedFormat) override;
virtual DecodedImage decode(love::filesystem::FileData *data); DecodedImage decode(love::filesystem::FileData *data) override;
virtual EncodedImage encode(const DecodedImage &img, ImageData::EncodedFormat format); EncodedImage encode(const DecodedImage &img, EncodedFormat format) override;
virtual void free(unsigned char *mem); void free(unsigned char *mem) override;
}; // STBHandler }; // STBHandler
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_STB_HANDLER_H
+4 -4
View File
@@ -32,7 +32,7 @@ bool DDSHandler::canParse(const filesystem::FileData *data)
return dds::isCompressedDDS(data->getData(), data->getSize()); return dds::isCompressedDDS(data->getData(), data->getSize());
} }
StrongRef<CompressedImageData::Memory> DDSHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedImageData::Slice>> &images, PixelFormat &format, bool &sRGB) StrongRef<CompressedMemory> DDSHandler::parse(filesystem::FileData *filedata, std::vector<StrongRef<CompressedSlice>> &images, PixelFormat &format, bool &sRGB)
{ {
if (!dds::isDDS(filedata->getData(), filedata->getSize())) if (!dds::isDDS(filedata->getData(), filedata->getSize()))
throw love::Exception("Could not decode compressed data (not a DDS file?)"); throw love::Exception("Could not decode compressed data (not a DDS file?)");
@@ -40,7 +40,7 @@ StrongRef<CompressedImageData::Memory> DDSHandler::parse(filesystem::FileData *f
PixelFormat texformat = PIXELFORMAT_UNKNOWN; PixelFormat texformat = PIXELFORMAT_UNKNOWN;
bool isSRGB = false; bool isSRGB = false;
StrongRef<CompressedImageData::Memory> memory; StrongRef<CompressedMemory> memory;
size_t dataSize = 0; size_t dataSize = 0;
images.clear(); images.clear();
@@ -63,7 +63,7 @@ StrongRef<CompressedImageData::Memory> DDSHandler::parse(filesystem::FileData *f
dataSize += img->dataSize; dataSize += img->dataSize;
} }
memory.set(new CompressedImageData::Memory(dataSize), Acquire::NORETAIN); memory.set(new CompressedMemory(dataSize), Acquire::NORETAIN);
size_t dataOffset = 0; size_t dataOffset = 0;
@@ -76,7 +76,7 @@ StrongRef<CompressedImageData::Memory> DDSHandler::parse(filesystem::FileData *f
// Copy the mipmap image from the FileData to our block of memory. // Copy the mipmap image from the FileData to our block of memory.
memcpy(memory->data + dataOffset, img->data, img->dataSize); memcpy(memory->data + dataOffset, img->data, img->dataSize);
auto slice = new CompressedImageData::Slice(texformat, img->width, img->height, memory, dataOffset, img->dataSize); auto slice = new CompressedSlice(texformat, img->width, img->height, memory, dataOffset, img->dataSize);
images.emplace_back(slice, Acquire::NORETAIN); images.emplace_back(slice, Acquire::NORETAIN);
dataOffset += img->dataSize; dataOffset += img->dataSize;
+4 -7
View File
@@ -18,11 +18,10 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_IMAGE_MAGPIE_DDS_HANDLER_H #pragma once
#define LOVE_IMAGE_MAGPIE_DDS_HANDLER_H
// LOVE // LOVE
#include "CompressedFormatHandler.h" #include "image/CompressedFormatHandler.h"
// dds parser // dds parser
#include "ddsparse/ddsparse.h" #include "ddsparse/ddsparse.h"
@@ -49,8 +48,8 @@ public:
// Implements CompressedFormatHandler. // Implements CompressedFormatHandler.
bool canParse(const filesystem::FileData *data) override; bool canParse(const filesystem::FileData *data) override;
StrongRef<CompressedImageData::Memory> parse(filesystem::FileData *filedata, StrongRef<CompressedMemory> parse(filesystem::FileData *filedata,
std::vector<StrongRef<CompressedImageData::Slice>> &images, std::vector<StrongRef<CompressedSlice>> &images,
PixelFormat &format, bool &sRGB) override; PixelFormat &format, bool &sRGB) override;
private: private:
@@ -62,5 +61,3 @@ private:
} // magpie } // magpie
} // image } // image
} // love } // love
#endif // LOVE_IMAGE_MAGPIE_DDS_HANDLER_H
+2 -2
View File
@@ -23,7 +23,7 @@
#include "common/Data.h" #include "common/Data.h"
#include "common/StringMap.h" #include "common/StringMap.h"
#include "magpie/Image.h" #include "Image.h"
#include "filesystem/wrap_Filesystem.h" #include "filesystem/wrap_Filesystem.h"
@@ -154,7 +154,7 @@ extern "C" int luaopen_love_image(lua_State *L)
Image *instance = instance(); Image *instance = instance();
if (instance == nullptr) if (instance == nullptr)
{ {
luax_catchexcept(L, [&](){ instance = new love::image::magpie::Image(); }); luax_catchexcept(L, [&](){ instance = new love::image::Image(); });
} }
else else
instance->retain(); instance->retain();
+1 -1
View File
@@ -262,7 +262,7 @@ int w_ImageData_encode(lua_State *L)
{ {
ImageData *t = luax_checkimagedata(L, 1); ImageData *t = luax_checkimagedata(L, 1);
ImageData::EncodedFormat format; FormatHandler::EncodedFormat format;
const char *fmt = luaL_checkstring(L, 2); const char *fmt = luaL_checkstring(L, 2);
if (!ImageData::getConstant(fmt, format)) if (!ImageData::getConstant(fmt, format))
return luaL_error(L, "Invalid encoded image format '%s'.", fmt); return luaL_error(L, "Invalid encoded image format '%s'.", fmt);