forked from Mirrors/openclonk
Fix dedicated: Load JPEG surfaces so the texture shape information can be correctly generated
parent
63cc42e967
commit
64dd72c380
|
@ -234,17 +234,17 @@ endif()
|
|||
|
||||
SET(JPEG_NAMES ${JPEG_NAMES} libjpeg jpeg-static)
|
||||
if(NOT HEADLESS_ONLY)
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(Freetype REQUIRED)
|
||||
include_directories(
|
||||
${JPEG_INCLUDE_DIR}
|
||||
${FREETYPE_INCLUDE_DIRS})
|
||||
link_directories(
|
||||
${FREETYPE_LIBRARY_DIRS})
|
||||
endif()
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories(
|
||||
${JPEG_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIR}
|
||||
${ZLIB_INCLUDE_DIR})
|
||||
if(CMAKE_SYSTEM MATCHES "Windows")
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
/* Extension to C4Surface that handles bitmaps in C4Group files */
|
||||
|
||||
#include "C4Include.h"
|
||||
#include "C4ForbidLibraryCompilation.h"
|
||||
#include "graphics/C4Surface.h"
|
||||
|
||||
#include "c4group/C4GroupSet.h"
|
||||
|
@ -229,8 +228,6 @@ bool C4Surface::SavePNG(C4Group &hGroup, const char *szFilename, bool fSaveAlpha
|
|||
|
||||
/* JPEG loading */
|
||||
|
||||
#ifndef USE_CONSOLE
|
||||
|
||||
// Some distributions ship jpeglib.h with extern "C", others don't - gah.
|
||||
extern "C"
|
||||
{
|
||||
|
@ -360,13 +357,3 @@ bool C4Surface::ReadJPEG(CStdStream &hGroup, int iFlags)
|
|||
// return if successful
|
||||
return true;
|
||||
}
|
||||
|
||||
#else // ifndef USE_CONSOLE
|
||||
|
||||
bool C4Surface::ReadJPEG(CStdStream &, int) {
|
||||
// Dummy surface
|
||||
if (!Create(1, 1)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // USE_CONSOLE
|
||||
|
|
|
@ -45,6 +45,7 @@ bool C4TextureShape::Load(C4Group &group, const char *filename, int32_t base_tex
|
|||
if (!group.LoadEntry(filename, &png_data)) return false;
|
||||
CPNGFile png;
|
||||
if (!png.Load(static_cast<BYTE *>(png_data.getMData()), png_data.getSize())) return false;
|
||||
assert(base_tex_wdt > 0);
|
||||
int32_t zoom = png.iWdt / base_tex_wdt;
|
||||
if (base_tex_wdt * zoom != static_cast<int32_t>(png.iWdt) || base_tex_hgt * zoom != static_cast<int32_t>(png.iHgt))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue