Image: Swap stb for libpng/libjpeg

This commit is contained in:
Stenzek
2024-03-06 16:24:25 +10:00
parent e9c4416272
commit c854b8f85e
19 changed files with 270 additions and 12288 deletions
-2
View File
@@ -1,8 +1,6 @@
set(FMT_INSTALL OFF CACHE BOOL "")
add_subdirectory(fmt EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(fmt)
add_subdirectory(stb EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(stb)
add_subdirectory(minizip EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(minizip)
add_subdirectory(lzma EXCLUDE_FROM_ALL)
-13
View File
@@ -1,13 +0,0 @@
set(SRCS
include/stb_image.h
include/stb_image_resize.h
include/stb_image_write.h
src/stb_image.c
src/stb_image_resize.c
src/stb_image_write.c
)
add_library(stb ${SRCS})
target_include_directories(stb PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_include_directories(stb INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(stb ZLIB::ZLIB Threads::Threads "${CMAKE_DL_LIBS}")
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-2
View File
@@ -1,2 +0,0 @@
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
-2
View File
@@ -1,2 +0,0 @@
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "stb_image_resize.h"
-28
View File
@@ -1,28 +0,0 @@
#include <stdlib.h>
#include "zlib.h"
// https://github.com/nothings/stb/issues/113
static unsigned char* compress_for_stbiw(unsigned char* data, int data_len, int* out_len, int quality)
{
uLongf buf_size = compressBound(data_len);
// note that buf will be free'd by stb_image_write.h
// with STBIW_FREE() (plain free() by default)
unsigned char* buf = malloc(buf_size);
if (buf == NULL)
return NULL;
if (compress2(buf, &buf_size, data, data_len, quality) != Z_OK)
{
free(buf);
return NULL;
}
*out_len = buf_size;
return buf;
}
#define STBIW_ZLIB_COMPRESS compress_for_stbiw
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
-30
View File
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\msvc\vsprops\Configurations.props" />
<ItemGroup>
<ClCompile Include="src\stb_image.c" />
<ClCompile Include="src\stb_image_resize.c" />
<ClCompile Include="src\stb_image_write.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\stb_image.h" />
<ClInclude Include="include\stb_image_resize.h" />
<ClInclude Include="include\stb_image_write.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{ED601289-AC1A-46B8-A8ED-17DB9EB73423}</ProjectGuid>
</PropertyGroup>
<Import Project="..\msvc\vsprops\StaticLibrary.props" />
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<AdditionalIncludeDirectories>$(SolutionDir)dep\zlib\include;$(ProjectDir)include;$(ProjectDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="..\msvc\vsprops\Targets.props" />
</Project>
-13
View File
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\stb_image_write.c" />
<ClCompile Include="src\stb_image_resize.c" />
<ClCompile Include="src\stb_image.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\stb_image_write.h" />
<ClInclude Include="include\stb_image_resize.h" />
<ClInclude Include="include\stb_image.h" />
</ItemGroup>
</Project>