This commit is contained in:
Branimir Karadžić
2017-04-04 18:00:05 -07:00
parent 342b0ed11f
commit 00bc99f7e8
8 changed files with 94 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
Maratis Tiny C library
Maratis Tiny C library
Copyright (c) 2015 Anael Seghezzi <www.maratis3d.com>
This software is provided 'as-is', without any express or implied
@@ -19,4 +19,4 @@ Copyright (c) 2015 Anael Seghezzi <www.maratis3d.com>
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.

View File

@@ -1,3 +1,9 @@
#if defined(_MSC_VER)
# pragma warning(disable:4244) // warning C4244: '=': conversion from 'int' to 'stbi__uint16', possible loss of data
# pragma warning(disable:4245) // warning C4245: 'argument': conversion from 'int' to 'char', signed/unsigned mismatch
# pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration
#endif
/* stb_image - v2.15 - public domain image loader - http://nothings.org/stb_image.h
no warranty implied; use at your own risk

View File

@@ -792,6 +792,8 @@ namespace miniz {
defined(i386) || defined(__ia64__) || defined(__x86_64__)
// MINIZ_X86_OR_X64_CPU is only used to help set the below macros.
#define MINIZ_X86_OR_X64_CPU 1
#else
#define MINIZ_X86_OR_X64_CPU 0
#endif
#if defined(__sparcv9)
@@ -803,7 +805,7 @@ namespace miniz {
#endif
#endif
#if MINIZ_X86_OR_X64_CPU
#if 1 // MINIZ_X86_OR_X64_CPU
// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient
// integer loads and stores from unaligned addresses.
//#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
@@ -10452,7 +10454,7 @@ static void ReconstructLineOffsets(std::vector<tinyexr::tinyexr_uint64> *offsets
tinyexr::swap4(reinterpret_cast<unsigned int *>(&data_len));
(*offsets)[i] = offset;
marker += data_len + 8; // 8 = 4 bytes(y) + 4 bytes(data_len)
}
}
@@ -10797,7 +10799,7 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header,
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
#ifdef _WIN32
#if 0 //def _WIN32
FILE *fp = NULL;
fopen_s(&fp, filename, "rb");
#else
@@ -11381,7 +11383,7 @@ int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header,
}
#endif
#ifdef _WIN32
#if 0 //def _WIN32
FILE *fp = NULL;
fopen_s(&fp, filename, "wb");
#else
@@ -11859,7 +11861,7 @@ int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version,
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
#ifdef _WIN32
#if 0 //def _WIN32
FILE *fp = NULL;
fopen_s(&fp, filename, "rb");
#else
@@ -11983,7 +11985,7 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers,
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
#ifdef _WIN32
#if 0 //def _WIN32
FILE *fp = NULL;
fopen_s(&fp, filename, "rb");
#else
@@ -12083,7 +12085,7 @@ int ParseEXRVersionFromFile(EXRVersion *version, const char *filename) {
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
#ifdef _WIN32
#if 0 //def _WIN32
FILE *fp = NULL;
fopen_s(&fp, filename, "rb");
#else
@@ -12214,7 +12216,7 @@ int LoadEXRMultipartImageFromFile(EXRImage *exr_images,
return TINYEXR_ERROR_INVALID_ARGUMENT;
}
#ifdef _WIN32
#if 0 //def _WIN32
FILE *fp = NULL;
fopen_s(&fp, filename, "rb");
#else

View File

@@ -21,62 +21,3 @@ project "bimg"
}
configuration {}
project "bimg_decode"
kind "StaticLib"
includedirs {
path.join(BX_DIR, "include"),
path.join(BIMG_DIR, "include"),
path.join(BIMG_DIR, "3rdparty"),
path.join(BIMG_DIR, "3rdparty/nvtt"),
path.join(BIMG_DIR, "3rdparty/iqa/include"),
}
files {
path.join(BIMG_DIR, "src/image_decode.*"),
}
configuration { "linux-*" }
buildoptions {
"-fPIC",
}
configuration {}
project "bimg_encode"
kind "StaticLib"
includedirs {
path.join(BX_DIR, "include"),
path.join(BIMG_DIR, "include"),
path.join(BIMG_DIR, "3rdparty"),
path.join(BIMG_DIR, "3rdparty/nvtt"),
path.join(BIMG_DIR, "3rdparty/iqa/include"),
}
files {
path.join(BIMG_DIR, "src/image_encode.*"),
path.join(BIMG_DIR, "3rdparty/libsquish/**.cpp"),
path.join(BIMG_DIR, "3rdparty/libsquish/**.h"),
path.join(BIMG_DIR, "3rdparty/edtaa3/**.cpp"),
path.join(BIMG_DIR, "3rdparty/edtaa3/**.h"),
path.join(BIMG_DIR, "3rdparty/etc1/**.cpp"),
path.join(BIMG_DIR, "3rdparty/etc1/**.h"),
path.join(BIMG_DIR, "3rdparty/etc2/**.cpp"),
path.join(BIMG_DIR, "3rdparty/etc2/**.hpp"),
path.join(BIMG_DIR, "3rdparty/nvtt/**.cpp"),
path.join(BIMG_DIR, "3rdparty/nvtt/**.h"),
path.join(BIMG_DIR, "3rdparty/pvrtc/**.cpp"),
path.join(BIMG_DIR, "3rdparty/pvrtc/**.h"),
path.join(BIMG_DIR, "3rdparty/tinyexr/**.h"),
path.join(BIMG_DIR, "3rdparty/iqa/include/**.h"),
path.join(BIMG_DIR, "3rdparty/iqa/source/**.c"),
}
configuration { "linux-*" }
buildoptions {
"-fPIC",
}
configuration {}

26
scripts/bimg_decode.lua Normal file
View File

@@ -0,0 +1,26 @@
--
-- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
--
project "bimg_decode"
kind "StaticLib"
includedirs {
path.join(BX_DIR, "include"),
path.join(BIMG_DIR, "include"),
path.join(BIMG_DIR, "3rdparty"),
path.join(BIMG_DIR, "3rdparty/nvtt"),
path.join(BIMG_DIR, "3rdparty/iqa/include"),
}
files {
path.join(BIMG_DIR, "src/image_decode.*"),
}
configuration { "linux-*" }
buildoptions {
"-fPIC",
}
configuration {}

41
scripts/bimg_encode.lua Normal file
View File

@@ -0,0 +1,41 @@
--
-- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
--
project "bimg_encode"
kind "StaticLib"
includedirs {
path.join(BX_DIR, "include"),
path.join(BIMG_DIR, "include"),
path.join(BIMG_DIR, "3rdparty"),
path.join(BIMG_DIR, "3rdparty/nvtt"),
path.join(BIMG_DIR, "3rdparty/iqa/include"),
}
files {
path.join(BIMG_DIR, "src/image_encode.*"),
path.join(BIMG_DIR, "3rdparty/libsquish/**.cpp"),
path.join(BIMG_DIR, "3rdparty/libsquish/**.h"),
path.join(BIMG_DIR, "3rdparty/edtaa3/**.cpp"),
path.join(BIMG_DIR, "3rdparty/edtaa3/**.h"),
path.join(BIMG_DIR, "3rdparty/etc1/**.cpp"),
path.join(BIMG_DIR, "3rdparty/etc1/**.h"),
path.join(BIMG_DIR, "3rdparty/etc2/**.cpp"),
path.join(BIMG_DIR, "3rdparty/etc2/**.hpp"),
path.join(BIMG_DIR, "3rdparty/nvtt/**.cpp"),
path.join(BIMG_DIR, "3rdparty/nvtt/**.h"),
path.join(BIMG_DIR, "3rdparty/pvrtc/**.cpp"),
path.join(BIMG_DIR, "3rdparty/pvrtc/**.h"),
path.join(BIMG_DIR, "3rdparty/tinyexr/**.h"),
path.join(BIMG_DIR, "3rdparty/iqa/include/**.h"),
path.join(BIMG_DIR, "3rdparty/iqa/source/**.c"),
}
configuration { "linux-*" }
buildoptions {
"-fPIC",
}
configuration {}

View File

@@ -65,6 +65,8 @@ end
group "libs"
dofile "bimg.lua"
dofile "bimg_decode.lua"
dofile "bimg_encode.lua"
dofile(path.join(BX_DIR, "scripts/bx.lua"))

View File

@@ -5,14 +5,19 @@
#include "bimg_p.h"
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-function")
BX_PRAGMA_DIAGNOSTIC_PUSH()
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wtype-limits")
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-parameter")
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-value")
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wdeprecated-declarations")
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4100) // error C4100: '' : unreferenced formal parameter
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4505) // warning C4505: 'tinyexr::miniz::def_realloc_func': unreferenced local function has been removed
#if BX_PLATFORM_EMSCRIPTEN
# include <compat/ctype.h>
#endif // BX_PLATFORM_EMSCRIPTEN
#define MINIZ_NO_ARCHIVE_APIS
#define MINIZ_NO_STDIO
#define TINYEXR_IMPLEMENTATION
#include <tinyexr/tinyexr.h>
@@ -48,6 +53,7 @@ BX_PRAGMA_DIAGNOSTIC_PUSH();
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wmissing-field-initializers");
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wshadow");
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wint-to-pointer-cast")
BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Warray-bounds");
#if BX_COMPILER_GCC >= 60000
BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wmisleading-indentation");
BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wshift-negative-value");