-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace usage of SOIL with libpng #6291
Conversation
It seems like the Ubuntu buildbot needs an updated version of libpng before this will build correctly. |
Source/Core/Common/Common.vcxproj
Outdated
@@ -123,6 +123,7 @@ | |||
<ClInclude Include="GL\GLUtil.h" /> | |||
<ClInclude Include="Hash.h" /> | |||
<ClInclude Include="HttpRequest.h" /> | |||
<ClInclude Include="Image.h" /> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/Image.cpp
Outdated
|
||
namespace Common | ||
{ | ||
static inline int MultiplyAlpha(int alpha, int color) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/Image.cpp
Outdated
#include <png.h> | ||
#include <vector> | ||
|
||
#include <Common/CommonTypes.h> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
return ((temp + (temp >> 8)) >> 8); | ||
} | ||
|
||
static void PremultiplyData(png_structp png, png_row_infop row_info, png_bytep data) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/Image.cpp
Outdated
|
||
static void ReadCallback(png_structp png, png_bytep data, png_size_t size) | ||
{ | ||
ReadProgress* progress = reinterpret_cast<ReadProgress*>(png_get_io_ptr(png)); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/Image.cpp
Outdated
const size_t stride = width * 4; | ||
data_out->resize(stride * height); | ||
|
||
png_byte** row_pointers = reinterpret_cast<png_byte**>(malloc(height * sizeof(png_byte*))); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/Image.h
Outdated
|
||
#include <vector> | ||
|
||
#include <Common/CommonTypes.h> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
// "warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable" | ||
#endif | ||
|
||
bool LoadPNG(const std::vector<u8>& input, std::vector<u8>* data_out, u32* width_out, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
check_lib(SOIL "(no .pc for SOIL)" SOIL SOIL/SOIL.h QUIET) | ||
endif() | ||
if(SOIL_FOUND) | ||
message(STATUS "Using shared SOIL") |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/Image.cpp
Outdated
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include <Common/Image.h> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/Image.cpp
Outdated
for (size_t i = 0; i < size; ++i) | ||
{ | ||
if (progress->current >= progress->end) | ||
png_error(png, "Read beyond end of file"); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
9db8042
to
0107d56
Compare
I've added workarounds for the issues that we had with pre-1.5 libpng. This should now be mergeable without having to update the Ubuntu buildbot. |
Source/Core/Common/CMakeLists.txt
Outdated
@@ -137,6 +138,8 @@ elseif(USE_X11) | |||
target_link_libraries(common PUBLIC ${XRANDR_LIBRARIES}) | |||
endif() | |||
|
|||
list(APPEND LIBS png ${PNG_LIBRARIES}) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This is a rebased and improved version of PR #4575. Just like that PR, it replaces the usage of SOIL in the custom texture loading code with libpng, and then removes SOIL from Dolphin entirely. But unlike when that PR was made, we now have the ability to load DDS textures without SOIL thanks to PR #5279, so the formats that are supported after this PR are PNG and DDS. Practically every texture pack only uses those two file types, and those two file types are the only file types that Ishiiruka supports.
For reasons to stop using SOIL, see PR #2163 (including the comments) and issue 9686.