update to 0.12.0

This is a major update, switches to the 0.12 release branch.
Most notable change is that the color management stuff which we had
as patches in pkgsrc is official now.
Otherwise - many fixes and enhancements.

(while this is a .0 release I've been tracking the 0.11.x snapshots
and release candidate for a while so I don't expect big problems)
This commit is contained in:
drochner 2009-09-09 19:57:05 +00:00
parent 9ada741734
commit 9bdc78f886
22 changed files with 56 additions and 1678 deletions

View file

@ -1,10 +1,9 @@
# $NetBSD: Makefile,v 1.22 2009/08/26 19:56:45 sno Exp $
# $NetBSD: Makefile,v 1.23 2009/09/09 19:57:06 drochner Exp $
#
.include "../../print/poppler/Makefile.common"
PKGNAME= poppler-glib-${POPPLER_VERS}
PKGREVISION= 1
COMMENT= PDF rendering library (GLib wrapper)
MAINTAINER= reed@reedmedia.net

View file

@ -1,11 +1,13 @@
@comment $NetBSD: PLIST,v 1.10 2009/06/14 18:11:58 joerg Exp $
@comment $NetBSD: PLIST,v 1.11 2009/09/09 19:57:06 drochner Exp $
include/poppler/glib/poppler-action.h
include/poppler/glib/poppler-annot.h
include/poppler/glib/poppler-attachment.h
include/poppler/glib/poppler-date.h
include/poppler/glib/poppler-document.h
include/poppler/glib/poppler-enums.h
include/poppler/glib/poppler-features.h
include/poppler/glib/poppler-form-field.h
include/poppler/glib/poppler-layer.h
include/poppler/glib/poppler-page.h
include/poppler/glib/poppler.h
lib/libpoppler-glib.la
@ -17,10 +19,13 @@ share/gtk-doc/html/poppler/index.html
share/gtk-doc/html/poppler/index.sgml
share/gtk-doc/html/poppler/left.png
share/gtk-doc/html/poppler/poppler-poppler-action.html
share/gtk-doc/html/poppler/poppler-poppler-annot.html
share/gtk-doc/html/poppler/poppler-poppler-attachment.html
share/gtk-doc/html/poppler/poppler-poppler-document.html
share/gtk-doc/html/poppler/poppler-poppler-enums.html
share/gtk-doc/html/poppler/poppler-poppler-features.html
share/gtk-doc/html/poppler/poppler-poppler-form-field.html
share/gtk-doc/html/poppler/poppler-poppler-layer.html
share/gtk-doc/html/poppler/poppler-poppler-page.html
share/gtk-doc/html/poppler/poppler-poppler.html
share/gtk-doc/html/poppler/poppler.devhelp

View file

@ -1,10 +1,9 @@
# $NetBSD: Makefile,v 1.2 2009/06/11 22:52:56 joerg Exp $
# $NetBSD: Makefile,v 1.3 2009/09/09 19:57:06 drochner Exp $
#
.include "../../print/poppler/Makefile.common"
PKGNAME= poppler-includes-${POPPLER_VERS}
PKGREVISION= 1
COMMENT= Poppler Xpdf includes (unsupported)
MAINTAINER= dillo@NetBSD.org

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.4 2009/06/14 18:11:58 joerg Exp $
@comment $NetBSD: PLIST,v 1.5 2009/09/09 19:57:06 drochner Exp $
include/poppler/Annot.h
include/poppler/Array.h
include/poppler/BuiltinFont.h
@ -21,6 +21,7 @@ include/poppler/Function.h
include/poppler/Gfx.h
include/poppler/GfxFont.h
include/poppler/GfxState.h
include/poppler/GfxState_helpers.h
include/poppler/GlobalParams.h
include/poppler/JArithmeticDecoder.h
include/poppler/JBIG2Stream.h
@ -40,6 +41,7 @@ include/poppler/PSTokenizer.h
include/poppler/Page.h
include/poppler/PageTransition.h
include/poppler/Parser.h
include/poppler/PopplerCache.h
include/poppler/PreScanOutputDev.h
include/poppler/ProfileData.h
include/poppler/SecurityHandler.h
@ -64,8 +66,10 @@ include/poppler/goo/GooMutex.h
include/poppler/goo/GooString.h
include/poppler/goo/GooTimer.h
include/poppler/goo/GooVector.h
include/poppler/goo/PNGWriter.h
include/poppler/goo/gfile.h
include/poppler/goo/gmem.h
include/poppler/goo/gstrtod.h
include/poppler/goo/gtypes.h
include/poppler/poppler-config.h
include/poppler/splash/Splash.h

View file

@ -1,4 +1,6 @@
# $NetBSD: buildlink3.mk,v 1.2 2009/03/20 19:25:15 joerg Exp $
# $NetBSD: buildlink3.mk,v 1.3 2009/09/09 19:57:06 drochner Exp $
BUILDLINK_DEPMETHOD.poppler-includes?= build
BUILDLINK_TREE+= poppler-includes

View file

@ -1,10 +1,9 @@
# $NetBSD: Makefile,v 1.19 2009/08/26 19:56:45 sno Exp $
# $NetBSD: Makefile,v 1.20 2009/09/09 19:57:06 drochner Exp $
#
.include "../../print/poppler/Makefile.common"
PKGNAME= poppler-qt-${POPPLER_VERS}
PKGREVISION= 1
COMMENT= PDF rendering library (QT wrapper)
MAINTAINER= reed@reedmedia.net

View file

@ -1,10 +1,9 @@
# $NetBSD: Makefile,v 1.8 2009/08/26 19:56:45 sno Exp $
# $NetBSD: Makefile,v 1.9 2009/09/09 19:57:06 drochner Exp $
#
.include "../../print/poppler/Makefile.common"
PKGNAME= poppler-qt4-${POPPLER_VERS}
PKGREVISION= 1
COMMENT= PDF rendering library (QT4 wrapper)
MAINTAINER= reed@reedmedia.net

View file

@ -1,10 +1,9 @@
# $NetBSD: Makefile,v 1.8 2009/08/26 19:58:14 sno Exp $
# $NetBSD: Makefile,v 1.9 2009/09/09 19:57:06 drochner Exp $
#
.include "../../print/poppler/Makefile.common"
PKGNAME= poppler-utils-${POPPLER_VERS}
PKGREVISION= 1
COMMENT= PDF utilities (from poppler)
MAINTAINER= reed@reedmedia.net
@ -45,4 +44,5 @@ PTHREAD_STUBLIB= # provided by libc
.endif
MAKE_ENV+= PTHREAD_STUBLIB=${PTHREAD_STUBLIB}
.include "../../graphics/png/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,10 +1,8 @@
# $NetBSD: Makefile,v 1.42 2009/08/26 19:56:42 sno Exp $
# $NetBSD: Makefile,v 1.43 2009/09/09 19:57:05 drochner Exp $
#
.include "../../print/poppler/Makefile.common"
PKGREVISION= 2
COMMENT= PDF rendering library
MAINTAINER= reed@reedmedia.net
@ -53,5 +51,6 @@ post-install:
.include "../../fonts/fontconfig/buildlink3.mk"
.include "../../graphics/jpeg/buildlink3.mk"
.include "../../graphics/png/buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile.common,v 1.30 2009/05/25 21:05:23 drochner Exp $
# $NetBSD: Makefile.common,v 1.31 2009/09/09 19:57:05 drochner Exp $
#
# used by print/poppler/Makefile
# used by print/poppler-glib/Makefile
@ -7,7 +7,7 @@
# used by print/poppler-qt4/Makefile
# used by print/poppler-utils/Makefile
POPPLER_VERS= 0.10.7
POPPLER_VERS= 0.12.0
DISTNAME= poppler-${POPPLER_VERS}
CATEGORIES= print
MASTER_SITES= http://poppler.freedesktop.org/

View file

@ -1,4 +1,4 @@
# $NetBSD: buildlink3.mk,v 1.17 2009/08/26 19:56:42 sno Exp $
# $NetBSD: buildlink3.mk,v 1.18 2009/09/09 19:57:05 drochner Exp $
BUILDLINK_TREE+= poppler
@ -6,7 +6,7 @@ BUILDLINK_TREE+= poppler
POPPLER_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.poppler+= poppler>=0.5.1
BUILDLINK_ABI_DEPENDS.poppler+= poppler>=0.10.7nb2
BUILDLINK_ABI_DEPENDS.poppler+= poppler>=0.11.2
BUILDLINK_PKGSRCDIR.poppler?= ../../print/poppler
pkgbase := poppler

View file

@ -1,16 +1,9 @@
$NetBSD: distinfo,v 1.45 2009/07/28 18:22:49 drochner Exp $
$NetBSD: distinfo,v 1.46 2009/09/09 19:57:05 drochner Exp $
SHA1 (poppler-0.10.7.tar.gz) = 891284d3fcac9bb250218e3439e596778c7f5edb
RMD160 (poppler-0.10.7.tar.gz) = a275742a11df1965e4b7d06115f071f67d781d8f
Size (poppler-0.10.7.tar.gz) = 1531154 bytes
SHA1 (poppler-0.12.0.tar.gz) = 6165cfc46340644e8750ab8a37f3a3d634144106
RMD160 (poppler-0.12.0.tar.gz) = c90a6a437fb7b5e5c9c9cdaf72782be16cd8ae07
Size (poppler-0.12.0.tar.gz) = 1595424 bytes
SHA1 (patch-aa) = 43c63c16d3a845e394a8eb0c3a321944fcf17615
SHA1 (patch-ab) = 096382d2f7c240c7fbf5eee88d7ba5af5cf7cd1b
SHA1 (patch-ag) = 0bf1bc080cad55792fe6cc761bf22ecccba7d13a
SHA1 (patch-ai) = b58704153418b5e3b5d65a2e02e5a9b306b00cf7
SHA1 (patch-aj) = 8bb1fe169bddb76ecc72129cc1dbd32030073dfd
SHA1 (patch-ak) = ab4d0c91a6f2806b405954f8dab6e3d61a03b054
SHA1 (patch-al) = b1d76a92a5ffad01543f0072a1a00e74e751a56f
SHA1 (patch-am) = 2ee61c446ea85acde8c1ee798a0201901e565d55
SHA1 (patch-an) = 357b88ed15a4d355b1532e0d95cc511b137b4c44
SHA1 (patch-ca) = 5bd31c497c8cbfb6c1d6cb5b9183088113bef6e3
SHA1 (patch-cb) = e8cfb16a0641788759b13cf5fcf97d82f9485adc
SHA1 (patch-ab) = 6bde603d2934099631e057f022ab61b6ff965022
SHA1 (patch-ag) = 89d4ca8d5325b703c953317f422501873d659ac6
SHA1 (patch-ai) = 52376e12baaba63629156055d5254c29f6e89824

View file

@ -1,8 +1,8 @@
$NetBSD: patch-ab,v 1.10 2009/05/25 21:05:24 drochner Exp $
$NetBSD: patch-ab,v 1.11 2009/09/09 19:57:05 drochner Exp $
--- utils/Makefile.in.orig 2009-05-16 17:40:51.000000000 +0200
--- utils/Makefile.in.orig 2009-08-18 21:04:22.000000000 +0200
+++ utils/Makefile.in
@@ -51,7 +51,7 @@ mkinstalldirs = $(install_sh) -d
@@ -52,7 +52,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/poppler/poppler-config.h
CONFIG_CLEAN_FILES =
@ -11,7 +11,7 @@ $NetBSD: patch-ab,v 1.10 2009/05/25 21:05:24 drochner Exp $
@BUILD_ABIWORD_OUTPUT_TRUE@am__EXEEXT_2 = pdftoabw$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
@@ -61,19 +61,19 @@ am_pdffonts_OBJECTS = pdffonts.$(OBJEXT)
@@ -62,25 +62,25 @@ am_pdffonts_OBJECTS = pdffonts.$(OBJEXT)
pdffonts_OBJECTS = $(am_pdffonts_OBJECTS)
pdffonts_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
@ -34,7 +34,14 @@ $NetBSD: patch-ab,v 1.10 2009/05/25 21:05:24 drochner Exp $
$(am__DEPENDENCIES_1)
am__pdftoabw_SOURCES_DIST = pdftoabw.cc parseargs.c parseargs.h
@BUILD_ABIWORD_OUTPUT_TRUE@am_pdftoabw_OBJECTS = pdftoabw.$(OBJEXT) \
@@ -88,25 +88,25 @@ am_pdftohtml_OBJECTS = pdftohtml.$(OBJEX
@BUILD_ABIWORD_OUTPUT_TRUE@ $(am__objects_1)
pdftoabw_OBJECTS = $(am_pdftoabw_OBJECTS)
-am__DEPENDENCIES_2 = $(top_builddir)/poppler/libpoppler.la \
+am__DEPENDENCIES_2 = $(prefix)/lib/libpoppler.la \
$(am__DEPENDENCIES_1)
@BUILD_ABIWORD_OUTPUT_TRUE@pdftoabw_DEPENDENCIES = \
@BUILD_ABIWORD_OUTPUT_TRUE@ $(am__DEPENDENCIES_2) \
@@ -89,25 +89,25 @@ am_pdftohtml_OBJECTS = pdftohtml.$(OBJEX
HtmlLinks.$(OBJEXT) HtmlOutputDev.$(OBJEXT) $(am__objects_1)
pdftohtml_OBJECTS = $(am_pdftohtml_OBJECTS)
pdftohtml_LDADD = $(LDADD)
@ -66,7 +73,7 @@ $NetBSD: patch-ab,v 1.10 2009/05/25 21:05:24 drochner Exp $
$(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/poppler
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -307,12 +307,12 @@ top_build_prefix = @top_build_prefix@
@@ -319,12 +319,12 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
win32_libs = @win32_libs@
@ -83,8 +90,8 @@ $NetBSD: patch-ab,v 1.10 2009/05/25 21:05:24 drochner Exp $
+pdftoppm_manpage = pdftoppm.1
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/utils \
@@ -322,9 +322,10 @@ INCLUDES = \
-I$(top_srcdir)/goo \
@@ -335,9 +335,10 @@ INCLUDES = \
$(ABIWORD_CFLAGS)
LDADD = \

View file

@ -1,8 +1,8 @@
$NetBSD: patch-ag,v 1.4 2008/10/24 23:28:53 wiz Exp $
$NetBSD: patch-ag,v 1.5 2009/09/09 19:57:05 drochner Exp $
--- qt4/src/Makefile.in.orig 2008-10-09 19:13:21.000000000 +0000
--- qt4/src/Makefile.in.orig 2009-09-09 19:22:37.000000000 +0200
+++ qt4/src/Makefile.in
@@ -62,7 +62,7 @@ libLTLIBRARIES_INSTALL = $(INSTALL)
@@ -65,7 +65,7 @@ libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libpoppler_qt4_la_DEPENDENCIES = \
@ -11,12 +11,12 @@ $NetBSD: patch-ag,v 1.4 2008/10/24 23:28:53 wiz Exp $
$(am__DEPENDENCIES_1) $(am__append_1)
am_libpoppler_qt4_la_OBJECTS = poppler-document.lo poppler-page.lo \
poppler-fontinfo.lo poppler-embeddedfile.lo poppler-textbox.lo \
@@ -308,7 +308,7 @@ libpoppler_qt4_la_SOURCES = \
@@ -332,7 +332,7 @@ libpoppler_qt4_la_SOURCES = \
poppler-export.h \
poppler-private.h
-libpoppler_qt4_la_LIBADD = $(top_builddir)/poppler/libpoppler.la \
+libpoppler_qt4_la_LIBADD = $(prefix)/lib/libpoppler.la \
$(FONTCONFIG_LIBS) $(POPPLER_QT4_LIBS) $(am__append_1)
libpoppler_qt4_la_LDFLAGS = -version-info 4:0:1
libpoppler_qt4_la_LDFLAGS = -version-info 5:0:2
all: all-am

View file

@ -1,33 +1,8 @@
$NetBSD: patch-ai,v 1.8 2009/04/17 16:08:17 drochner Exp $
$NetBSD: patch-ai,v 1.9 2009/09/09 19:57:05 drochner Exp $
--- configure.orig 2009-04-16 22:21:56.000000000 +0200
--- configure.orig 2009-08-01 17:19:11.000000000 +0200
+++ configure
@@ -787,6 +787,8 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS
PC_REQUIRES_PRIVATE
PC_REQUIRES
+USE_CMS_FALSE
+USE_CMS_TRUE
BUILD_UTILS_FALSE
BUILD_UTILS_TRUE
BUILD_ABIWORD_OUTPUT_FALSE
@@ -1005,6 +1007,7 @@ enable_gtk_test
enable_abiword_output
enable_utils
enable_compile_warnings
+enable_cms
'
ac_precious_vars='build_alias
host_alias
@@ -1701,6 +1704,7 @@ Optional Features:
--enable-compile-warnings=[no/yes/kde]
Turn on compiler warnings.
+ --disable-cms Don't use color management system.
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -24668,7 +24672,7 @@ fi
@@ -25282,7 +25282,7 @@ fi
if test x$enable_poppler_qt4 = xyes; then
{ $as_echo "$as_me:$LINENO: checking for Qt4 moc" >&5
$as_echo_n "checking for Qt4 moc... " >&6; }
@ -36,285 +11,3 @@ $NetBSD: patch-ai,v 1.8 2009/04/17 16:08:17 drochner Exp $
mocversion=`$MOCQT4 -v 2>&1`
mocversiongrep=`echo $mocversion | grep "Qt 4"`
if test x"$mocversiongrep" != x"$mocversion"; then
@@ -25127,6 +25131,259 @@ else
fi
+
+# Check whether --enable-cms was given.
+if test "${enable_cms+set}" = set; then
+ enableval=$enable_cms; enable_cms=$enableval
+else
+ enable_cms="yes"
+fi
+
+if test x$enable_cms = xyes; then
+
+{ $as_echo "$as_me:$LINENO: checking for cmsOpenProfileFromFile in -llcms" >&5
+$as_echo_n "checking for cmsOpenProfileFromFile in -llcms... " >&6; }
+if test "${ac_cv_lib_lcms_cmsOpenProfileFromFile+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-llcms $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cmsOpenProfileFromFile ();
+int
+main ()
+{
+return cmsOpenProfileFromFile ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_lcms_cmsOpenProfileFromFile=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_lcms_cmsOpenProfileFromFile=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lcms_cmsOpenProfileFromFile" >&5
+$as_echo "$ac_cv_lib_lcms_cmsOpenProfileFromFile" >&6; }
+if test "x$ac_cv_lib_lcms_cmsOpenProfileFromFile" = x""yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBLCMS 1
+_ACEOF
+
+ LIBS="-llcms $LIBS"
+
+else
+ { { $as_echo "$as_me:$LINENO: error: \"*** lcms library not found ***\"" >&5
+$as_echo "$as_me: error: \"*** lcms library not found ***\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+for ac_header in lcms.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+as_val=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ { { $as_echo "$as_me:$LINENO: error: \"*** lcms headers not found ***\"" >&5
+$as_echo "$as_me: error: \"*** lcms headers not found ***\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+done
+
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_CMS 1
+_ACEOF
+
+fi
+ if test x$enable_cms = xyes; then
+ USE_CMS_TRUE=
+ USE_CMS_FALSE='#'
+else
+ USE_CMS_TRUE='#'
+ USE_CMS_FALSE=
+fi
+
+
if test "x$GCC" != xyes; then
enable_compile_warnings=no
fi
@@ -25399,6 +25656,13 @@ $as_echo "$as_me: error: conditional \"B
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${USE_CMS_TRUE}" && test -z "${USE_CMS_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"USE_CMS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"USE_CMS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@@ -27938,6 +28202,7 @@ echo " use gtk-doc: $enable_gtk_
echo " use libjpeg: $enable_libjpeg"
echo " use zlib: $enable_zlib"
echo " use libopenjpeg: $enable_libopenjpeg"
+echo " use cms: $enable_cms"
echo " command line utils: $enable_utils"
echo ""

View file

@ -1,51 +0,0 @@
$NetBSD: patch-aj,v 1.7 2009/02/12 20:55:07 drochner Exp $
--- poppler/Makefile.in.orig 2008-12-18 00:09:45.000000000 +0100
+++ poppler/Makefile.in
@@ -70,19 +70,20 @@ am__libpoppler_cairo_la_SOURCES_DIST = C
@BUILD_CAIRO_OUTPUT_TRUE@ CairoFontEngine.lo CairoOutputDev.lo
libpoppler_cairo_la_OBJECTS = $(am_libpoppler_cairo_la_OBJECTS)
@BUILD_CAIRO_OUTPUT_TRUE@am_libpoppler_cairo_la_rpath =
-@BUILD_SPLASH_OUTPUT_TRUE@am__DEPENDENCIES_1 = \
+am__DEPENDENCIES_1 =
+@BUILD_SPLASH_OUTPUT_TRUE@am__DEPENDENCIES_2 = \
@BUILD_SPLASH_OUTPUT_TRUE@ $(top_builddir)/splash/libsplash.la
-am__DEPENDENCIES_2 =
-@BUILD_LIBJPEG_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
-@BUILD_ZLIB_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2)
-@BUILD_LIBOPENJPEG_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_2)
-@BUILD_ABIWORD_OUTPUT_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_2)
+@BUILD_LIBJPEG_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
+@BUILD_ZLIB_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1)
+@BUILD_LIBOPENJPEG_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1)
+@BUILD_ABIWORD_OUTPUT_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_1)
libpoppler_la_DEPENDENCIES = $(top_builddir)/goo/libgoo.la \
$(top_builddir)/fofi/libfofi.la $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) \
- $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_6) \
- $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) \
- $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2)
+ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \
+ $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \
+ $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am__libpoppler_la_SOURCES_DIST = SplashOutputDev.cc DCTStream.h \
DCTStream.cc FlateStream.h FlateStream.cc JPXStream.h \
JPXStream.cc JPEG2000Stream.h JPEG2000Stream.cc ABWOutputDev.h \
@@ -394,6 +395,7 @@ win32_libs = @win32_libs@
@BUILD_ABIWORD_OUTPUT_TRUE@abiword_libs = \
@BUILD_ABIWORD_OUTPUT_TRUE@ $(ABIWORD_LIBS)
+@USE_CMS_TRUE@cms_libs = -llcms
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/goo \
@@ -411,6 +413,7 @@ noinst_LTLIBRARIES = $(poppler_cairo) \
libpoppler_la_LIBADD = \
$(top_builddir)/goo/libgoo.la \
$(top_builddir)/fofi/libfofi.la \
+ $(cms_libs) \
$(splash_libs) \
$(libjpeg_libs) \
$(zlib_libs) \

View file

@ -1,27 +0,0 @@
$NetBSD: patch-ak,v 1.5 2009/02/12 20:55:07 drochner Exp $
--- config.h.in.orig 2008-12-18 00:32:25.000000000 +0100
+++ config.h.in
@@ -40,6 +40,12 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the <lcms.h> header file. */
+#undef HAVE_LCMS_H
+
+/* Define to 1 if you have the `lcms' library (-llcms). */
+#undef HAVE_LIBLCMS
+
/* Define to 1 if you have the `openjpeg' library (-lopenjpeg). */
#undef HAVE_LIBOPENJPEG
@@ -148,6 +154,9 @@
/* Enable word list support. */
#undef TEXTOUT_WORD_LIST
+/* Defines if use cms */
+#undef USE_CMS
+
/* Throw exceptions to deal with not enough memory and similar problems */
#undef USE_EXCEPTIONS

View file

@ -1,22 +0,0 @@
$NetBSD: patch-al,v 1.3 2009/04/06 09:29:27 drochner Exp $
--- poppler/Form.cc.orig 2009-01-28 22:56:21.000000000 +0100
+++ poppler/Form.cc
@@ -546,7 +546,7 @@ void FormWidgetChoice::_updateV ()
} else if (numSelected == 1) {
for(int i=0; i<parent->getNumChoices(); i++) {
if (parent->isSelected(i)) {
- obj1.initString(new GooString(parent->getExportVal(i)));
+ obj1.initString(new GooString(parent->getChoice(i)));
break;
}
}
@@ -555,7 +555,7 @@ void FormWidgetChoice::_updateV ()
for(int i=0; i<parent->getNumChoices(); i++) {
if (parent->isSelected(i)) {
Object obj2;
- obj2.initString(new GooString(parent->getExportVal(i)));
+ obj2.initString(new GooString(parent->getChoice(i)));
obj1.arrayAdd(&obj2);
}
}

View file

@ -1,22 +0,0 @@
$NetBSD: patch-am,v 1.1 2009/04/06 09:29:27 drochner Exp $
--- glib/poppler-form-field.cc.orig 2008-10-09 22:30:34.000000000 +0200
+++ glib/poppler-form-field.cc
@@ -279,7 +279,7 @@ poppler_form_field_text_set_text (Popple
g_return_if_fail (field->widget->getType () == formText);
- tmp = text ? g_convert (text, -1, "UTF16BE", "UTF8", NULL, &length, NULL) : NULL;
+ tmp = text ? g_convert (text, -1, "UTF-16BE", "UTF-8", NULL, &length, NULL) : NULL;
goo_tmp = new GooString (tmp, length);
g_free (tmp);
static_cast<FormWidgetText*>(field->widget)->setContent (goo_tmp);
@@ -552,7 +552,7 @@ poppler_form_field_choice_set_text (Popp
g_return_if_fail (field->widget->getType () == formChoice);
- tmp = text ? g_convert (text, -1, "UTF16BE", "UTF8", NULL, &length, NULL) : NULL;
+ tmp = text ? g_convert (text, -1, "UTF-16BE", "UTF-8", NULL, &length, NULL) : NULL;
goo_tmp = new GooString (tmp, length);
g_free (tmp);
static_cast<FormWidgetChoice*>(field->widget)->setEditChoice (goo_tmp);

View file

@ -1,107 +0,0 @@
$NetBSD: patch-an,v 1.1 2009/07/28 18:22:49 drochner Exp $
--- poppler/PSOutputDev.cc.orig 2009-05-02 14:14:57.000000000 +0200
+++ poppler/PSOutputDev.cc
@@ -4565,6 +4565,8 @@ void PSOutputDev::doImageL2(Object *ref,
GfxCMYK cmyk;
int c;
int col, i, j, x0, x1, y, maskXor;
+
+ rectsOutLen = 0;
// color key masking
if (maskColors && colorMap && !inlineImg) {
@@ -4573,7 +4575,7 @@ void PSOutputDev::doImageL2(Object *ref,
numComps = colorMap->getNumPixelComps();
imgStr = new ImageStream(str, width, numComps, colorMap->getBits());
imgStr->reset();
- rects0Len = rects1Len = rectsOutLen = 0;
+ rects0Len = rects1Len = 0;
rectsSize = rectsOutSize = 64;
rects0 = (PSOutImgClipRect *)gmallocn(rectsSize, sizeof(PSOutImgClipRect));
rects1 = (PSOutImgClipRect *)gmallocn(rectsSize, sizeof(PSOutImgClipRect));
@@ -4696,14 +4698,28 @@ void PSOutputDev::doImageL2(Object *ref,
rectsOut[rectsOutLen].y1 = height - rects0[i].y0 - 1;
++rectsOutLen;
}
- writePSFmt("{0:d} array 0\n", rectsOutLen * 4);
- for (i = 0; i < rectsOutLen; ++i) {
- writePSFmt("[{0:d} {1:d} {2:d} {3:d}] pr\n",
- rectsOut[i].x0, rectsOut[i].y0,
- rectsOut[i].x1 - rectsOut[i].x0,
- rectsOut[i].y1 - rectsOut[i].y0);
+ if (rectsOutLen < 65536/4) {
+ writePSFmt("{0:d} array 0\n", rectsOutLen * 4);
+ for (i = 0; i < rectsOutLen; ++i) {
+ writePSFmt("[{0:d} {1:d} {2:d} {3:d}] pr\n",
+ rectsOut[i].x0, rectsOut[i].y0,
+ rectsOut[i].x1 - rectsOut[i].x0,
+ rectsOut[i].y1 - rectsOut[i].y0);
+ }
+ writePSFmt("pop {0:d} {1:d} pdfImClip\n", width, height);
+ } else {
+ // would be over the limit of array size.
+ // make each rectangle path and clip.
+ writePS("gsave newpath\n");
+ for (i = 0; i < rectsOutLen; ++i) {
+ writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
+ ((double)rectsOut[i].x0)/width,
+ ((double)rectsOut[i].y0)/height,
+ ((double)(rectsOut[i].x1 - rectsOut[i].x0))/width,
+ ((double)(rectsOut[i].y1 - rectsOut[i].y0))/height);
+ }
+ writePS("clip\n");
}
- writePSFmt("pop {0:d} {1:d} pdfImClip\n", width, height);
gfree(rectsOut);
gfree(rects0);
gfree(rects1);
@@ -4798,14 +4814,28 @@ void PSOutputDev::doImageL2(Object *ref,
rectsOut[rectsOutLen].y1 = maskHeight - rects0[i].y0 - 1;
++rectsOutLen;
}
- writePSFmt("{0:d} array 0\n", rectsOutLen * 4);
- for (i = 0; i < rectsOutLen; ++i) {
- writePSFmt("[{0:d} {1:d} {2:d} {3:d}] pr\n",
- rectsOut[i].x0, rectsOut[i].y0,
- rectsOut[i].x1 - rectsOut[i].x0,
- rectsOut[i].y1 - rectsOut[i].y0);
+ if (rectsOutLen < 65536/4) {
+ writePSFmt("{0:d} array 0\n", rectsOutLen * 4);
+ for (i = 0; i < rectsOutLen; ++i) {
+ writePSFmt("[{0:d} {1:d} {2:d} {3:d}] pr\n",
+ rectsOut[i].x0, rectsOut[i].y0,
+ rectsOut[i].x1 - rectsOut[i].x0,
+ rectsOut[i].y1 - rectsOut[i].y0);
+ }
+ writePSFmt("pop {0:d} {1:d} pdfImClip\n", maskWidth, maskHeight);
+ } else {
+ // would be over the limit of array size.
+ // make each rectangle path and clip.
+ writePS("gsave newpath\n");
+ for (i = 0; i < rectsOutLen; ++i) {
+ writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
+ ((double)rectsOut[i].x0)/maskWidth,
+ ((double)rectsOut[i].y0)/maskHeight,
+ ((double)(rectsOut[i].x1 - rectsOut[i].x0))/maskWidth,
+ ((double)(rectsOut[i].y1 - rectsOut[i].y0))/maskHeight);
+ }
+ writePS("clip\n");
}
- writePSFmt("pop {0:d} {1:d} pdfImClip\n", maskWidth, maskHeight);
gfree(rectsOut);
gfree(rects0);
gfree(rects1);
@@ -5066,7 +5096,11 @@ void PSOutputDev::doImageL2(Object *ref,
}
if ((maskColors && colorMap && !inlineImg) || maskStr) {
- writePS("pdfImClipEnd\n");
+ if (rectsOutLen < 65536/4) {
+ writePS("pdfImClipEnd\n");
+ } else {
+ writePS("grestore\n");
+ }
}
}

View file

@ -1,936 +0,0 @@
$NetBSD: patch-ca,v 1.2 2009/02/26 20:23:02 drochner Exp $
--- poppler/GfxState.cc.orig 2008-11-05 22:49:26.000000000 +0100
+++ poppler/GfxState.cc
@@ -39,6 +39,7 @@
#include "Page.h"
#include "GfxState.h"
#include "GfxFont.h"
+#include "GlobalParams.h"
//------------------------------------------------------------------------
@@ -224,6 +225,225 @@ void GfxColorSpace::getRGBLine(Guchar *i
}
}
+#ifdef USE_CMS
+cmsHPROFILE GfxColorSpace::RGBProfile = NULL;
+cmsHPROFILE GfxColorSpace::displayProfile = NULL;
+GooString *GfxColorSpace::displayProfileName = NULL;
+unsigned int GfxColorSpace::displayPixelType = 0;
+GfxColorTransform *GfxColorSpace::XYZ2DisplayTransform = NULL;
+
+cmsHPROFILE GfxColorSpace::loadColorProfile(const char *fileName)
+{
+ cmsHPROFILE hp = NULL;
+ FILE *fp;
+
+ if (fileName[0] == '/') {
+ // full path
+ // check if open the file
+ if ((fp = fopen(fileName,"r")) != NULL) {
+ fclose(fp);
+ hp = cmsOpenProfileFromFile(fileName,"r");
+ }
+ return hp;
+ }
+ // try to load from user directory
+ GooString *path = globalParams->getBaseDir();
+ path->append(COLOR_PROFILE_DIR);
+ path->append(fileName);
+ // check if open the file
+ if ((fp = fopen(path->getCString(),"r")) != NULL) {
+ fclose(fp);
+ hp = cmsOpenProfileFromFile(path->getCString(),"r");
+ }
+ delete path;
+ if (hp == NULL) {
+ // load from global directory
+ path = new GooString(GLOBAL_COLOR_PROFILE_DIR);
+ path->append(fileName);
+ // check if open the file
+ if ((fp = fopen(path->getCString(),"r")) != NULL) {
+ fclose(fp);
+ hp = cmsOpenProfileFromFile(path->getCString(),"r");
+ }
+ delete path;
+ }
+ return hp;
+}
+
+static int CMSError(int ecode, const char *msg)
+{
+ error(-1,const_cast<char *>(msg));
+ return 1;
+}
+
+int GfxColorSpace::setupColorProfiles()
+{
+ static GBool initialized = gFalse;
+ cmsHTRANSFORM transform;
+ unsigned int nChannels;
+
+ // do only once
+ if (initialized) return 0;
+ initialized = gTrue;
+
+ // set error handlor
+ cmsSetErrorHandler(CMSError);
+
+ if (displayProfile == NULL) {
+ // load display profile if it was not already loaded.
+ if (displayProfileName == NULL) {
+ displayProfile = loadColorProfile("display.icc");
+ } else if (displayProfileName->getLength() > 0) {
+ displayProfile = loadColorProfile(displayProfileName->getCString());
+ }
+ }
+ // load RGB profile
+ RGBProfile = loadColorProfile("RGB.icc");
+ if (RGBProfile == NULL) {
+ /* use built in sRGB profile */
+ RGBProfile = cmsCreate_sRGBProfile();
+ }
+ // create transforms
+ if (displayProfile != NULL) {
+ displayPixelType = getCMSColorSpaceType(cmsGetColorSpace(displayProfile));
+ nChannels = getCMSNChannels(cmsGetColorSpace(displayProfile));
+ // create transform from XYZ
+ cmsHPROFILE XYZProfile = cmsCreateXYZProfile();
+ if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL,
+ displayProfile,
+ COLORSPACE_SH(displayPixelType) |
+ CHANNELS_SH(nChannels) | BYTES_SH(0),
+ INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
+ error(-1, "Can't create Lab transform");
+ } else {
+ XYZ2DisplayTransform = new GfxColorTransform(transform);
+ }
+ cmsCloseProfile(XYZProfile);
+ }
+ return 0;
+}
+
+unsigned int GfxColorSpace::getCMSColorSpaceType(icColorSpaceSignature cs)
+{
+ switch (cs) {
+ case icSigXYZData:
+ return PT_XYZ;
+ break;
+ case icSigLabData:
+ return PT_Lab;
+ break;
+ case icSigLuvData:
+ return PT_YUV;
+ break;
+ case icSigYCbCrData:
+ return PT_YCbCr;
+ break;
+ case icSigYxyData:
+ return PT_Yxy;
+ break;
+ case icSigRgbData:
+ return PT_RGB;
+ break;
+ case icSigGrayData:
+ return PT_GRAY;
+ break;
+ case icSigHsvData:
+ return PT_HSV;
+ break;
+ case icSigHlsData:
+ return PT_HLS;
+ break;
+ case icSigCmykData:
+ return PT_CMYK;
+ break;
+ case icSigCmyData:
+ return PT_CMY;
+ break;
+ case icSig2colorData:
+ case icSig3colorData:
+ case icSig4colorData:
+ case icSig5colorData:
+ case icSig6colorData:
+ case icSig7colorData:
+ case icSig8colorData:
+ case icSig9colorData:
+ case icSig10colorData:
+ case icSig11colorData:
+ case icSig12colorData:
+ case icSig13colorData:
+ case icSig14colorData:
+ case icSig15colorData:
+ default:
+ break;
+ }
+ return PT_RGB;
+}
+
+unsigned int GfxColorSpace::getCMSNChannels(icColorSpaceSignature cs)
+{
+ switch (cs) {
+ case icSigXYZData:
+ case icSigLuvData:
+ case icSigLabData:
+ case icSigYCbCrData:
+ case icSigYxyData:
+ case icSigRgbData:
+ case icSigHsvData:
+ case icSigHlsData:
+ case icSigCmyData:
+ case icSig3colorData:
+ return 3;
+ break;
+ case icSigGrayData:
+ return 1;
+ break;
+ case icSigCmykData:
+ case icSig4colorData:
+ return 4;
+ break;
+ case icSig2colorData:
+ return 2;
+ break;
+ case icSig5colorData:
+ return 5;
+ break;
+ case icSig6colorData:
+ return 6;
+ break;
+ case icSig7colorData:
+ return 7;
+ break;
+ case icSig8colorData:
+ return 8;
+ break;
+ case icSig9colorData:
+ return 9;
+ break;
+ case icSig10colorData:
+ return 10;
+ break;
+ case icSig11colorData:
+ return 11;
+ break;
+ case icSig12colorData:
+ return 12;
+ break;
+ case icSig13colorData:
+ return 13;
+ break;
+ case icSig14colorData:
+ return 14;
+ break;
+ case icSig15colorData:
+ return 15;
+ default:
+ break;
+ }
+ return 3;
+}
+
+#endif
+
void GfxColorSpace::getGrayLine(Guchar *in, unsigned char *out, int length) {
int i, j, n;
GfxColor color;
@@ -311,6 +531,14 @@ GfxColorSpace *GfxCalGrayColorSpace::cop
return cs;
}
+// This is the inverse of MatrixLMN in Example 4.10 from the PostScript
+// Language Reference, Third Edition.
+static const double xyzrgb[3][3] = {
+ { 3.240449, -1.537136, -0.498531 },
+ { -0.969265, 1.876011, 0.041556 },
+ { 0.055643, -0.204026, 1.057229 }
+};
+
GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr) {
GfxCalGrayColorSpace *cs;
Object obj1, obj2, obj3;
@@ -353,32 +581,127 @@ GfxColorSpace *GfxCalGrayColorSpace::par
}
obj2.free();
obj1.free();
+
+ cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
+ xyzrgb[0][1] * cs->whiteY +
+ xyzrgb[0][2] * cs->whiteZ);
+ cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
+ xyzrgb[1][1] * cs->whiteY +
+ xyzrgb[1][2] * cs->whiteZ);
+ cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
+ xyzrgb[2][1] * cs->whiteY +
+ xyzrgb[2][2] * cs->whiteZ);
+
return cs;
}
-void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) {
- *gray = clip01(color->c[0]);
+// convert CalGray to media XYZ color space
+// (not multiply by the white point)
+void GfxCalGrayColorSpace::getXYZ(GfxColor *color,
+ double *pX, double *pY, double *pZ) {
+ double A;
+
+ A = colToDbl(color->c[0]);
+ *pX = pow(A,gamma);
+ *pY = pow(A,gamma);
+ *pZ = pow(A,gamma);
}
-void GfxCalGrayColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
- memcpy (out, in, length);
-}
+void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+ GfxRGB rgb;
-void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
- rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) {
+ double out[gfxColorMaxComps];
+ double in[gfxColorMaxComps];
+ double X, Y, Z;
+
+ getXYZ(color,&X,&Y,&Z);
+ in[0] = clip01(X);
+ in[1] = clip01(Y);
+ in[2] = clip01(Z);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ *gray = dblToCol(out[0]);
+ return;
+ }
+#endif
+ getRGB(color, &rgb);
+ *gray = clip01((GfxColorComp)(0.299 * rgb.r +
+ 0.587 * rgb.g +
+ 0.114 * rgb.b + 0.5));
}
-void GfxCalGrayColorSpace::getRGBLine(Guchar *in, unsigned int *out,
- int length) {
- int i;
+void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+ double X, Y, Z;
+ double r, g, b;
- for (i = 0; i < length; i++)
- out[i] = (in[i] << 16) | (in[i] << 8) | (in[i] << 0);
+ getXYZ(color,&X,&Y,&Z);
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
+ double out[gfxColorMaxComps];
+ double in[gfxColorMaxComps];
+
+ in[0] = clip01(X);
+ in[1] = clip01(Y);
+ in[2] = clip01(Z);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ rgb->r = dblToCol(out[0]);
+ rgb->g = dblToCol(out[1]);
+ rgb->b = dblToCol(out[2]);
+ return;
+ }
+#endif
+ X *= whiteX;
+ Y *= whiteY;
+ Z *= whiteZ;
+ // convert XYZ to RGB, including gamut mapping and gamma correction
+ r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
+ g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
+ b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
+ rgb->r = dblToCol(pow(clip01(r * kr), 0.5));
+ rgb->g = dblToCol(pow(clip01(g * kg), 0.5));
+ rgb->b = dblToCol(pow(clip01(b * kb), 0.5));
+ rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
}
void GfxCalGrayColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
- cmyk->c = cmyk->m = cmyk->y = 0;
- cmyk->k = clip01(gfxColorComp1 - color->c[0]);
+ GfxRGB rgb;
+ GfxColorComp c, m, y, k;
+
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_CMYK) {
+ double in[gfxColorMaxComps];
+ double out[gfxColorMaxComps];
+ double X, Y, Z;
+
+ getXYZ(color,&X,&Y,&Z);
+ in[0] = clip01(X);
+ in[1] = clip01(Y);
+ in[2] = clip01(Z);
+
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ cmyk->c = dblToCol(out[0]);
+ cmyk->m = dblToCol(out[1]);
+ cmyk->y = dblToCol(out[2]);
+ cmyk->k = dblToCol(out[3]);
+ return;
+ }
+#endif
+ getRGB(color, &rgb);
+ c = clip01(gfxColorComp1 - rgb.r);
+ m = clip01(gfxColorComp1 - rgb.g);
+ y = clip01(gfxColorComp1 - rgb.b);
+ k = c;
+ if (m < k) {
+ k = m;
+ }
+ if (y < k) {
+ k = y;
+ }
+ cmyk->c = c - k;
+ cmyk->m = m - k;
+ cmyk->y = y - k;
+ cmyk->k = k;
}
void GfxCalGrayColorSpace::getDefaultColor(GfxColor *color) {
@@ -553,47 +876,112 @@ GfxColorSpace *GfxCalRGBColorSpace::pars
}
obj2.free();
obj1.free();
+
+ cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
+ xyzrgb[0][1] * cs->whiteY +
+ xyzrgb[0][2] * cs->whiteZ);
+ cs->kg = 1 / (xyzrgb[1][0] * cs->whiteX +
+ xyzrgb[1][1] * cs->whiteY +
+ xyzrgb[1][2] * cs->whiteZ);
+ cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX +
+ xyzrgb[2][1] * cs->whiteY +
+ xyzrgb[2][2] * cs->whiteZ);
+
return cs;
}
-void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) {
- *gray = clip01((GfxColorComp)(0.299 * color->c[0] +
- 0.587 * color->c[1] +
- 0.114 * color->c[2] + 0.5));
+// convert CalRGB to XYZ color space
+void GfxCalRGBColorSpace::getXYZ(GfxColor *color,
+ double *pX, double *pY, double *pZ) {
+ double A, B, C;
+
+ A = colToDbl(color->c[0]);
+ B = colToDbl(color->c[1]);
+ C = colToDbl(color->c[2]);
+ *pX = mat[0]*pow(A,gammaR)+mat[3]*pow(B,gammaG)+mat[6]*pow(C,gammaB);
+ *pY = mat[1]*pow(A,gammaR)+mat[4]*pow(B,gammaG)+mat[7]*pow(C,gammaB);
+ *pZ = mat[2]*pow(A,gammaR)+mat[5]*pow(B,gammaG)+mat[8]*pow(C,gammaB);
}
-void GfxCalRGBColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
- int i;
+void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+ GfxRGB rgb;
- for (i = 0; i < length; i++) {
- out[i] =
- (in[i * 3 + 0] * 19595 +
- in[i * 3 + 1] * 38469 +
- in[i * 3 + 2] * 7472) / 65536;
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) {
+ double out[gfxColorMaxComps];
+ double in[gfxColorMaxComps];
+ double X, Y, Z;
+
+ getXYZ(color,&X,&Y,&Z);
+ in[0] = clip01(X);
+ in[1] = clip01(Y);
+ in[2] = clip01(Z);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ *gray = dblToCol(out[0]);
+ return;
}
+#endif
+ getRGB(color, &rgb);
+ *gray = clip01((GfxColorComp)(0.299 * rgb.r +
+ 0.587 * rgb.g +
+ 0.114 * rgb.b + 0.5));
}
void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
- rgb->r = clip01(color->c[0]);
- rgb->g = clip01(color->c[1]);
- rgb->b = clip01(color->c[2]);
-}
-
-void GfxCalRGBColorSpace::getRGBLine(Guchar *in, unsigned int *out,
- int length) {
- Guchar *p;
- int i;
+ double X, Y, Z;
+ double r, g, b;
- for (i = 0, p = in; i < length; i++, p += 3)
- out[i] = (p[0] << 16) | (p[1] << 8) | (p[2] << 0);
+ getXYZ(color,&X,&Y,&Z);
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
+ double out[gfxColorMaxComps];
+ double in[gfxColorMaxComps];
+
+ in[0] = clip01(X/whiteX);
+ in[1] = clip01(Y/whiteY);
+ in[2] = clip01(Z/whiteZ);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ rgb->r = dblToCol(out[0]);
+ rgb->g = dblToCol(out[1]);
+ rgb->b = dblToCol(out[2]);
+ return;
+ }
+#endif
+ // convert XYZ to RGB, including gamut mapping and gamma correction
+ r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
+ g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
+ b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
+ rgb->r = dblToCol(pow(clip01(r), 0.5));
+ rgb->g = dblToCol(pow(clip01(g), 0.5));
+ rgb->b = dblToCol(pow(clip01(b), 0.5));
}
void GfxCalRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+ GfxRGB rgb;
GfxColorComp c, m, y, k;
- c = clip01(gfxColorComp1 - color->c[0]);
- m = clip01(gfxColorComp1 - color->c[1]);
- y = clip01(gfxColorComp1 - color->c[2]);
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_CMYK) {
+ double in[gfxColorMaxComps];
+ double out[gfxColorMaxComps];
+ double X, Y, Z;
+
+ getXYZ(color,&X,&Y,&Z);
+ in[0] = clip01(X);
+ in[1] = clip01(Y);
+ in[2] = clip01(Z);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ cmyk->c = dblToCol(out[0]);
+ cmyk->m = dblToCol(out[1]);
+ cmyk->y = dblToCol(out[2]);
+ cmyk->k = dblToCol(out[3]);
+ return;
+ }
+#endif
+ getRGB(color, &rgb);
+ c = clip01(gfxColorComp1 - rgb.r);
+ m = clip01(gfxColorComp1 - rgb.g);
+ y = clip01(gfxColorComp1 - rgb.b);
k = c;
if (m < k) {
k = m;
@@ -714,14 +1102,6 @@ void GfxDeviceCMYKColorSpace::getDefault
// GfxLabColorSpace
//------------------------------------------------------------------------
-// This is the inverse of MatrixLMN in Example 4.10 from the PostScript
-// Language Reference, Third Edition.
-static const double xyzrgb[3][3] = {
- { 3.240449, -1.537136, -0.498531 },
- { -0.969265, 1.876011, 0.041556 },
- { 0.055643, -0.204026, 1.057229 }
-};
-
GfxLabColorSpace::GfxLabColorSpace() {
whiteX = whiteY = whiteZ = 1;
blackX = blackY = blackZ = 0;
@@ -823,18 +1203,30 @@ GfxColorSpace *GfxLabColorSpace::parse(A
void GfxLabColorSpace::getGray(GfxColor *color, GfxGray *gray) {
GfxRGB rgb;
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) {
+ double out[gfxColorMaxComps];
+ double in[gfxColorMaxComps];
+
+ getXYZ(color, &in[0], &in[1], &in[2]);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ *gray = dblToCol(out[0]);
+ return;
+ }
+#endif
getRGB(color, &rgb);
*gray = clip01((GfxColorComp)(0.299 * rgb.r +
0.587 * rgb.g +
0.114 * rgb.b + 0.5));
}
-void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+// convert L*a*b* to media XYZ color space
+// (not multiply by the white point)
+void GfxLabColorSpace::getXYZ(GfxColor *color,
+ double *pX, double *pY, double *pZ) {
double X, Y, Z;
double t1, t2;
- double r, g, b;
- // convert L*a*b* to CIE 1931 XYZ color space
t1 = (colToDbl(color->c[0]) + 16) / 116;
t2 = t1 + colToDbl(color->c[1]) / 500;
if (t2 >= (6.0 / 29.0)) {
@@ -842,21 +1234,45 @@ void GfxLabColorSpace::getRGB(GfxColor *
} else {
X = (108.0 / 841.0) * (t2 - (4.0 / 29.0));
}
- X *= whiteX;
if (t1 >= (6.0 / 29.0)) {
Y = t1 * t1 * t1;
} else {
Y = (108.0 / 841.0) * (t1 - (4.0 / 29.0));
}
- Y *= whiteY;
t2 = t1 - colToDbl(color->c[2]) / 200;
if (t2 >= (6.0 / 29.0)) {
Z = t2 * t2 * t2;
} else {
Z = (108.0 / 841.0) * (t2 - (4.0 / 29.0));
}
- Z *= whiteZ;
+ *pX = X;
+ *pY = Y;
+ *pZ = Z;
+}
+
+void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+ double X, Y, Z;
+ double r, g, b;
+ getXYZ(color, &X, &Y, &Z);
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) {
+ double out[gfxColorMaxComps];
+ double in[gfxColorMaxComps];
+
+ in[0] = clip01(X);
+ in[1] = clip01(Y);
+ in[2] = clip01(Z);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ rgb->r = dblToCol(out[0]);
+ rgb->g = dblToCol(out[1]);
+ rgb->b = dblToCol(out[2]);
+ return;
+ }
+#endif
+ X *= whiteX;
+ Y *= whiteY;
+ Z *= whiteZ;
// convert XYZ to RGB, including gamut mapping and gamma correction
r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
@@ -870,6 +1286,20 @@ void GfxLabColorSpace::getCMYK(GfxColor
GfxRGB rgb;
GfxColorComp c, m, y, k;
+#ifdef USE_CMS
+ if (XYZ2DisplayTransform != NULL && displayPixelType == PT_CMYK) {
+ double in[gfxColorMaxComps];
+ double out[gfxColorMaxComps];
+
+ getXYZ(color, &in[0], &in[1], &in[2]);
+ XYZ2DisplayTransform->doTransform(in,out,1);
+ cmyk->c = dblToCol(out[0]);
+ cmyk->m = dblToCol(out[1]);
+ cmyk->y = dblToCol(out[2]);
+ cmyk->k = dblToCol(out[3]);
+ return;
+ }
+#endif
getRGB(color, &rgb);
c = clip01(gfxColorComp1 - rgb.r);
m = clip01(gfxColorComp1 - rgb.g);
@@ -926,10 +1356,22 @@ GfxICCBasedColorSpace::GfxICCBasedColorS
iccProfileStream = *iccProfileStreamA;
rangeMin[0] = rangeMin[1] = rangeMin[2] = rangeMin[3] = 0;
rangeMax[0] = rangeMax[1] = rangeMax[2] = rangeMax[3] = 1;
+#ifdef USE_CMS
+ transform = NULL;
+ lineTransform = NULL;
+#endif
}
GfxICCBasedColorSpace::~GfxICCBasedColorSpace() {
delete alt;
+#ifdef USE_CMS
+ if (transform != NULL) {
+ if (transform->unref() == 0) delete transform;
+ }
+ if (lineTransform != NULL) {
+ if (lineTransform->unref() == 0) delete lineTransform;
+ }
+#endif
}
GfxColorSpace *GfxICCBasedColorSpace::copy() {
@@ -941,6 +1383,12 @@ GfxColorSpace *GfxICCBasedColorSpace::co
cs->rangeMin[i] = rangeMin[i];
cs->rangeMax[i] = rangeMax[i];
}
+#ifdef USE_CMS
+ cs->transform = transform;
+ if (transform != NULL) transform->ref();
+ cs->lineTransform = lineTransform;
+ if (lineTransform != NULL) lineTransform->ref();
+#endif
return cs;
}
@@ -961,6 +1409,12 @@ GfxColorSpace *GfxICCBasedColorSpace::pa
iccProfileStreamA.gen = 0;
}
obj1.free();
+#ifdef USE_CMS
+ // check cache
+ if (iccProfileStreamA.num > 0
+ && (cs = GfxICCBasedCache::lookup(iccProfileStreamA.num,
+ iccProfileStreamA.gen)) != NULL) return cs;
+#endif
arr->get(1, &obj1);
if (!obj1.isStream()) {
error(-1, "Bad ICCBased color space (stream)");
@@ -1015,24 +1469,167 @@ GfxColorSpace *GfxICCBasedColorSpace::pa
}
obj2.free();
obj1.free();
+
+#ifdef USE_CMS
+ arr->get(1, &obj1);
+ dict = obj1.streamGetDict();
+ Guchar *profBuf;
+ unsigned int bufSize;
+ Stream *iccStream = obj1.getStream();
+ int c;
+ unsigned int size = 0;
+
+ bufSize = 65536;
+ profBuf = (Guchar *)gmallocn(bufSize,1);
+ iccStream->reset();
+ while ((c = iccStream->getChar()) != EOF) {
+ if (bufSize <= size) {
+ bufSize += 65536;
+ profBuf = (Guchar *)greallocn(profBuf,bufSize,1);
+ }
+ profBuf[size++] = c;
+ }
+ cmsHPROFILE hp = cmsOpenProfileFromMem(profBuf,size);
+ gfree(profBuf);
+ if (hp == 0) {
+ error(-1, "read ICCBased color space profile error");
+ } else {
+ cmsHPROFILE dhp = displayProfile;
+ if (dhp == NULL) dhp = RGBProfile;
+ unsigned int cst = getCMSColorSpaceType(cmsGetColorSpace(hp));
+ unsigned int dNChannels = getCMSNChannels(cmsGetColorSpace(dhp));
+ unsigned int dcst = getCMSColorSpaceType(cmsGetColorSpace(dhp));
+ cmsHTRANSFORM transform;
+ if ((transform = cmsCreateTransform(hp,
+ COLORSPACE_SH(cst) |CHANNELS_SH(nCompsA) | BYTES_SH(0),
+ dhp,
+ COLORSPACE_SH(dcst) |
+ CHANNELS_SH(dNChannels) | BYTES_SH(0),
+ INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
+ error(-1, "Can't create transform");
+ }
+ cs->transform = new GfxColorTransform(transform);
+ if (dcst == PT_RGB) {
+ // create line transform only when the display is RGB type color space
+ if ((transform = cmsCreateTransform(hp,
+ CHANNELS_SH(nCompsA) | BYTES_SH(1),dhp,
+ TYPE_RGB_8,INTENT_RELATIVE_COLORIMETRIC,0)) == 0) {
+ error(-1, "Can't create transform");
+ }
+ cs->lineTransform = new GfxColorTransform(transform);
+ }
+ cmsCloseProfile(hp);
+ }
+ obj1.free();
+ // put this colorSpace into cache
+ if (iccProfileStreamA.num > 0) {
+ GfxICCBasedCache::put(iccProfileStreamA.num,iccProfileStreamA.gen,cs);
+ }
+#endif
return cs;
}
void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+#ifdef USE_CMS
+ if (transform != 0 && displayPixelType == PT_GRAY) {
+ double in[gfxColorMaxComps];
+ double out[gfxColorMaxComps];
+
+ for (int i = 0;i < nComps;i++) {
+ in[i] = colToDbl(color->c[i]);
+ }
+ transform->doTransform(in,out,1);
+ *gray = dblToCol(out[0]);
+ } else {
+ GfxRGB rgb;
+ getRGB(color,&rgb);
+ *gray = clip01((GfxColorComp)(0.3 * rgb.r +
+ 0.59 * rgb.g +
+ 0.11 * rgb.b + 0.5));
+ }
+#else
alt->getGray(color, gray);
+#endif
}
void GfxICCBasedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+#ifdef USE_CMS
+ if (transform != 0
+ && (displayProfile == NULL || displayPixelType == PT_RGB)) {
+ double in[gfxColorMaxComps];
+ double out[gfxColorMaxComps];
+
+ for (int i = 0;i < nComps;i++) {
+ in[i] = colToDbl(color->c[i]);
+ }
+ transform->doTransform(in,out,1);
+ rgb->r = dblToCol(out[0]);
+ rgb->g = dblToCol(out[1]);
+ rgb->b = dblToCol(out[2]);
+ } else {
+ alt->getRGB(color, rgb);
+ }
+#else
alt->getRGB(color, rgb);
+#endif
}
void GfxICCBasedColorSpace::getRGBLine(Guchar *in, unsigned int *out,
int length) {
+#ifdef USE_CMS
+ if (lineTransform != 0) {
+ for (int i = 0;i < length;i++) {
+ Guchar tmp[gfxColorMaxComps];
+
+ lineTransform->doTransform(in,tmp,1);
+ in += nComps;
+ out[i] = (tmp[0] << 16) | (tmp[1] << 8) | tmp[2];
+ }
+ } else {
+ alt->getRGBLine(in, out, length);
+ }
+#else
alt->getRGBLine(in, out, length);
+#endif
}
void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+#ifdef USE_CMS
+ if (transform != NULL && displayPixelType == PT_CMYK) {
+ double in[gfxColorMaxComps];
+ double out[gfxColorMaxComps];
+
+ for (int i = 0;i < nComps;i++) {
+ in[i] = colToDbl(color->c[i]);
+ }
+ transform->doTransform(in,out,1);
+ cmyk->c = dblToCol(out[0]);
+ cmyk->m = dblToCol(out[1]);
+ cmyk->y = dblToCol(out[2]);
+ cmyk->k = dblToCol(out[3]);
+ } else {
+ GfxRGB rgb;
+ GfxColorComp c, m, y, k;
+
+ getRGB(color,&rgb);
+ c = clip01(gfxColorComp1 - rgb.r);
+ m = clip01(gfxColorComp1 - rgb.g);
+ y = clip01(gfxColorComp1 - rgb.b);
+ k = c;
+ if (m < k) {
+ k = m;
+ }
+ if (y < k) {
+ k = y;
+ }
+ cmyk->c = c - k;
+ cmyk->m = m - k;
+ cmyk->y = y - k;
+ cmyk->k = k;
+ }
+#else
alt->getCMYK(color, cmyk);
+#endif
}
void GfxICCBasedColorSpace::getDefaultColor(GfxColor *color) {
@@ -1066,6 +1663,56 @@ void GfxICCBasedColorSpace::getDefaultRa
#endif
}
+#ifdef USE_CMS
+GfxICCBasedCache
+ GfxICCBasedCache::cache[GFX_ICCBASED_CACHE_SIZE];
+
+GfxICCBasedCache::GfxICCBasedCache()
+{
+ num = 0;
+ gen = 0;
+ colorSpace = 0;
+}
+
+GfxICCBasedColorSpace *GfxICCBasedCache::lookup(int numA, int genA)
+{
+ int i;
+
+ if (cache[0].num == numA && cache[0].gen == genA) {
+ return (GfxICCBasedColorSpace *)cache[0].colorSpace->copy();
+ }
+ for (i = 1;i < GFX_ICCBASED_CACHE_SIZE && cache[i].num > 0;i++) {
+ if (cache[i].num == numA && cache[i].gen == genA) {
+ int j;
+ GfxICCBasedCache hit = cache[i];
+
+ for (j = i;j > 0;j--) {
+ if (cache[j - 1].num > 0) cache[j] = cache[j-1];
+ }
+ cache[0] = hit;
+ return (GfxICCBasedColorSpace *)hit.colorSpace->copy();
+ }
+ }
+ return NULL;
+}
+
+void GfxICCBasedCache::put(int numA, int genA,
+ GfxICCBasedColorSpace *cs)
+{
+ int i;
+
+ if (cache[GFX_ICCBASED_CACHE_SIZE-1].num > 0) {
+ delete cache[GFX_ICCBASED_CACHE_SIZE-1].colorSpace;
+ }
+ for (i = GFX_ICCBASED_CACHE_SIZE-1; i > 0; i--) {
+ if (cache[i - 1].num > 0) cache[i] = cache[i - 1];
+ }
+ cache[0].num = numA;
+ cache[0].gen = genA;
+ cache[0].colorSpace = (GfxICCBasedColorSpace *)cs->copy();
+}
+#endif
+
//------------------------------------------------------------------------
// GfxIndexedColorSpace
//------------------------------------------------------------------------
@@ -3938,6 +4585,9 @@ GfxState::GfxState(double hDPIA, double
clipYMax = pageHeight;
saved = NULL;
+#ifdef USE_CMS
+ GfxColorSpace::setupColorProfiles();
+#endif
}
GfxState::~GfxState() {

View file

@ -1,156 +0,0 @@
$NetBSD: patch-cb,v 1.1 2009/02/12 20:55:07 drochner Exp $
--- poppler/GfxState.h.orig 2009-01-20 16:54:29.000000000 +0100
+++ poppler/GfxState.h
@@ -32,6 +32,9 @@
#include "goo/gtypes.h"
#include "Object.h"
#include "Function.h"
+#ifdef USE_CMS
+#include "lcms.h"
+#endif
class Array;
class GfxFont;
@@ -151,6 +154,37 @@ enum GfxColorSpaceMode {
csPattern
};
+#ifdef USE_CMS
+
+#define COLOR_PROFILE_DIR "/ColorProfiles/"
+#define GLOBAL_COLOR_PROFILE_DIR POPPLER_DATADIR COLOR_PROFILE_DIR
+
+// wrapper of cmsHTRANSFORM to copy
+class GfxColorTransform {
+public:
+ void doTransform(void *in, void *out, unsigned int size) {
+ cmsDoTransform(transform, in, out, size);
+ }
+ GfxColorTransform(cmsHTRANSFORM transformA) {
+ transform = transformA;
+ refCount = 1;
+ }
+ ~GfxColorTransform() {
+ cmsDeleteTransform(transform);
+ }
+ void ref() {
+ refCount++;
+ }
+ unsigned int unref() {
+ return --refCount;
+ }
+private:
+ GfxColorTransform() {}
+ cmsHTRANSFORM transform;
+ unsigned int refCount;
+};
+#endif
+
class GfxColorSpace {
public:
@@ -191,6 +225,32 @@ public:
static char *getColorSpaceModeName(int idx);
private:
+#ifdef USE_CMS
+protected:
+ static cmsHPROFILE RGBProfile;
+ static GooString *displayProfileName; // display profile file Name
+ static cmsHPROFILE displayProfile; // display profile
+ static unsigned int displayPixelType;
+ static GfxColorTransform *XYZ2DisplayTransform;
+ // convert color space signature to cmsColor type
+ static unsigned int getCMSColorSpaceType(icColorSpaceSignature cs);
+ static unsigned int getCMSNChannels(icColorSpaceSignature cs);
+ static cmsHPROFILE loadColorProfile(const char *fileName);
+public:
+ static int setupColorProfiles();
+ static void setDisplayProfile(cmsHPROFILE displayProfileA) {
+ displayProfile = displayProfileA;
+ }
+ static void setDisplayProfileName(GooString *name) {
+ displayProfileName = name->copy();
+ }
+ static cmsHPROFILE getRGBProfile() {
+ return RGBProfile;
+ }
+ static cmsHPROFILE getDisplayProfile() {
+ return displayProfile;
+ }
+#endif
};
//------------------------------------------------------------------------
@@ -235,8 +295,6 @@ public:
virtual void getGray(GfxColor *color, GfxGray *gray);
virtual void getRGB(GfxColor *color, GfxRGB *rgb);
virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
- virtual void getGrayLine(Guchar *in, Guchar *out, int length);
- virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
virtual int getNComps() { return 1; }
virtual void getDefaultColor(GfxColor *color);
@@ -255,6 +313,8 @@ private:
double whiteX, whiteY, whiteZ; // white point
double blackX, blackY, blackZ; // black point
double gamma; // gamma value
+ double kr, kg, kb; // gamut mapping mulitpliers
+ void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ);
};
//------------------------------------------------------------------------
@@ -299,8 +359,6 @@ public:
virtual void getGray(GfxColor *color, GfxGray *gray);
virtual void getRGB(GfxColor *color, GfxRGB *rgb);
virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
- virtual void getGrayLine(Guchar *in, Guchar *out, int length);
- virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
virtual int getNComps() { return 3; }
virtual void getDefaultColor(GfxColor *color);
@@ -323,6 +381,8 @@ private:
double blackX, blackY, blackZ; // black point
double gammaR, gammaG, gammaB; // gamma values
double mat[9]; // ABC -> XYZ transform matrix
+ double kr, kg, kb; // gamut mapping mulitpliers
+ void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ);
};
//------------------------------------------------------------------------
@@ -390,6 +450,7 @@ private:
double blackX, blackY, blackZ; // black point
double aMin, aMax, bMin, bMax; // range for the a and b components
double kr, kg, kb; // gamut mapping mulitpliers
+ void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ);
};
//------------------------------------------------------------------------
@@ -429,7 +490,26 @@ private:
double rangeMin[4]; // min values for each component
double rangeMax[4]; // max values for each component
Ref iccProfileStream; // the ICC profile
+#ifdef USE_CMS
+ GfxColorTransform *transform;
+ GfxColorTransform *lineTransform; // color transform for line
+#endif
+};
+
+#ifdef USE_CMS
+#define GFX_ICCBASED_CACHE_SIZE 5
+class GfxICCBasedCache {
+public:
+ static GfxICCBasedColorSpace *lookup(int numA, int genA);
+ static void put(int numA, int genA, GfxICCBasedColorSpace *cs);
+private:
+ GfxICCBasedCache();
+ int num;
+ int gen;
+ GfxICCBasedColorSpace *colorSpace;
+ static GfxICCBasedCache cache[GFX_ICCBASED_CACHE_SIZE];
};
+#endif
//------------------------------------------------------------------------
// GfxIndexedColorSpace