Commit cbe7131e authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Set OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG if you have it

Fixes/workarounds bug 43414 with openjpeg 1.5 (unreleased)
(cherry picked from commit de6415af)
parent 641526d1
......@@ -26,6 +26,19 @@ else (LIBOPENJPEG_LIBRARIES AND LIBOPENJPEG_INCLUDE_DIR)
find_path (LIBOPENJPEG_INCLUDE_DIR openjpeg.h PATH_SUFFIXES openjpeg)
find_library(LIBOPENJPEG_LIBRARIES openjpeg)
if(LIBOPENJPEG_INCLUDE_DIR AND LIBOPENJPEG_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES ${LIBOPENJPEG_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${LIBOPENJPEG_LIBRARIES})
check_cxx_source_compiles("
#include <openjpeg.h>
int main()
{
int foo = OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
return 0;
}
" WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG)
set(LIBOPENJPEG_FOUND TRUE)
endif(LIBOPENJPEG_INCLUDE_DIR AND LIBOPENJPEG_LIBRARIES)
......
......@@ -189,6 +189,9 @@
/* Use win32 font configuration backend */
#cmakedefine WITH_FONTCONFIGURATION_WIN32 1
/* OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag */
#cmakedefine WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG 1
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
......
......@@ -171,6 +171,14 @@ if test x$enable_libopenjpeg = xyes; then
LIBOPENJPEG_LIBS="-lopenjpeg"
AC_SUBST(LIBOPENJPEG_LIBS)
AC_DEFINE(ENABLE_LIBOPENJPEG)
AC_TRY_COMPILE([
#include <openjpeg.h>
], [
int foo = OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
], have_openjpeg_flag="yes", am_cv_proto_iconv_arg1="no")
if test x$have_openjpeg_flag = xyes; then
AC_DEFINE(WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG, 1, [OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag.])
fi
fi
AM_CONDITIONAL(BUILD_LIBOPENJPEG, test x$enable_libopenjpeg = xyes)
......
......@@ -4,7 +4,7 @@
//
// A JPX stream decoder using OpenJPEG
//
// Copyright 2008-2010 Albert Astals Cid <aacid@kde.org>
// Copyright 2008-2010, 2012 Albert Astals Cid <aacid@kde.org>
// Copyright 2011 Daniel Glöckner <daniel-gl@gmx.net>
//
// Licensed under GPLv2 or later
......@@ -13,6 +13,8 @@
#include "JPEG2000Stream.h"
#include "config.h"
JPXStream::JPXStream(Stream *strA) : FilterStream(strA)
{
inited = gFalse;
......@@ -127,6 +129,9 @@ void JPXStream::init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format)
/* Use default decompression parameters */
opj_dparameters_t parameters;
opj_set_default_decoder_parameters(&parameters);
#ifdef WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG
parameters.flags = OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
#endif
/* Configure the event manager to receive errors and warnings */
opj_event_mgr_t event_mgr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment