[poppler] Branch 'poppler-0.18' - cmake/modules config.h.cmake configure.ac poppler/JPEG2000Stream.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu Jan 26 15:38:47 PST 2012
cmake/modules/FindLIBOPENJPEG.cmake | 13 +++++++++++++
config.h.cmake | 3 +++
configure.ac | 8 ++++++++
poppler/JPEG2000Stream.cc | 7 ++++++-
4 files changed, 30 insertions(+), 1 deletion(-)
New commits:
commit de6415af1a39ec7dfa4f149c6c5e311b86352cec
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Jan 27 00:36:18 2012 +0100
Set OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG if you have it
Fixes/workarounds bug 43414 with openjpeg 1.5 (unreleased)
diff --git a/cmake/modules/FindLIBOPENJPEG.cmake b/cmake/modules/FindLIBOPENJPEG.cmake
index 978ee7d..ab1721d 100644
--- a/cmake/modules/FindLIBOPENJPEG.cmake
+++ b/cmake/modules/FindLIBOPENJPEG.cmake
@@ -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)
diff --git a/config.h.cmake b/config.h.cmake
index cae2e71..7dcb1f7 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -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 */
diff --git a/configure.ac b/configure.ac
index 3890690..23061b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,6 +168,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)
diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
index b7a29bf..5ea6406 100644
--- a/poppler/JPEG2000Stream.cc
+++ b/poppler/JPEG2000Stream.cc
@@ -4,7 +4,7 @@
//
// A JPX stream decoder using OpenJPEG
//
-// Copyright 2008-2010 Albert Astals Cid <aacid at kde.org>
+// Copyright 2008-2010, 2012 Albert Astals Cid <aacid at kde.org>
// Copyright 2011 Daniel Glöckner <daniel-gl at 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(¶meters);
+#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;
More information about the poppler
mailing list