diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-04-13 06:05:13 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-04-13 06:05:13 +0000 |
commit | 7de2289e693d3fd86402207517568f99511aa916 (patch) | |
tree | cd3257a84d8dfc5d761cd1ffe01d1297e5d464b2 /Build/source/libs/poppler/poppler-0.12.4/splash | |
parent | 4ca57b91804c5a4acb3152c4b5192a35e51ca3fe (diff) |
poppler build fixes
git-svn-id: svn://tug.org/texlive/trunk@22067 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/poppler/poppler-0.12.4/splash')
44 files changed, 0 insertions, 10892 deletions
diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/Makefile.am b/Build/source/libs/poppler/poppler-0.12.4/splash/Makefile.am deleted file mode 100644 index 914b308cf87..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/goo \ - $(FREETYPE_CFLAGS) - -noinst_LTLIBRARIES = libsplash.la - -if ENABLE_XPDF_HEADERS - -poppler_splash_includedir = $(includedir)/poppler/splash -poppler_splash_include_HEADERS = \ - Splash.h \ - SplashBitmap.h \ - SplashClip.h \ - SplashErrorCodes.h \ - SplashFTFont.h \ - SplashFTFontEngine.h \ - SplashFTFontFile.h \ - SplashFont.h \ - SplashFontEngine.h \ - SplashFontFile.h \ - SplashFontFileID.h \ - SplashGlyphBitmap.h \ - SplashMath.h \ - SplashPath.h \ - SplashPattern.h \ - SplashScreen.h \ - SplashState.h \ - SplashT1Font.h \ - SplashT1FontEngine.h \ - SplashT1FontFile.h \ - SplashTypes.h \ - SplashXPath.h \ - SplashXPathScanner.h - -endif - -libsplash_la_SOURCES = \ - Splash.cc \ - SplashBitmap.cc \ - SplashClip.cc \ - SplashFTFont.cc \ - SplashFTFontEngine.cc \ - SplashFTFontFile.cc \ - SplashFont.cc \ - SplashFontEngine.cc \ - SplashFontFile.cc \ - SplashFontFileID.cc \ - SplashPath.cc \ - SplashPattern.cc \ - SplashScreen.cc \ - SplashState.cc \ - SplashT1Font.cc \ - SplashT1FontEngine.cc \ - SplashT1FontFile.cc \ - SplashXPath.cc \ - SplashXPathScanner.cc diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/Makefile.in b/Build/source/libs/poppler/poppler-0.12.4/splash/Makefile.in deleted file mode 100644 index c47c6f228a3..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/Makefile.in +++ /dev/null @@ -1,687 +0,0 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = splash -DIST_COMMON = $(am__poppler_splash_include_HEADERS_DIST) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/define-dir.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/libjpeg.m4 $(top_srcdir)/m4/libpng.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/qt.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h \ - $(top_builddir)/poppler/poppler-config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libsplash_la_LIBADD = -am_libsplash_la_OBJECTS = Splash.lo SplashBitmap.lo SplashClip.lo \ - SplashFTFont.lo SplashFTFontEngine.lo SplashFTFontFile.lo \ - SplashFont.lo SplashFontEngine.lo SplashFontFile.lo \ - SplashFontFileID.lo SplashPath.lo SplashPattern.lo \ - SplashScreen.lo SplashState.lo SplashT1Font.lo \ - SplashT1FontEngine.lo SplashT1FontFile.lo SplashXPath.lo \ - SplashXPathScanner.lo -libsplash_la_OBJECTS = $(am_libsplash_la_OBJECTS) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -am__v_lt_0 = --silent -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/poppler -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_$(V)) -am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) -am__v_CXX_0 = @echo " CXX " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_$(V)) -am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CXXLD_0 = @echo " CXXLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(libsplash_la_SOURCES) -DIST_SOURCES = $(libsplash_la_SOURCES) -am__poppler_splash_include_HEADERS_DIST = Splash.h SplashBitmap.h \ - SplashClip.h SplashErrorCodes.h SplashFTFont.h \ - SplashFTFontEngine.h SplashFTFontFile.h SplashFont.h \ - SplashFontEngine.h SplashFontFile.h SplashFontFileID.h \ - SplashGlyphBitmap.h SplashMath.h SplashPath.h SplashPattern.h \ - SplashScreen.h SplashState.h SplashT1Font.h \ - SplashT1FontEngine.h SplashT1FontFile.h SplashTypes.h \ - SplashXPath.h SplashXPathScanner.h -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(poppler_splash_includedir)" -HEADERS = $(poppler_splash_include_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABIWORD_CFLAGS = @ABIWORD_CFLAGS@ -ABIWORD_LIBS = @ABIWORD_LIBS@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_FEATURE = @CAIRO_FEATURE@ -CAIRO_LIBS = @CAIRO_LIBS@ -CAIRO_REQ = @CAIRO_REQ@ -CAIRO_VERSION = @CAIRO_VERSION@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ -FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_CONFIG = @FREETYPE_CONFIG@ -FREETYPE_LIBS = @FREETYPE_LIBS@ -GDK_CFLAGS = @GDK_CFLAGS@ -GDK_FEATURE = @GDK_FEATURE@ -GDK_LIBS = @GDK_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTK_TEST_CFLAGS = @GTK_TEST_CFLAGS@ -GTK_TEST_LIBS = @GTK_TEST_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LCMS_CFLAGS = @LCMS_CFLAGS@ -LCMS_LIBS = @LCMS_LIBS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBJPEG_LIBS = @LIBJPEG_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBOPENJPEG_LIBS = @LIBOPENJPEG_LIBS@ -LIBPNG_LIBS = @LIBPNG_LIBS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MOCQT4 = @MOCQT4@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PC_REQUIRES = @PC_REQUIRES@ -PC_REQUIRES_PRIVATE = @PC_REQUIRES_PRIVATE@ -PKG_CONFIG = @PKG_CONFIG@ -POPPLER_DATADIR = @POPPLER_DATADIR@ -POPPLER_GLIB_CFLAGS = @POPPLER_GLIB_CFLAGS@ -POPPLER_GLIB_DISABLE_DEPRECATED = @POPPLER_GLIB_DISABLE_DEPRECATED@ -POPPLER_GLIB_DISABLE_SINGLE_INCLUDES = @POPPLER_GLIB_DISABLE_SINGLE_INCLUDES@ -POPPLER_GLIB_LIBS = @POPPLER_GLIB_LIBS@ -POPPLER_MAJOR_VERSION = @POPPLER_MAJOR_VERSION@ -POPPLER_MICRO_VERSION = @POPPLER_MICRO_VERSION@ -POPPLER_MINOR_VERSION = @POPPLER_MINOR_VERSION@ -POPPLER_QT4_CFLAGS = @POPPLER_QT4_CFLAGS@ -POPPLER_QT4_CXXFLAGS = @POPPLER_QT4_CXXFLAGS@ -POPPLER_QT4_LIBS = @POPPLER_QT4_LIBS@ -POPPLER_QT4_TEST_CFLAGS = @POPPLER_QT4_TEST_CFLAGS@ -POPPLER_QT4_TEST_LIBS = @POPPLER_QT4_TEST_LIBS@ -POPPLER_QT_CXXFLAGS = @POPPLER_QT_CXXFLAGS@ -POPPLER_QT_LIBS = @POPPLER_QT_LIBS@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMKMF = @XMKMF@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZLIB_LIBS = @ZLIB_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -acx_pthread_config = @acx_pthread_config@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -auto_import_flags = @auto_import_flags@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -create_shared_lib = @create_shared_lib@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -win32_libs = @win32_libs@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/goo \ - $(FREETYPE_CFLAGS) - -noinst_LTLIBRARIES = libsplash.la -@ENABLE_XPDF_HEADERS_TRUE@poppler_splash_includedir = $(includedir)/poppler/splash -@ENABLE_XPDF_HEADERS_TRUE@poppler_splash_include_HEADERS = \ -@ENABLE_XPDF_HEADERS_TRUE@ Splash.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashBitmap.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashClip.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashErrorCodes.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashFTFont.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashFTFontEngine.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashFTFontFile.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashFont.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashFontEngine.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashFontFile.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashFontFileID.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashGlyphBitmap.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashMath.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashPath.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashPattern.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashScreen.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashState.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashT1Font.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashT1FontEngine.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashT1FontFile.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashTypes.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashXPath.h \ -@ENABLE_XPDF_HEADERS_TRUE@ SplashXPathScanner.h - -libsplash_la_SOURCES = \ - Splash.cc \ - SplashBitmap.cc \ - SplashClip.cc \ - SplashFTFont.cc \ - SplashFTFontEngine.cc \ - SplashFTFontFile.cc \ - SplashFont.cc \ - SplashFontEngine.cc \ - SplashFontFile.cc \ - SplashFontFileID.cc \ - SplashPath.cc \ - SplashPattern.cc \ - SplashScreen.cc \ - SplashState.cc \ - SplashT1Font.cc \ - SplashT1FontEngine.cc \ - SplashT1FontFile.cc \ - SplashXPath.cc \ - SplashXPathScanner.cc - -all: all-am - -.SUFFIXES: -.SUFFIXES: .cc .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign splash/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign splash/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsplash.la: $(libsplash_la_OBJECTS) $(libsplash_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(libsplash_la_OBJECTS) $(libsplash_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Splash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashBitmap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashClip.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFTFont.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFTFontEngine.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFTFontFile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFont.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFontEngine.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFontFile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFontFileID.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashPath.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashPattern.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashScreen.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashState.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashT1Font.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashT1FontEngine.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashT1FontFile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashXPath.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashXPathScanner.Plo@am__quote@ - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cc.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-poppler_splash_includeHEADERS: $(poppler_splash_include_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(poppler_splash_includedir)" || $(MKDIR_P) "$(DESTDIR)$(poppler_splash_includedir)" - @list='$(poppler_splash_include_HEADERS)'; test -n "$(poppler_splash_includedir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(poppler_splash_includedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(poppler_splash_includedir)" || exit $$?; \ - done - -uninstall-poppler_splash_includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(poppler_splash_include_HEADERS)'; test -n "$(poppler_splash_includedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(poppler_splash_includedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(poppler_splash_includedir)" && rm -f $$files - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(poppler_splash_includedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-poppler_splash_includeHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-poppler_splash_includeHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am \ - install-poppler_splash_includeHEADERS install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-poppler_splash_includeHEADERS - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/Splash.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/Splash.cc deleted file mode 100644 index 834cb1097be..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/Splash.cc +++ /dev/null @@ -1,3573 +0,0 @@ -//======================================================================== -// -// Splash.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2005-2009 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <string.h> -#include <limits.h> -#include "goo/gmem.h" -#include "SplashErrorCodes.h" -#include "SplashMath.h" -#include "SplashBitmap.h" -#include "SplashState.h" -#include "SplashPath.h" -#include "SplashXPath.h" -#include "SplashXPathScanner.h" -#include "SplashPattern.h" -#include "SplashScreen.h" -#include "SplashFont.h" -#include "SplashGlyphBitmap.h" -#include "Splash.h" - -//------------------------------------------------------------------------ - -// distance of Bezier control point from center for circle approximation -// = (4 * (sqrt(2) - 1) / 3) * r -#define bezierCircle ((SplashCoord)0.55228475) -#define bezierCircle2 ((SplashCoord)(0.5 * 0.55228475)) - -// Divide a 16-bit value (in [0, 255*255]) by 255, returning an 8-bit result. -static inline Guchar div255(int x) { - return (Guchar)((x + (x >> 8) + 0x80) >> 8); -} - -//------------------------------------------------------------------------ -// SplashPipe -//------------------------------------------------------------------------ - -#define splashPipeMaxStages 9 - -struct SplashPipe { - // pixel coordinates - int x, y; - - // source pattern - SplashPattern *pattern; - - // source alpha and color - SplashCoord aInput; - GBool usesShape; - Guchar aSrc; - SplashColorPtr cSrc; - SplashColor cSrcVal; - - // non-isolated group alpha0 - Guchar *alpha0Ptr; - - // soft mask - SplashColorPtr softMaskPtr; - - // destination alpha and color - SplashColorPtr destColorPtr; - int destColorMask; - Guchar *destAlphaPtr; - - // shape - SplashCoord shape; - - // result alpha and color - GBool noTransparency; - SplashPipeResultColorCtrl resultColorCtrl; - - // non-isolated group correction - int nonIsolatedGroup; -}; - -SplashPipeResultColorCtrl Splash::pipeResultColorNoAlphaBlend[] = { - splashPipeResultColorNoAlphaBlendMono, - splashPipeResultColorNoAlphaBlendMono, - splashPipeResultColorNoAlphaBlendRGB, - splashPipeResultColorNoAlphaBlendRGB, - splashPipeResultColorNoAlphaBlendRGB -#if SPLASH_CMYK - , - splashPipeResultColorNoAlphaBlendCMYK -#endif -}; - -SplashPipeResultColorCtrl Splash::pipeResultColorAlphaNoBlend[] = { - splashPipeResultColorAlphaNoBlendMono, - splashPipeResultColorAlphaNoBlendMono, - splashPipeResultColorAlphaNoBlendRGB, - splashPipeResultColorNoAlphaBlendRGB, - splashPipeResultColorAlphaNoBlendRGB -#if SPLASH_CMYK - , - splashPipeResultColorAlphaNoBlendCMYK -#endif -}; - -SplashPipeResultColorCtrl Splash::pipeResultColorAlphaBlend[] = { - splashPipeResultColorAlphaBlendMono, - splashPipeResultColorAlphaBlendMono, - splashPipeResultColorAlphaBlendRGB, - splashPipeResultColorNoAlphaBlendRGB, - splashPipeResultColorAlphaBlendRGB -#if SPLASH_CMYK - , - splashPipeResultColorAlphaBlendCMYK -#endif -}; - -//------------------------------------------------------------------------ - -static void blendXor(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - blend[i] = src[i] ^ dest[i]; - } -} - -//------------------------------------------------------------------------ -// modified region -//------------------------------------------------------------------------ - -void Splash::clearModRegion() { - modXMin = bitmap->getWidth(); - modYMin = bitmap->getHeight(); - modXMax = -1; - modYMax = -1; -} - -inline void Splash::updateModX(int x) { - if (x < modXMin) { - modXMin = x; - } - if (x > modXMax) { - modXMax = x; - } -} - -inline void Splash::updateModY(int y) { - if (y < modYMin) { - modYMin = y; - } - if (y > modYMax) { - modYMax = y; - } -} - -//------------------------------------------------------------------------ -// pipeline -//------------------------------------------------------------------------ - -inline void Splash::pipeInit(SplashPipe *pipe, int x, int y, - SplashPattern *pattern, SplashColorPtr cSrc, - SplashCoord aInput, GBool usesShape, - GBool nonIsolatedGroup) { - pipeSetXY(pipe, x, y); - pipe->pattern = NULL; - - // source color - if (pattern) { - if (pattern->isStatic()) { - pattern->getColor(x, y, pipe->cSrcVal); - } else { - pipe->pattern = pattern; - } - pipe->cSrc = pipe->cSrcVal; - } else { - pipe->cSrc = cSrc; - } - - // source alpha - pipe->aInput = aInput; - if (!state->softMask) { - if (usesShape) { - pipe->aInput *= 255; - } else { - pipe->aSrc = (Guchar)splashRound(pipe->aInput * 255); - } - } - pipe->usesShape = usesShape; - - // result alpha - if (aInput == 1 && !state->softMask && !usesShape && - !state->inNonIsolatedGroup) { - pipe->noTransparency = gTrue; - } else { - pipe->noTransparency = gFalse; - } - - // result color - if (pipe->noTransparency) { - // the !state->blendFunc case is handled separately in pipeRun - pipe->resultColorCtrl = pipeResultColorNoAlphaBlend[bitmap->mode]; - } else if (!state->blendFunc) { - pipe->resultColorCtrl = pipeResultColorAlphaNoBlend[bitmap->mode]; - } else { - pipe->resultColorCtrl = pipeResultColorAlphaBlend[bitmap->mode]; - } - - // non-isolated group correction - if (nonIsolatedGroup) { - pipe->nonIsolatedGroup = splashColorModeNComps[bitmap->mode]; - } else { - pipe->nonIsolatedGroup = 0; - } -} - -inline void Splash::pipeRun(SplashPipe *pipe) { - Guchar aSrc, aDest, alpha2, alpha0, aResult; - SplashColor cDest, cBlend; - Guchar cResult0, cResult1, cResult2, cResult3; - - //----- source color - - // static pattern: handled in pipeInit - // fixed color: handled in pipeInit - - // dynamic pattern - if (pipe->pattern) { - pipe->pattern->getColor(pipe->x, pipe->y, pipe->cSrcVal); - } - - if (pipe->noTransparency && !state->blendFunc) { - - //----- write destination pixel - - switch (bitmap->mode) { - case splashModeMono1: - cResult0 = pipe->cSrc[0]; - if (state->screen->test(pipe->x, pipe->y, cResult0)) { - *pipe->destColorPtr |= pipe->destColorMask; - } else { - *pipe->destColorPtr &= ~pipe->destColorMask; - } - if (!(pipe->destColorMask >>= 1)) { - pipe->destColorMask = 0x80; - ++pipe->destColorPtr; - } - break; - case splashModeMono8: - *pipe->destColorPtr++ = pipe->cSrc[0]; - break; - case splashModeRGB8: - *pipe->destColorPtr++ = pipe->cSrc[0]; - *pipe->destColorPtr++ = pipe->cSrc[1]; - *pipe->destColorPtr++ = pipe->cSrc[2]; - break; - case splashModeXBGR8: - *pipe->destColorPtr++ = pipe->cSrc[2]; - *pipe->destColorPtr++ = pipe->cSrc[1]; - *pipe->destColorPtr++ = pipe->cSrc[0]; - *pipe->destColorPtr++ = 255; - break; - case splashModeBGR8: - *pipe->destColorPtr++ = pipe->cSrc[2]; - *pipe->destColorPtr++ = pipe->cSrc[1]; - *pipe->destColorPtr++ = pipe->cSrc[0]; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - *pipe->destColorPtr++ = pipe->cSrc[0]; - *pipe->destColorPtr++ = pipe->cSrc[1]; - *pipe->destColorPtr++ = pipe->cSrc[2]; - *pipe->destColorPtr++ = pipe->cSrc[3]; - break; -#endif - } - if (pipe->destAlphaPtr) { - *pipe->destAlphaPtr++ = 255; - } - - } else { - - //----- read destination pixel - - switch (bitmap->mode) { - case splashModeMono1: - cDest[0] = (*pipe->destColorPtr & pipe->destColorMask) ? 0xff : 0x00; - break; - case splashModeMono8: - cDest[0] = *pipe->destColorPtr; - break; - case splashModeRGB8: - cDest[0] = pipe->destColorPtr[0]; - cDest[1] = pipe->destColorPtr[1]; - cDest[2] = pipe->destColorPtr[2]; - break; - case splashModeXBGR8: - cDest[0] = pipe->destColorPtr[2]; - cDest[1] = pipe->destColorPtr[1]; - cDest[2] = pipe->destColorPtr[0]; - cDest[3] = 255; - break; - case splashModeBGR8: - cDest[0] = pipe->destColorPtr[2]; - cDest[1] = pipe->destColorPtr[1]; - cDest[2] = pipe->destColorPtr[0]; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - cDest[0] = pipe->destColorPtr[0]; - cDest[1] = pipe->destColorPtr[1]; - cDest[2] = pipe->destColorPtr[2]; - cDest[3] = pipe->destColorPtr[3]; - break; -#endif - } - if (pipe->destAlphaPtr) { - aDest = *pipe->destAlphaPtr; - } else { - aDest = 0xff; - } - - //----- blend function - - if (state->blendFunc) { - (*state->blendFunc)(pipe->cSrc, cDest, cBlend, bitmap->mode); - } - - //----- source alpha - - if (state->softMask) { - if (pipe->usesShape) { - aSrc = (Guchar)splashRound(pipe->aInput * *pipe->softMaskPtr++ - * pipe->shape); - } else { - aSrc = (Guchar)splashRound(pipe->aInput * *pipe->softMaskPtr++); - } - } else if (pipe->usesShape) { - // pipe->aInput is premultiplied by 255 in pipeInit - aSrc = (Guchar)splashRound(pipe->aInput * pipe->shape); - } else { - // precomputed in pipeInit - aSrc = pipe->aSrc; - } - - //----- result alpha and non-isolated group element correction - - if (pipe->noTransparency) { - alpha2 = aResult = 255; - } else { - aResult = aSrc + aDest - div255(aSrc * aDest); - - if (pipe->alpha0Ptr) { - alpha0 = *pipe->alpha0Ptr++; - alpha2 = aResult + alpha0 - div255(aResult * alpha0); - } else { - alpha2 = aResult; - } - } - - //----- result color - - cResult0 = cResult1 = cResult2 = cResult3 = 0; // make gcc happy - - switch (pipe->resultColorCtrl) { - -#if SPLASH_CMYK - case splashPipeResultColorNoAlphaBlendCMYK: - cResult3 = div255((255 - aDest) * pipe->cSrc[3] + aDest * cBlend[3]); -#endif - case splashPipeResultColorNoAlphaBlendRGB: - cResult2 = div255((255 - aDest) * pipe->cSrc[2] + aDest * cBlend[2]); - cResult1 = div255((255 - aDest) * pipe->cSrc[1] + aDest * cBlend[1]); - case splashPipeResultColorNoAlphaBlendMono: - cResult0 = div255((255 - aDest) * pipe->cSrc[0] + aDest * cBlend[0]); - break; - - case splashPipeResultColorAlphaNoBlendMono: - if (alpha2 == 0) { - cResult0 = 0; - } else { - cResult0 = (Guchar)(((alpha2 - aSrc) * cDest[0] + - aSrc * pipe->cSrc[0]) / alpha2); - } - break; - case splashPipeResultColorAlphaNoBlendRGB: - if (alpha2 == 0) { - cResult0 = 0; - cResult1 = 0; - cResult2 = 0; - } else { - cResult0 = (Guchar)(((alpha2 - aSrc) * cDest[0] + - aSrc * pipe->cSrc[0]) / alpha2); - cResult1 = (Guchar)(((alpha2 - aSrc) * cDest[1] + - aSrc * pipe->cSrc[1]) / alpha2); - cResult2 = (Guchar)(((alpha2 - aSrc) * cDest[2] + - aSrc * pipe->cSrc[2]) / alpha2); - } - break; -#if SPLASH_CMYK - case splashPipeResultColorAlphaNoBlendCMYK: - if (alpha2 == 0) { - cResult0 = 0; - cResult1 = 0; - cResult2 = 0; - cResult3 = 0; - } else { - cResult0 = (Guchar)(((alpha2 - aSrc) * cDest[0] + - aSrc * pipe->cSrc[0]) / alpha2); - cResult1 = (Guchar)(((alpha2 - aSrc) * cDest[1] + - aSrc * pipe->cSrc[1]) / alpha2); - cResult2 = (Guchar)(((alpha2 - aSrc) * cDest[2] + - aSrc * pipe->cSrc[2]) / alpha2); - cResult3 = (Guchar)(((alpha2 - aSrc) * cDest[3] + - aSrc * pipe->cSrc[3]) / alpha2); - } - break; -#endif - - case splashPipeResultColorAlphaBlendMono: - if (alpha2 == 0) { - cResult0 = 0; - } else { - cResult0 = (Guchar)(((alpha2 - aSrc) * cDest[0] + - aSrc * ((255 - aDest) * pipe->cSrc[0] + - aDest * cBlend[0]) / 255) / - alpha2); - } - break; - case splashPipeResultColorAlphaBlendRGB: - if (alpha2 == 0) { - cResult0 = 0; - cResult1 = 0; - cResult2 = 0; - } else { - cResult0 = (Guchar)(((alpha2 - aSrc) * cDest[0] + - aSrc * ((255 - aDest) * pipe->cSrc[0] + - aDest * cBlend[0]) / 255) / - alpha2); - cResult1 = (Guchar)(((alpha2 - aSrc) * cDest[1] + - aSrc * ((255 - aDest) * pipe->cSrc[1] + - aDest * cBlend[1]) / 255) / - alpha2); - cResult2 = (Guchar)(((alpha2 - aSrc) * cDest[2] + - aSrc * ((255 - aDest) * pipe->cSrc[2] + - aDest * cBlend[2]) / 255) / - alpha2); - } - break; -#if SPLASH_CMYK - case splashPipeResultColorAlphaBlendCMYK: - if (alpha2 == 0) { - cResult0 = 0; - cResult1 = 0; - cResult2 = 0; - cResult3 = 0; - } else { - cResult0 = (Guchar)(((alpha2 - aSrc) * cDest[0] + - aSrc * ((255 - aDest) * pipe->cSrc[0] + - aDest * cBlend[0]) / 255) / - alpha2); - cResult1 = (Guchar)(((alpha2 - aSrc) * cDest[1] + - aSrc * ((255 - aDest) * pipe->cSrc[1] + - aDest * cBlend[1]) / 255) / - alpha2); - cResult2 = (Guchar)(((alpha2 - aSrc) * cDest[2] + - aSrc * ((255 - aDest) * pipe->cSrc[2] + - aDest * cBlend[2]) / 255) / - alpha2); - cResult3 = (Guchar)(((alpha2 - aSrc) * cDest[3] + - aSrc * ((255 - aDest) * pipe->cSrc[3] + - aDest * cBlend[3]) / 255) / - alpha2); - } - break; -#endif - } - - //----- non-isolated group correction - - if (aResult != 0) { - switch (pipe->nonIsolatedGroup) { -#if SPLASH_CMYK - case 4: - cResult3 += (cResult3 - cDest[3]) * aDest * - (255 - aResult) / (255 * aResult); -#endif - case 3: - cResult2 += (cResult2 - cDest[2]) * aDest * - (255 - aResult) / (255 * aResult); - cResult1 += (cResult1 - cDest[1]) * aDest * - (255 - aResult) / (255 * aResult); - case 1: - cResult0 += (cResult0 - cDest[0]) * aDest * - (255 - aResult) / (255 * aResult); - case 0: - break; - } - } - - //----- write destination pixel - - switch (bitmap->mode) { - case splashModeMono1: - if (state->screen->test(pipe->x, pipe->y, cResult0)) { - *pipe->destColorPtr |= pipe->destColorMask; - } else { - *pipe->destColorPtr &= ~pipe->destColorMask; - } - if (!(pipe->destColorMask >>= 1)) { - pipe->destColorMask = 0x80; - ++pipe->destColorPtr; - } - break; - case splashModeMono8: - *pipe->destColorPtr++ = cResult0; - break; - case splashModeRGB8: - *pipe->destColorPtr++ = cResult0; - *pipe->destColorPtr++ = cResult1; - *pipe->destColorPtr++ = cResult2; - break; - case splashModeXBGR8: - *pipe->destColorPtr++ = cResult2; - *pipe->destColorPtr++ = cResult1; - *pipe->destColorPtr++ = cResult0; - *pipe->destColorPtr++ = 255; - break; - case splashModeBGR8: - *pipe->destColorPtr++ = cResult2; - *pipe->destColorPtr++ = cResult1; - *pipe->destColorPtr++ = cResult0; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - *pipe->destColorPtr++ = cResult0; - *pipe->destColorPtr++ = cResult1; - *pipe->destColorPtr++ = cResult2; - *pipe->destColorPtr++ = cResult3; - break; -#endif - } - if (pipe->destAlphaPtr) { - *pipe->destAlphaPtr++ = aResult; - } - - } - - ++pipe->x; -} - -inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) { - pipe->x = x; - pipe->y = y; - if (state->softMask) { - pipe->softMaskPtr = - &state->softMask->data[y * state->softMask->rowSize + x]; - } - switch (bitmap->mode) { - case splashModeMono1: - pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (x >> 3)]; - pipe->destColorMask = 0x80 >> (x & 7); - break; - case splashModeMono8: - pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + x]; - break; - case splashModeRGB8: - case splashModeBGR8: - pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x]; - break; - case splashModeXBGR8: - pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; - break; -#endif - } - if (bitmap->alpha) { - pipe->destAlphaPtr = &bitmap->alpha[y * bitmap->width + x]; - } else { - pipe->destAlphaPtr = NULL; - } - if (state->inNonIsolatedGroup && alpha0Bitmap->alpha) { - pipe->alpha0Ptr = - &alpha0Bitmap->alpha[(alpha0Y + y) * alpha0Bitmap->width + - (alpha0X + x)]; - } else { - pipe->alpha0Ptr = NULL; - } -} - -inline void Splash::pipeIncX(SplashPipe *pipe) { - ++pipe->x; - if (state->softMask) { - ++pipe->softMaskPtr; - } - switch (bitmap->mode) { - case splashModeMono1: - if (!(pipe->destColorMask >>= 1)) { - pipe->destColorMask = 0x80; - ++pipe->destColorPtr; - } - break; - case splashModeMono8: - ++pipe->destColorPtr; - break; - case splashModeRGB8: - case splashModeBGR8: - pipe->destColorPtr += 3; - break; - case splashModeXBGR8: - pipe->destColorPtr += 4; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - pipe->destColorPtr += 4; - break; -#endif - } - if (pipe->destAlphaPtr) { - ++pipe->destAlphaPtr; - } - if (pipe->alpha0Ptr) { - ++pipe->alpha0Ptr; - } -} - -inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, GBool noClip) { - if (noClip || state->clip->test(x, y)) { - pipeSetXY(pipe, x, y); - pipeRun(pipe); - updateModX(x); - updateModY(y); - } -} - -inline void Splash::drawAAPixelInit() { - aaBufY = -1; -} - -inline void Splash::drawAAPixel(SplashPipe *pipe, int x, int y) { -#if splashAASize == 4 - static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3, - 1, 2, 2, 3, 2, 3, 3, 4 }; - int w; -#else - int xx, yy; -#endif - SplashColorPtr p; - int x0, x1, t; - - if (x < 0 || x >= bitmap->width || - y < state->clip->getYMinI() || y > state->clip->getYMaxI()) { - return; - } - - // update aaBuf - if (y != aaBufY) { - memset(aaBuf->getDataPtr(), 0xff, - aaBuf->getRowSize() * aaBuf->getHeight()); - x0 = 0; - x1 = bitmap->width - 1; - state->clip->clipAALine(aaBuf, &x0, &x1, y); - aaBufY = y; - } - - // compute the shape value -#if splashAASize == 4 - p = aaBuf->getDataPtr() + (x >> 1); - w = aaBuf->getRowSize(); - if (x & 1) { - t = bitCount4[*p & 0x0f] + bitCount4[p[w] & 0x0f] + - bitCount4[p[2*w] & 0x0f] + bitCount4[p[3*w] & 0x0f]; - } else { - t = bitCount4[*p >> 4] + bitCount4[p[w] >> 4] + - bitCount4[p[2*w] >> 4] + bitCount4[p[3*w] >> 4]; - } -#else - t = 0; - for (yy = 0; yy < splashAASize; ++yy) { - for (xx = 0; xx < splashAASize; ++xx) { - p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + - ((x * splashAASize + xx) >> 3); - t += (*p >> (7 - ((x * splashAASize + xx) & 7))) & 1; - } - } -#endif - - // draw the pixel - if (t != 0) { - pipeSetXY(pipe, x, y); - pipe->shape *= aaGamma[t]; - pipeRun(pipe); - updateModX(x); - updateModY(y); - } -} - -inline void Splash::drawSpan(SplashPipe *pipe, int x0, int x1, int y, - GBool noClip) { - int x; - - pipeSetXY(pipe, x0, y); - if (noClip) { - for (x = x0; x <= x1; ++x) { - pipeRun(pipe); - } - updateModX(x0); - updateModX(x1); - updateModY(y); - } else { - for (x = x0; x <= x1; ++x) { - if (state->clip->test(x, y)) { - pipeRun(pipe); - updateModX(x); - updateModY(y); - } else { - pipeIncX(pipe); - } - } - } -} - -inline void Splash::drawAALine(SplashPipe *pipe, int x0, int x1, int y) { -#if splashAASize == 4 - static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3, - 1, 2, 2, 3, 2, 3, 3, 4 }; - SplashColorPtr p0, p1, p2, p3; - int t; -#else - SplashColorPtr p; - int xx, yy, t; -#endif - int x; - -#if splashAASize == 4 - p0 = aaBuf->getDataPtr() + (x0 >> 1); - p1 = p0 + aaBuf->getRowSize(); - p2 = p1 + aaBuf->getRowSize(); - p3 = p2 + aaBuf->getRowSize(); -#endif - pipeSetXY(pipe, x0, y); - for (x = x0; x <= x1; ++x) { - - // compute the shape value -#if splashAASize == 4 - if (x & 1) { - t = bitCount4[*p0 & 0x0f] + bitCount4[*p1 & 0x0f] + - bitCount4[*p2 & 0x0f] + bitCount4[*p3 & 0x0f]; - ++p0; ++p1; ++p2; ++p3; - } else { - t = bitCount4[*p0 >> 4] + bitCount4[*p1 >> 4] + - bitCount4[*p2 >> 4] + bitCount4[*p3 >> 4]; - } -#else - t = 0; - for (yy = 0; yy < splashAASize; ++yy) { - for (xx = 0; xx < splashAASize; ++xx) { - p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + - ((x * splashAASize + xx) >> 3); - t += (*p >> (7 - ((x * splashAASize + xx) & 7))) & 1; - } - } -#endif - - if (t != 0) { - pipe->shape = aaGamma[t]; - pipeRun(pipe); - updateModX(x); - updateModY(y); - } else { - pipeIncX(pipe); - } - } -} - -//------------------------------------------------------------------------ - -// Transform a point from user space to device space. -inline void Splash::transform(SplashCoord *matrix, - SplashCoord xi, SplashCoord yi, - SplashCoord *xo, SplashCoord *yo) { - // [ m[0] m[1] 0 ] - // [xo yo 1] = [xi yi 1] * [ m[2] m[3] 0 ] - // [ m[4] m[5] 1 ] - *xo = xi * matrix[0] + yi * matrix[2] + matrix[4]; - *yo = xi * matrix[1] + yi * matrix[3] + matrix[5]; -} - -//------------------------------------------------------------------------ -// Splash -//------------------------------------------------------------------------ - -Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreenParams *screenParams) { - int i; - - bitmap = bitmapA; - vectorAntialias = vectorAntialiasA; - state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, - screenParams); - if (vectorAntialias) { - aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, - 1, splashModeMono1, gFalse); - for (i = 0; i <= splashAASize * splashAASize; ++i) { - aaGamma[i] = splashPow((SplashCoord)i / - (SplashCoord)(splashAASize * splashAASize), - 1.5); - } - } else { - aaBuf = NULL; - } - clearModRegion(); - debugMode = gFalse; -} - -Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreen *screenA) { - int i; - - bitmap = bitmapA; - vectorAntialias = vectorAntialiasA; - state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, - screenA); - if (vectorAntialias) { - aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, - 1, splashModeMono1, gFalse); - for (i = 0; i <= splashAASize * splashAASize; ++i) { - aaGamma[i] = splashPow((SplashCoord)i / - (SplashCoord)(splashAASize * splashAASize), - 1.5); - } - } else { - aaBuf = NULL; - } - clearModRegion(); - debugMode = gFalse; -} - -Splash::~Splash() { - while (state->next) { - restoreState(); - } - delete state; - if (vectorAntialias) { - delete aaBuf; - } -} - -//------------------------------------------------------------------------ -// state read -//------------------------------------------------------------------------ - -SplashCoord *Splash::getMatrix() { - return state->matrix; -} - -SplashPattern *Splash::getStrokePattern() { - return state->strokePattern; -} - -SplashPattern *Splash::getFillPattern() { - return state->fillPattern; -} - -SplashScreen *Splash::getScreen() { - return state->screen; -} - -SplashBlendFunc Splash::getBlendFunc() { - return state->blendFunc; -} - -SplashCoord Splash::getStrokeAlpha() { - return state->strokeAlpha; -} - -SplashCoord Splash::getFillAlpha() { - return state->fillAlpha; -} - -SplashCoord Splash::getLineWidth() { - return state->lineWidth; -} - -int Splash::getLineCap() { - return state->lineCap; -} - -int Splash::getLineJoin() { - return state->lineJoin; -} - -SplashCoord Splash::getMiterLimit() { - return state->miterLimit; -} - -SplashCoord Splash::getFlatness() { - return state->flatness; -} - -SplashCoord *Splash::getLineDash() { - return state->lineDash; -} - -int Splash::getLineDashLength() { - return state->lineDashLength; -} - -SplashCoord Splash::getLineDashPhase() { - return state->lineDashPhase; -} - -SplashClip *Splash::getClip() { - return state->clip; -} - -SplashBitmap *Splash::getSoftMask() { - return state->softMask; -} - -GBool Splash::getInNonIsolatedGroup() { - return state->inNonIsolatedGroup; -} - -//------------------------------------------------------------------------ -// state write -//------------------------------------------------------------------------ - -void Splash::setMatrix(SplashCoord *matrix) { - memcpy(state->matrix, matrix, 6 * sizeof(SplashCoord)); -} - -void Splash::setStrokePattern(SplashPattern *strokePattern) { - state->setStrokePattern(strokePattern); -} - -void Splash::setFillPattern(SplashPattern *fillPattern) { - state->setFillPattern(fillPattern); -} - -void Splash::setScreen(SplashScreen *screen) { - state->setScreen(screen); -} - -void Splash::setBlendFunc(SplashBlendFunc func) { - state->blendFunc = func; -} - -void Splash::setStrokeAlpha(SplashCoord alpha) { - state->strokeAlpha = alpha; -} - -void Splash::setFillAlpha(SplashCoord alpha) { - state->fillAlpha = alpha; -} - -void Splash::setLineWidth(SplashCoord lineWidth) { - state->lineWidth = lineWidth; -} - -void Splash::setLineCap(int lineCap) { - state->lineCap = lineCap; -} - -void Splash::setLineJoin(int lineJoin) { - state->lineJoin = lineJoin; -} - -void Splash::setMiterLimit(SplashCoord miterLimit) { - state->miterLimit = miterLimit; -} - -void Splash::setFlatness(SplashCoord flatness) { - if (flatness < 1) { - state->flatness = 1; - } else { - state->flatness = flatness; - } -} - -void Splash::setLineDash(SplashCoord *lineDash, int lineDashLength, - SplashCoord lineDashPhase) { - state->setLineDash(lineDash, lineDashLength, lineDashPhase); -} - -void Splash::setStrokeAdjust(GBool strokeAdjust) { - state->strokeAdjust = strokeAdjust; -} - -void Splash::clipResetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - state->clip->resetToRect(x0, y0, x1, y1); -} - -SplashError Splash::clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - return state->clip->clipToRect(x0, y0, x1, y1); -} - -SplashError Splash::clipToPath(SplashPath *path, GBool eo) { - return state->clip->clipToPath(path, state->matrix, state->flatness, eo); -} - -void Splash::setSoftMask(SplashBitmap *softMask) { - state->setSoftMask(softMask); -} - -void Splash::setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA, - int alpha0XA, int alpha0YA) { - alpha0Bitmap = alpha0BitmapA; - alpha0X = alpha0XA; - alpha0Y = alpha0YA; - state->inNonIsolatedGroup = gTrue; -} - -//------------------------------------------------------------------------ -// state save/restore -//------------------------------------------------------------------------ - -void Splash::saveState() { - SplashState *newState; - - newState = state->copy(); - newState->next = state; - state = newState; -} - -SplashError Splash::restoreState() { - SplashState *oldState; - - if (!state->next) { - return splashErrNoSave; - } - oldState = state; - state = state->next; - delete oldState; - return splashOk; -} - -//------------------------------------------------------------------------ -// drawing operations -//------------------------------------------------------------------------ - -void Splash::clear(SplashColorPtr color, Guchar alpha) { - SplashColorPtr row, p; - Guchar mono; - int x, y; - - switch (bitmap->mode) { - case splashModeMono1: - mono = (color[0] & 0x80) ? 0xff : 0x00; - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - mono, -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, mono, bitmap->rowSize * bitmap->height); - } - break; - case splashModeMono8: - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - break; - case splashModeRGB8: - if (color[0] == color[1] && color[1] == color[2]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[2]; - *p++ = color[1]; - *p++ = color[0]; - } - row += bitmap->rowSize; - } - } - break; - case splashModeXBGR8: - if (color[0] == color[1] && color[1] == color[2]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[0]; - *p++ = color[1]; - *p++ = color[2]; - *p++ = 255; - } - row += bitmap->rowSize; - } - } - break; - case splashModeBGR8: - if (color[0] == color[1] && color[1] == color[2]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[0]; - *p++ = color[1]; - *p++ = color[2]; - } - row += bitmap->rowSize; - } - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[0]; - *p++ = color[1]; - *p++ = color[2]; - *p++ = color[3]; - } - row += bitmap->rowSize; - } - } - break; -#endif - } - - if (bitmap->alpha) { - memset(bitmap->alpha, alpha, bitmap->width * bitmap->height); - } - - updateModX(0); - updateModY(0); - updateModX(bitmap->width - 1); - updateModY(bitmap->height - 1); -} - -SplashError Splash::stroke(SplashPath *path) { - SplashPath *path2, *dPath; - - if (debugMode) { - printf("stroke [dash:%d] [width:%.2f]:\n", - state->lineDashLength, (double)state->lineWidth); - dumpPath(path); - } - opClipRes = splashClipAllOutside; - if (path->length == 0) { - return splashErrEmptyPath; - } - path2 = flattenPath(path, state->matrix, state->flatness); - if (state->lineDashLength > 0) { - dPath = makeDashedPath(path2); - delete path2; - path2 = dPath; - } - if (state->lineWidth == 0) { - strokeNarrow(path2); - } else { - strokeWide(path2); - } - delete path2; - return splashOk; -} - -void Splash::strokeNarrow(SplashPath *path) { - SplashPipe pipe; - SplashXPath *xPath; - SplashXPathSeg *seg; - int x0, x1, x2, x3, y0, y1, x, y, t; - SplashCoord dx, dy, dxdy; - SplashClipResult clipRes; - int nClipRes[3]; - int i; - - nClipRes[0] = nClipRes[1] = nClipRes[2] = 0; - - xPath = new SplashXPath(path, state->matrix, state->flatness, gFalse); - - pipeInit(&pipe, 0, 0, state->strokePattern, NULL, state->strokeAlpha, - gFalse, gFalse); - - for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) { - - x0 = splashFloor(seg->x0); - x1 = splashFloor(seg->x1); - y0 = splashFloor(seg->y0); - y1 = splashFloor(seg->y1); - - // horizontal segment - if (y0 == y1) { - if (x0 > x1) { - t = x0; x0 = x1; x1 = t; - } - if ((clipRes = state->clip->testSpan(x0, x1, y0)) - != splashClipAllOutside) { - drawSpan(&pipe, x0, x1, y0, clipRes == splashClipAllInside); - } - - // segment with |dx| > |dy| - } else if (splashAbs(seg->dxdy) > 1) { - dx = seg->x1 - seg->x0; - dy = seg->y1 - seg->y0; - dxdy = seg->dxdy; - if (y0 > y1) { - t = y0; y0 = y1; y1 = t; - t = x0; x0 = x1; x1 = t; - dx = -dx; - dy = -dy; - } - if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0, - x0 <= x1 ? x1 : x0, y1)) - != splashClipAllOutside) { - if (dx > 0) { - x2 = x0; - x3 = splashFloor(seg->x0 + ((SplashCoord)y0 + 1 - seg->y0) * dxdy); - drawSpan(&pipe, x2, (x2 <= x3 - 1) ? x3 - 1 : x2, y0, - clipRes == splashClipAllInside); - x2 = x3; - for (y = y0 + 1; y <= y1 - 1; ++y) { - x3 = splashFloor(seg->x0 + ((SplashCoord)y + 1 - seg->y0) * dxdy); - drawSpan(&pipe, x2, x3 - 1, y, clipRes == splashClipAllInside); - x2 = x3; - } - drawSpan(&pipe, x2, x2 <= x1 ? x1 : x2, y1, - clipRes == splashClipAllInside); - } else { - x2 = x0; - x3 = splashFloor(seg->x0 + ((SplashCoord)y0 + 1 - seg->y0) * dxdy); - drawSpan(&pipe, (x3 + 1 <= x2) ? x3 + 1 : x2, x2, y0, - clipRes == splashClipAllInside); - x2 = x3; - for (y = y0 + 1; y <= y1 - 1; ++y) { - x3 = splashFloor(seg->x0 + ((SplashCoord)y + 1 - seg->y0) * dxdy); - drawSpan(&pipe, x3 + 1, x2, y, clipRes == splashClipAllInside); - x2 = x3; - } - drawSpan(&pipe, x1, (x1 <= x2) ? x2 : x1, y1, - clipRes == splashClipAllInside); - } - } - - // segment with |dy| > |dx| - } else { - dxdy = seg->dxdy; - if (y0 > y1) { - t = x0; x0 = x1; x1 = t; - t = y0; y0 = y1; y1 = t; - } - if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0, - x0 <= x1 ? x1 : x0, y1)) - != splashClipAllOutside) { - drawPixel(&pipe, x0, y0, clipRes == splashClipAllInside); - for (y = y0 + 1; y <= y1 - 1; ++y) { - x = splashFloor(seg->x0 + ((SplashCoord)y - seg->y0) * dxdy); - drawPixel(&pipe, x, y, clipRes == splashClipAllInside); - } - drawPixel(&pipe, x1, y1, clipRes == splashClipAllInside); - } - } - ++nClipRes[clipRes]; - } - if (nClipRes[splashClipPartial] || - (nClipRes[splashClipAllInside] && nClipRes[splashClipAllOutside])) { - opClipRes = splashClipPartial; - } else if (nClipRes[splashClipAllInside]) { - opClipRes = splashClipAllInside; - } else { - opClipRes = splashClipAllOutside; - } - - delete xPath; -} - -void Splash::strokeWide(SplashPath *path) { - SplashPath *path2; - - path2 = makeStrokePath(path, gFalse); - fillWithPattern(path2, gFalse, state->strokePattern, state->strokeAlpha); - delete path2; -} - -SplashPath *Splash::flattenPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness) { - SplashPath *fPath; - SplashCoord flatness2; - Guchar flag; - int i; - - fPath = new SplashPath(); - flatness2 = flatness * flatness; - i = 0; - while (i < path->length) { - flag = path->flags[i]; - if (flag & splashPathFirst) { - fPath->moveTo(path->pts[i].x, path->pts[i].y); - ++i; - } else { - if (flag & splashPathCurve) { - flattenCurve(path->pts[i-1].x, path->pts[i-1].y, - path->pts[i ].x, path->pts[i ].y, - path->pts[i+1].x, path->pts[i+1].y, - path->pts[i+2].x, path->pts[i+2].y, - matrix, flatness2, fPath); - i += 3; - } else { - fPath->lineTo(path->pts[i].x, path->pts[i].y); - ++i; - } - if (path->flags[i-1] & splashPathClosed) { - fPath->close(); - } - } - } - return fPath; -} - -void Splash::flattenCurve(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3, - SplashCoord *matrix, SplashCoord flatness2, - SplashPath *fPath) { - SplashCoord cx[splashMaxCurveSplits + 1][3]; - SplashCoord cy[splashMaxCurveSplits + 1][3]; - int cNext[splashMaxCurveSplits + 1]; - SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh; - SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh; - SplashCoord dx, dy, mx, my, tx, ty, d1, d2; - int p1, p2, p3; - - // initial segment - p1 = 0; - p2 = splashMaxCurveSplits; - cx[p1][0] = x0; cy[p1][0] = y0; - cx[p1][1] = x1; cy[p1][1] = y1; - cx[p1][2] = x2; cy[p1][2] = y2; - cx[p2][0] = x3; cy[p2][0] = y3; - cNext[p1] = p2; - - while (p1 < splashMaxCurveSplits) { - - // get the next segment - xl0 = cx[p1][0]; yl0 = cy[p1][0]; - xx1 = cx[p1][1]; yy1 = cy[p1][1]; - xx2 = cx[p1][2]; yy2 = cy[p1][2]; - p2 = cNext[p1]; - xr3 = cx[p2][0]; yr3 = cy[p2][0]; - - // compute the distances (in device space) from the control points - // to the midpoint of the straight line (this is a bit of a hack, - // but it's much faster than computing the actual distances to the - // line) - transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my); - transform(matrix, xx1, yy1, &tx, &ty); - dx = tx - mx; - dy = ty - my; - d1 = dx*dx + dy*dy; - transform(matrix, xx2, yy2, &tx, &ty); - dx = tx - mx; - dy = ty - my; - d2 = dx*dx + dy*dy; - - // if the curve is flat enough, or no more subdivisions are - // allowed, add the straight line segment - if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) { - fPath->lineTo(xr3, yr3); - p1 = p2; - - // otherwise, subdivide the curve - } else { - xl1 = (xl0 + xx1) * 0.5; - yl1 = (yl0 + yy1) * 0.5; - xh = (xx1 + xx2) * 0.5; - yh = (yy1 + yy2) * 0.5; - xl2 = (xl1 + xh) * 0.5; - yl2 = (yl1 + yh) * 0.5; - xr2 = (xx2 + xr3) * 0.5; - yr2 = (yy2 + yr3) * 0.5; - xr1 = (xh + xr2) * 0.5; - yr1 = (yh + yr2) * 0.5; - xr0 = (xl2 + xr1) * 0.5; - yr0 = (yl2 + yr1) * 0.5; - // add the new subdivision points - p3 = (p1 + p2) / 2; - cx[p1][1] = xl1; cy[p1][1] = yl1; - cx[p1][2] = xl2; cy[p1][2] = yl2; - cNext[p1] = p3; - cx[p3][0] = xr0; cy[p3][0] = yr0; - cx[p3][1] = xr1; cy[p3][1] = yr1; - cx[p3][2] = xr2; cy[p3][2] = yr2; - cNext[p3] = p2; - } - } -} - -SplashPath *Splash::makeDashedPath(SplashPath *path) { - SplashPath *dPath; - SplashCoord lineDashTotal; - SplashCoord lineDashStartPhase, lineDashDist, segLen; - SplashCoord x0, y0, x1, y1, xa, ya; - GBool lineDashStartOn, lineDashOn, newPath; - int lineDashStartIdx, lineDashIdx; - int i, j, k; - - lineDashTotal = 0; - for (i = 0; i < state->lineDashLength; ++i) { - lineDashTotal += state->lineDash[i]; - } - lineDashStartPhase = state->lineDashPhase; - i = splashFloor(lineDashStartPhase / lineDashTotal); - lineDashStartPhase -= (SplashCoord)i * lineDashTotal; - lineDashStartOn = gTrue; - lineDashStartIdx = 0; - while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) { - lineDashStartOn = !lineDashStartOn; - lineDashStartPhase -= state->lineDash[lineDashStartIdx]; - ++lineDashStartIdx; - } - - dPath = new SplashPath(); - - // process each subpath - i = 0; - while (i < path->length) { - - // find the end of the subpath - for (j = i; - j < path->length - 1 && !(path->flags[j] & splashPathLast); - ++j) ; - - // initialize the dash parameters - lineDashOn = lineDashStartOn; - lineDashIdx = lineDashStartIdx; - lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase; - - // process each segment of the subpath - newPath = gTrue; - for (k = i; k < j; ++k) { - - // grab the segment - x0 = path->pts[k].x; - y0 = path->pts[k].y; - x1 = path->pts[k+1].x; - y1 = path->pts[k+1].y; - segLen = splashDist(x0, y0, x1, y1); - - // process the segment - while (segLen > 0) { - - if (lineDashDist >= segLen) { - if (lineDashOn) { - if (newPath) { - dPath->moveTo(x0, y0); - newPath = gFalse; - } - dPath->lineTo(x1, y1); - } - lineDashDist -= segLen; - segLen = 0; - - } else { - xa = x0 + (lineDashDist / segLen) * (x1 - x0); - ya = y0 + (lineDashDist / segLen) * (y1 - y0); - if (lineDashOn) { - if (newPath) { - dPath->moveTo(x0, y0); - newPath = gFalse; - } - dPath->lineTo(xa, ya); - } - x0 = xa; - y0 = ya; - segLen -= lineDashDist; - lineDashDist = 0; - } - - // get the next entry in the dash array - if (lineDashDist <= 0) { - lineDashOn = !lineDashOn; - if (++lineDashIdx == state->lineDashLength) { - lineDashIdx = 0; - } - lineDashDist = state->lineDash[lineDashIdx]; - newPath = gTrue; - } - } - } - i = j + 1; - } - - return dPath; -} - -SplashError Splash::fill(SplashPath *path, GBool eo) { - if (debugMode) { - printf("fill [eo:%d]:\n", eo); - dumpPath(path); - } - return fillWithPattern(path, eo, state->fillPattern, state->fillAlpha); -} - -SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, - SplashPattern *pattern, - SplashCoord alpha) { - SplashPipe pipe; - SplashXPath *xPath; - SplashXPathScanner *scanner; - int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; - SplashClipResult clipRes, clipRes2; - - if (path->length == 0) { - return splashErrEmptyPath; - } - xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue); - if (vectorAntialias) { - xPath->aaScale(); - } - xPath->sort(); - scanner = new SplashXPathScanner(xPath, eo); - - // get the min and max x and y values - if (vectorAntialias) { - scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI); - } else { - scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); - } - - // check clipping - if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) - != splashClipAllOutside) { - - // limit the y range - if (yMinI < state->clip->getYMinI()) { - yMinI = state->clip->getYMinI(); - } - if (yMaxI > state->clip->getYMaxI()) { - yMaxI = state->clip->getYMaxI(); - } - - pipeInit(&pipe, 0, yMinI, pattern, NULL, alpha, vectorAntialias, gFalse); - - // draw the spans - if (vectorAntialias) { - for (y = yMinI; y <= yMaxI; ++y) { - scanner->renderAALine(aaBuf, &x0, &x1, y); - if (clipRes != splashClipAllInside) { - state->clip->clipAALine(aaBuf, &x0, &x1, y); - } - drawAALine(&pipe, x0, x1, y); - } - } else { - for (y = yMinI; y <= yMaxI; ++y) { - while (scanner->getNextSpan(y, &x0, &x1)) { - if (clipRes == splashClipAllInside) { - drawSpan(&pipe, x0, x1, y, gTrue); - } else { - // limit the x range - if (x0 < state->clip->getXMinI()) { - x0 = state->clip->getXMinI(); - } - if (x1 > state->clip->getXMaxI()) { - x1 = state->clip->getXMaxI(); - } - clipRes2 = state->clip->testSpan(x0, x1, y); - drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside); - } - } - } - } - } - opClipRes = clipRes; - - delete scanner; - delete xPath; - return splashOk; -} - -SplashError Splash::xorFill(SplashPath *path, GBool eo) { - SplashPipe pipe; - SplashXPath *xPath; - SplashXPathScanner *scanner; - int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; - SplashClipResult clipRes, clipRes2; - SplashBlendFunc origBlendFunc; - - if (path->length == 0) { - return splashErrEmptyPath; - } - xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue); - xPath->sort(); - scanner = new SplashXPathScanner(xPath, eo); - - // get the min and max x and y values - scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); - - // check clipping - if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) - != splashClipAllOutside) { - - // limit the y range - if (yMinI < state->clip->getYMinI()) { - yMinI = state->clip->getYMinI(); - } - if (yMaxI > state->clip->getYMaxI()) { - yMaxI = state->clip->getYMaxI(); - } - - origBlendFunc = state->blendFunc; - state->blendFunc = &blendXor; - pipeInit(&pipe, 0, yMinI, state->fillPattern, NULL, 1, gFalse, gFalse); - - // draw the spans - for (y = yMinI; y <= yMaxI; ++y) { - while (scanner->getNextSpan(y, &x0, &x1)) { - if (clipRes == splashClipAllInside) { - drawSpan(&pipe, x0, x1, y, gTrue); - } else { - // limit the x range - if (x0 < state->clip->getXMinI()) { - x0 = state->clip->getXMinI(); - } - if (x1 > state->clip->getXMaxI()) { - x1 = state->clip->getXMaxI(); - } - clipRes2 = state->clip->testSpan(x0, x1, y); - drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside); - } - } - } - state->blendFunc = origBlendFunc; - } - opClipRes = clipRes; - - delete scanner; - delete xPath; - return splashOk; -} - -SplashError Splash::fillChar(SplashCoord x, SplashCoord y, - int c, SplashFont *font) { - SplashGlyphBitmap glyph; - SplashCoord xt, yt; - int x0, y0, xFrac, yFrac; - SplashClipResult clipRes; - - if (debugMode) { - printf("fillChar: x=%.2f y=%.2f c=%3d=0x%02x='%c'\n", - (double)x, (double)y, c, c, c); - } - transform(state->matrix, x, y, &xt, &yt); - x0 = splashFloor(xt); - xFrac = splashFloor((xt - x0) * splashFontFraction); - y0 = splashFloor(yt); - yFrac = splashFloor((yt - y0) * splashFontFraction); - if (!font->getGlyph(c, xFrac, yFrac, &glyph, x0, y0, state->clip, &clipRes)) { - return splashErrNoGlyph; - } - if (clipRes != splashClipAllOutside) { - fillGlyph2(x0, y0, &glyph, clipRes == splashClipAllInside); - } - opClipRes = clipRes; - if (glyph.freeData) { - gfree(glyph.data); - } - return splashOk; -} - -void Splash::fillGlyph(SplashCoord x, SplashCoord y, - SplashGlyphBitmap *glyph) { - SplashCoord xt, yt; - int x0, y0; - - transform(state->matrix, x, y, &xt, &yt); - x0 = splashFloor(xt); - y0 = splashFloor(yt); - SplashClipResult clipRes = state->clip->testRect(x0 - glyph->x, - y0 - glyph->y, - x0 - glyph->x + glyph->w - 1, - y0 - glyph->y + glyph->h - 1); - if (clipRes != splashClipAllOutside) { - fillGlyph2(x0, y0, glyph, clipRes == splashClipAllInside); - } - opClipRes = clipRes; -} - -void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) { - SplashPipe pipe; - int alpha0, alpha; - Guchar *p; - int x1, y1, xx, xx1, yy; - - p = glyph->data; - int xStart = x0 - glyph->x; - int yStart = y0 - glyph->y; - int xxLimit = glyph->w; - int yyLimit = glyph->h; - - if (yStart < 0) - { - p += glyph->w * -yStart; // move p to the beginning of the first painted row - yyLimit += yStart; - yStart = 0; - } - - if (xStart < 0) - { - p += -xStart; // move p to the first painted pixel - xxLimit += xStart; - xStart = 0; - } - - if (xxLimit + xStart >= bitmap->width) xxLimit = bitmap->width - xStart; - if (yyLimit + yStart >= bitmap->height) yyLimit = bitmap->height - yStart; - - if (noClip) { - if (glyph->aa) { - pipeInit(&pipe, xStart, yStart, - state->fillPattern, NULL, state->fillAlpha, gTrue, gFalse); - for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { - pipeSetXY(&pipe, xStart, y1); - for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) { - alpha = p[xx]; - if (alpha != 0) { - pipe.shape = (SplashCoord)(alpha / 255.0); - pipeRun(&pipe); - updateModX(x1); - updateModY(y1); - } else { - pipeIncX(&pipe); - } - } - p += glyph->w; - } - } else { - const int widthEight = splashCeil(glyph->w / 8.0); - - pipeInit(&pipe, xStart, yStart, - state->fillPattern, NULL, state->fillAlpha, gFalse, gFalse); - for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { - pipeSetXY(&pipe, xStart, y1); - for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { - alpha0 = p[xx / 8]; - for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) { - if (alpha0 & 0x80) { - pipeRun(&pipe); - updateModX(x1); - updateModY(y1); - } else { - pipeIncX(&pipe); - } - alpha0 <<= 1; - } - } - p += widthEight; - } - } - } else { - if (glyph->aa) { - pipeInit(&pipe, xStart, yStart, - state->fillPattern, NULL, state->fillAlpha, gTrue, gFalse); - for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { - pipeSetXY(&pipe, xStart, y1); - for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) { - if (state->clip->test(x1, y1)) { - alpha = p[xx]; - if (alpha != 0) { - pipe.shape = (SplashCoord)(alpha / 255.0); - pipeRun(&pipe); - updateModX(x1); - updateModY(y1); - } else { - pipeIncX(&pipe); - } - } else { - pipeIncX(&pipe); - } - } - p += glyph->w; - } - } else { - const int widthEight = splashCeil(glyph->w / 8.0); - - pipeInit(&pipe, xStart, yStart, - state->fillPattern, NULL, state->fillAlpha, gFalse, gFalse); - for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { - pipeSetXY(&pipe, xStart, y1); - for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { - alpha0 = p[xx / 8]; - for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) { - if (state->clip->test(x1, y1)) { - if (alpha0 & 0x80) { - pipeRun(&pipe); - updateModX(x1); - updateModY(y1); - } else { - pipeIncX(&pipe); - } - } else { - pipeIncX(&pipe); - } - alpha0 <<= 1; - } - } - p += widthEight; - } - } - } -} - -SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, - int w, int h, SplashCoord *mat, - GBool glyphMode) { - SplashPipe pipe; - GBool rot; - SplashCoord xScale, yScale, xShear, yShear, yShear1; - int tx, tx2, ty, ty2, scaledWidth, scaledHeight, xSign, ySign; - int ulx, uly, llx, lly, urx, ury, lrx, lry; - int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1; - int xMin, xMax, yMin, yMax; - SplashClipResult clipRes, clipRes2; - int yp, yq, yt, yStep, lastYStep; - int xp, xq, xt, xStep, xSrc; - int k1, spanXMin, spanXMax, spanY; - SplashColorPtr pixBuf, p; - int pixAcc; - int x, y, x1, x2, y2; - SplashCoord y1; - int n, m, i, j; - - if (debugMode) { - printf("fillImageMask: w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n", - w, h, (double)mat[0], (double)mat[1], (double)mat[2], - (double)mat[3], (double)mat[4], (double)mat[5]); - } - - if (w == 0 && h == 0) return splashErrZeroImage; - - // check for singular matrix - if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) { - return splashErrSingularMatrix; - } - - // compute scale, shear, rotation, translation parameters - rot = splashAbs(mat[1]) > splashAbs(mat[0]); - if (rot) { - xScale = -mat[1]; - yScale = mat[2] - (mat[0] * mat[3]) / mat[1]; - xShear = -mat[3] / yScale; - yShear = -mat[0] / mat[1]; - } else { - xScale = mat[0]; - yScale = mat[3] - (mat[1] * mat[2]) / mat[0]; - xShear = mat[2] / yScale; - yShear = mat[1] / mat[0]; - } - // Note 1: The PDF spec says that all pixels whose *centers* lie - // within the region get painted -- but that doesn't seem to match - // up with what Acrobat actually does: it ends up leaving gaps - // between image stripes. So we use the same rule here as for - // fills: any pixel that overlaps the region gets painted. - // Note 2: The "glyphMode" flag is a kludge: it switches back to - // "correct" behavior (matching the spec), for use in rendering Type - // 3 fonts. - // Note 3: The +/-0.01 in these computations is to avoid floating - // point precision problems which can lead to gaps between image - // stripes (it can cause image stripes to overlap, but that's a much - // less visible problem). - if (glyphMode) { - if (xScale >= 0) { - tx = splashRound(mat[4]); - tx2 = splashRound(mat[4] + xScale) - 1; - } else { - tx = splashRound(mat[4]) - 1; - tx2 = splashRound(mat[4] + xScale); - } - } else { - if (xScale >= 0) { - tx = splashFloor(mat[4] - 0.01); - tx2 = splashFloor(mat[4] + xScale + 0.01); - } else { - tx = splashFloor(mat[4] + 0.01); - tx2 = splashFloor(mat[4] + xScale - 0.01); - } - } - scaledWidth = abs(tx2 - tx) + 1; - if (glyphMode) { - if (yScale >= 0) { - ty = splashRound(mat[5]); - ty2 = splashRound(mat[5] + yScale) - 1; - } else { - ty = splashRound(mat[5]) - 1; - ty2 = splashRound(mat[5] + yScale); - } - } else { - if (yScale >= 0) { - ty = splashFloor(mat[5] - 0.01); - ty2 = splashFloor(mat[5] + yScale + 0.01); - } else { - ty = splashFloor(mat[5] + 0.01); - ty2 = splashFloor(mat[5] + yScale - 0.01); - } - } - scaledHeight = abs(ty2 - ty) + 1; - xSign = (xScale < 0) ? -1 : 1; - ySign = (yScale < 0) ? -1 : 1; - yShear1 = (SplashCoord)xSign * yShear; - - // clipping - ulx1 = 0; - uly1 = 0; - urx1 = xSign * (scaledWidth - 1); - ury1 = (int)(yShear * urx1); - llx1 = splashRound(xShear * ySign * (scaledHeight - 1)); - lly1 = ySign * (scaledHeight - 1) + (int)(yShear * llx1); - lrx1 = xSign * (scaledWidth - 1) + - splashRound(xShear * ySign * (scaledHeight - 1)); - lry1 = ySign * (scaledHeight - 1) + (int)(yShear * lrx1); - if (rot) { - ulx = tx + uly1; uly = ty - ulx1; - urx = tx + ury1; ury = ty - urx1; - llx = tx + lly1; lly = ty - llx1; - lrx = tx + lry1; lry = ty - lrx1; - } else { - ulx = tx + ulx1; uly = ty + uly1; - urx = tx + urx1; ury = ty + ury1; - llx = tx + llx1; lly = ty + lly1; - lrx = tx + lrx1; lry = ty + lry1; - } - xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx - : (llx < lrx) ? llx : lrx - : (urx < llx) ? (urx < lrx) ? urx : lrx - : (llx < lrx) ? llx : lrx; - xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx - : (llx > lrx) ? llx : lrx - : (urx > llx) ? (urx > lrx) ? urx : lrx - : (llx > lrx) ? llx : lrx; - yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry - : (lly < lry) ? lly : lry - : (ury < lly) ? (ury < lry) ? ury : lry - : (lly < lry) ? lly : lry; - yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry - : (lly > lry) ? lly : lry - : (ury > lly) ? (ury > lry) ? ury : lry - : (lly > lry) ? lly : lry; - clipRes = state->clip->testRect(xMin, yMin, xMax, yMax); - opClipRes = clipRes; - - // compute Bresenham parameters for x and y scaling - yp = h / scaledHeight; - yq = h % scaledHeight; - xp = w / scaledWidth; - xq = w % scaledWidth; - - // allocate pixel buffer - if (yp < 0 || yp > INT_MAX - 1) { - return splashErrBadArg; - } - pixBuf = (SplashColorPtr)gmallocn((yp + 1), w); - - // initialize the pixel pipe - pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha, - gTrue, gFalse); - if (vectorAntialias) { - drawAAPixelInit(); - } - - // init y scale Bresenham - yt = 0; - lastYStep = 1; - - for (y = 0; y < scaledHeight; ++y) { - - // y scale Bresenham - yStep = yp; - yt += yq; - if (yt >= scaledHeight) { - yt -= scaledHeight; - ++yStep; - } - - // read row(s) from image - n = (yp > 0) ? yStep : lastYStep; - if (n > 0) { - p = pixBuf; - for (i = 0; i < n; ++i) { - (*src)(srcData, p); - p += w; - } - } - lastYStep = yStep; - - // loop-invariant constants - k1 = splashRound(xShear * ySign * y); - - // clipping test - if (clipRes != splashClipAllInside && - !rot && - (int)(yShear * k1) == - (int)(yShear * (xSign * (scaledWidth - 1) + k1))) { - if (xSign > 0) { - spanXMin = tx + k1; - spanXMax = spanXMin + (scaledWidth - 1); - } else { - spanXMax = tx + k1; - spanXMin = spanXMax - (scaledWidth - 1); - } - spanY = ty + ySign * y + (int)(yShear * k1); - clipRes2 = state->clip->testSpan(spanXMin, spanXMax, spanY); - if (clipRes2 == splashClipAllOutside) { - continue; - } - } else { - clipRes2 = clipRes; - } - - // init x scale Bresenham - xt = 0; - xSrc = 0; - - // x shear - x1 = k1; - - // y shear - y1 = (SplashCoord)ySign * y + yShear * x1; - // this is a kludge: if yShear1 is negative, then (int)y1 would - // change immediately after the first pixel, which is not what we - // want - if (yShear1 < 0) { - y1 += 0.999; - } - - // loop-invariant constants - n = yStep > 0 ? yStep : 1; - - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the alpha value for (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - p = pixBuf + xSrc; - pixAcc = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc += *p++; - } - p += w - m; - } - - // blend fill color with background - if (pixAcc != 0) { - pipe.shape = (pixAcc == n * m) - ? (SplashCoord)1 - : (SplashCoord)pixAcc / (SplashCoord)(n * m); - if (vectorAntialias && clipRes2 != splashClipAllInside) { - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, clipRes2 == splashClipAllInside); - } - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - } - - // free memory - gfree(pixBuf); - - return splashOk; -} - -SplashError Splash::drawImage(SplashImageSource src, void *srcData, - SplashColorMode srcMode, GBool srcAlpha, - int w, int h, SplashCoord *mat) { - SplashPipe pipe; - GBool ok, rot; - SplashCoord xScale, yScale, xShear, yShear, yShear1; - int tx, tx2, ty, ty2, scaledWidth, scaledHeight, xSign, ySign; - int ulx, uly, llx, lly, urx, ury, lrx, lry; - int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1; - int xMin, xMax, yMin, yMax; - SplashClipResult clipRes, clipRes2; - int yp, yq, yt, yStep, lastYStep; - int xp, xq, xt, xStep, xSrc; - int k1, spanXMin, spanXMax, spanY; - SplashColorPtr colorBuf, p; - SplashColor pix; - Guchar *alphaBuf, *q; -#if SPLASH_CMYK - int pixAcc0, pixAcc1, pixAcc2, pixAcc3; -#else - int pixAcc0, pixAcc1, pixAcc2; -#endif - int alphaAcc; - SplashCoord pixMul, alphaMul, alpha; - int x, y, x1, x2, y2; - SplashCoord y1; - int nComps, n, m, i, j; - - if (debugMode) { - printf("drawImage: srcMode=%d srcAlpha=%d w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n", - srcMode, srcAlpha, w, h, (double)mat[0], (double)mat[1], (double)mat[2], - (double)mat[3], (double)mat[4], (double)mat[5]); - } - - // check color modes - ok = gFalse; // make gcc happy - nComps = 0; // make gcc happy - switch (bitmap->mode) { - case splashModeMono1: - case splashModeMono8: - ok = srcMode == splashModeMono8; - nComps = 1; - break; - case splashModeRGB8: - ok = srcMode == splashModeRGB8; - nComps = 3; - break; - case splashModeXBGR8: - ok = srcMode == splashModeXBGR8; - nComps = 4; - break; - case splashModeBGR8: - ok = srcMode == splashModeBGR8; - nComps = 3; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - ok = srcMode == splashModeCMYK8; - nComps = 4; - break; -#endif - } - if (!ok) { - return splashErrModeMismatch; - } - - // check for singular matrix - if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) { - return splashErrSingularMatrix; - } - - // compute scale, shear, rotation, translation parameters - rot = splashAbs(mat[1]) > splashAbs(mat[0]); - if (rot) { - xScale = -mat[1]; - yScale = mat[2] - (mat[0] * mat[3]) / mat[1]; - xShear = -mat[3] / yScale; - yShear = -mat[0] / mat[1]; - } else { - xScale = mat[0]; - yScale = mat[3] - (mat[1] * mat[2]) / mat[0]; - xShear = mat[2] / yScale; - yShear = mat[1] / mat[0]; - } - // Note 1: The PDF spec says that all pixels whose *centers* lie - // within the region get painted -- but that doesn't seem to match - // up with what Acrobat actually does: it ends up leaving gaps - // between image stripes. So we use the same rule here as for - // fills: any pixel that overlaps the region gets painted. - // Note 2: The +/-0.01 in these computations is to avoid floating - // point precision problems which can lead to gaps between image - // stripes (it can cause image stripes to overlap, but that's a much - // less visible problem). - if (xScale >= 0) { - tx = splashFloor(mat[4] - 0.01); - tx2 = splashFloor(mat[4] + xScale + 0.01); - } else { - tx = splashFloor(mat[4] + 0.01); - tx2 = splashFloor(mat[4] + xScale - 0.01); - } - scaledWidth = abs(tx2 - tx) + 1; - if (yScale >= 0) { - ty = splashFloor(mat[5] - 0.01); - ty2 = splashFloor(mat[5] + yScale + 0.01); - } else { - ty = splashFloor(mat[5] + 0.01); - ty2 = splashFloor(mat[5] + yScale - 0.01); - } - scaledHeight = abs(ty2 - ty) + 1; - xSign = (xScale < 0) ? -1 : 1; - ySign = (yScale < 0) ? -1 : 1; - yShear1 = (SplashCoord)xSign * yShear; - - // clipping - ulx1 = 0; - uly1 = 0; - urx1 = xSign * (scaledWidth - 1); - ury1 = (int)(yShear * urx1); - llx1 = splashRound(xShear * ySign * (scaledHeight - 1)); - lly1 = ySign * (scaledHeight - 1) + (int)(yShear * llx1); - lrx1 = xSign * (scaledWidth - 1) + - splashRound(xShear * ySign * (scaledHeight - 1)); - lry1 = ySign * (scaledHeight - 1) + (int)(yShear * lrx1); - if (rot) { - ulx = tx + uly1; uly = ty - ulx1; - urx = tx + ury1; ury = ty - urx1; - llx = tx + lly1; lly = ty - llx1; - lrx = tx + lry1; lry = ty - lrx1; - } else { - ulx = tx + ulx1; uly = ty + uly1; - urx = tx + urx1; ury = ty + ury1; - llx = tx + llx1; lly = ty + lly1; - lrx = tx + lrx1; lry = ty + lry1; - } - xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx - : (llx < lrx) ? llx : lrx - : (urx < llx) ? (urx < lrx) ? urx : lrx - : (llx < lrx) ? llx : lrx; - xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx - : (llx > lrx) ? llx : lrx - : (urx > llx) ? (urx > lrx) ? urx : lrx - : (llx > lrx) ? llx : lrx; - yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry - : (lly < lry) ? lly : lry - : (ury < lly) ? (ury < lry) ? ury : lry - : (lly < lry) ? lly : lry; - yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry - : (lly > lry) ? lly : lry - : (ury > lly) ? (ury > lry) ? ury : lry - : (lly > lry) ? lly : lry; - clipRes = state->clip->testRect(xMin, yMin, xMax, yMax); - opClipRes = clipRes; - if (clipRes == splashClipAllOutside) { - return splashOk; - } - - // compute Bresenham parameters for x and y scaling - yp = h / scaledHeight; - yq = h % scaledHeight; - xp = w / scaledWidth; - xq = w % scaledWidth; - - // allocate pixel buffers - if (yp < 0 || yp > INT_MAX - 1) { - return splashErrBadArg; - } - colorBuf = (SplashColorPtr)gmallocn3((yp + 1), w, nComps); - if (srcAlpha) { - alphaBuf = (Guchar *)gmallocn((yp + 1), w); - } else { - alphaBuf = NULL; - } - - pixAcc0 = pixAcc1 = pixAcc2 = 0; // make gcc happy -#if SPLASH_CMYK - pixAcc3 = 0; // make gcc happy -#endif - - // initialize the pixel pipe - pipeInit(&pipe, 0, 0, NULL, pix, state->fillAlpha, - srcAlpha || (vectorAntialias && clipRes != splashClipAllInside), - gFalse); - if (vectorAntialias) { - drawAAPixelInit(); - } - - if (srcAlpha) { - - // init y scale Bresenham - yt = 0; - lastYStep = 1; - - for (y = 0; y < scaledHeight; ++y) { - - // y scale Bresenham - yStep = yp; - yt += yq; - if (yt >= scaledHeight) { - yt -= scaledHeight; - ++yStep; - } - - // read row(s) from image - n = (yp > 0) ? yStep : lastYStep; - if (n > 0) { - p = colorBuf; - q = alphaBuf; - for (i = 0; i < n; ++i) { - (*src)(srcData, p, q); - p += w * nComps; - q += w; - } - } - lastYStep = yStep; - - // loop-invariant constants - k1 = splashRound(xShear * ySign * y); - - // clipping test - if (clipRes != splashClipAllInside && - !rot && - (int)(yShear * k1) == - (int)(yShear * (xSign * (scaledWidth - 1) + k1))) { - if (xSign > 0) { - spanXMin = tx + k1; - spanXMax = spanXMin + (scaledWidth - 1); - } else { - spanXMax = tx + k1; - spanXMin = spanXMax - (scaledWidth - 1); - } - spanY = ty + ySign * y + (int)(yShear * k1); - clipRes2 = state->clip->testSpan(spanXMin, spanXMax, spanY); - if (clipRes2 == splashClipAllOutside) { - continue; - } - } else { - clipRes2 = clipRes; - } - - // init x scale Bresenham - xt = 0; - xSrc = 0; - - // x shear - x1 = k1; - - // y shear - y1 = (SplashCoord)ySign * y + yShear * x1; - // this is a kludge: if yShear1 is negative, then (int)y1 would - // change immediately after the first pixel, which is not what - // we want - if (yShear1 < 0) { - y1 += 0.999; - } - - // loop-invariant constants - n = yStep > 0 ? yStep : 1; - - switch (srcMode) { - - case splashModeMono1: - case splashModeMono8: - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - alphaAcc = 0; - p = colorBuf + xSrc; - q = alphaBuf + xSrc; - pixAcc0 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - alphaAcc += *q++; - } - p += w - m; - q += w - m; - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - alphaMul = pixMul * (1.0 / 255.0); - alpha = (SplashCoord)alphaAcc * alphaMul; - - if (alpha > 0) { - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - - // set pixel - pipe.shape = alpha; - if (vectorAntialias && clipRes != splashClipAllInside) { - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; - - case splashModeRGB8: - case splashModeBGR8: - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - alphaAcc = 0; - p = colorBuf + xSrc * 3; - q = alphaBuf + xSrc; - pixAcc0 = pixAcc1 = pixAcc2 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - alphaAcc += *q++; - } - p += 3 * (w - m); - q += w - m; - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - alphaMul = pixMul * (1.0 / 255.0); - alpha = (SplashCoord)alphaAcc * alphaMul; - - if (alpha > 0) { - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - - // set pixel - pipe.shape = alpha; - if (vectorAntialias && clipRes != splashClipAllInside) { - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; - - case splashModeXBGR8: - for (x = 0; x < scaledWidth; ++x) { - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - alphaAcc = 0; - p = colorBuf + xSrc * 4; - q = alphaBuf + xSrc; - pixAcc0 = pixAcc1 = pixAcc2 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - *p++; - alphaAcc += *q++; - } - p += 4 * (w - m); - q += w - m; - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - alphaMul = pixMul * (1.0 / 255.0); - alpha = (SplashCoord)alphaAcc * alphaMul; - - if (alpha > 0) { - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - pix[3] = 255; - - // set pixel - pipe.shape = alpha; - if (vectorAntialias && clipRes != splashClipAllInside) { - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; - - -#if SPLASH_CMYK - case splashModeCMYK8: - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - alphaAcc = 0; - p = colorBuf + xSrc * 4; - q = alphaBuf + xSrc; - pixAcc0 = pixAcc1 = pixAcc2 = pixAcc3 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - pixAcc3 += *p++; - alphaAcc += *q++; - } - p += 4 * (w - m); - q += w - m; - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - alphaMul = pixMul * (1.0 / 255.0); - alpha = (SplashCoord)alphaAcc * alphaMul; - - if (alpha > 0) { - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - pix[3] = (int)((SplashCoord)pixAcc3 * pixMul); - - // set pixel - pipe.shape = alpha; - if (vectorAntialias && clipRes != splashClipAllInside) { - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; -#endif // SPLASH_CMYK - } - } - - } else { - - // init y scale Bresenham - yt = 0; - lastYStep = 1; - - for (y = 0; y < scaledHeight; ++y) { - - // y scale Bresenham - yStep = yp; - yt += yq; - if (yt >= scaledHeight) { - yt -= scaledHeight; - ++yStep; - } - - // read row(s) from image - n = (yp > 0) ? yStep : lastYStep; - if (n > 0) { - p = colorBuf; - for (i = 0; i < n; ++i) { - (*src)(srcData, p, NULL); - p += w * nComps; - } - } - lastYStep = yStep; - - // loop-invariant constants - k1 = splashRound(xShear * ySign * y); - - // clipping test - if (clipRes != splashClipAllInside && - !rot && - (int)(yShear * k1) == - (int)(yShear * (xSign * (scaledWidth - 1) + k1))) { - if (xSign > 0) { - spanXMin = tx + k1; - spanXMax = spanXMin + (scaledWidth - 1); - } else { - spanXMax = tx + k1; - spanXMin = spanXMax - (scaledWidth - 1); - } - spanY = ty + ySign * y + (int)(yShear * k1); - clipRes2 = state->clip->testSpan(spanXMin, spanXMax, spanY); - if (clipRes2 == splashClipAllOutside) { - continue; - } - } else { - clipRes2 = clipRes; - } - - // init x scale Bresenham - xt = 0; - xSrc = 0; - - // x shear - x1 = k1; - - // y shear - y1 = (SplashCoord)ySign * y + yShear * x1; - // this is a kludge: if yShear1 is negative, then (int)y1 would - // change immediately after the first pixel, which is not what - // we want - if (yShear1 < 0) { - y1 += 0.999; - } - - // loop-invariant constants - n = yStep > 0 ? yStep : 1; - - switch (srcMode) { - - case splashModeMono1: - case splashModeMono8: - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - p = colorBuf + xSrc; - pixAcc0 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - } - p += w - m; - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - - // set pixel - if (vectorAntialias && clipRes != splashClipAllInside) { - pipe.shape = (SplashCoord)1; - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; - - case splashModeRGB8: - case splashModeBGR8: - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - p = colorBuf + xSrc * 3; - pixAcc0 = pixAcc1 = pixAcc2 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - } - p += 3 * (w - m); - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - - // set pixel - if (vectorAntialias && clipRes != splashClipAllInside) { - pipe.shape = (SplashCoord)1; - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; - - case splashModeXBGR8: - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - p = colorBuf + xSrc * 4; - pixAcc0 = pixAcc1 = pixAcc2 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - *p++; - } - p += 4 * (w - m); - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - pix[3] = 255; - - // set pixel - if (vectorAntialias && clipRes != splashClipAllInside) { - pipe.shape = (SplashCoord)1; - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; - -#if SPLASH_CMYK - case splashModeCMYK8: - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - p = colorBuf + xSrc * 4; - pixAcc0 = pixAcc1 = pixAcc2 = pixAcc3 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - pixAcc3 += *p++; - } - p += 4 * (w - m); - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - pix[3] = (int)((SplashCoord)pixAcc3 * pixMul); - - // set pixel - if (vectorAntialias && clipRes != splashClipAllInside) { - pipe.shape = (SplashCoord)1; - drawAAPixel(&pipe, tx + x2, ty + y2); - } else { - drawPixel(&pipe, tx + x2, ty + y2, - clipRes2 == splashClipAllInside); - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - break; -#endif // SPLASH_CMYK - } - } - - } - - gfree(colorBuf); - gfree(alphaBuf); - - return splashOk; -} - -SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc, - int xDest, int yDest, int w, int h, - GBool noClip, GBool nonIsolated) { - SplashPipe pipe; - SplashColor pixel; - Guchar alpha; - Guchar *ap; - int x, y; - - if (src->mode != bitmap->mode) { - return splashErrModeMismatch; - } - - if (src->alpha) { - pipeInit(&pipe, xDest, yDest, NULL, pixel, state->fillAlpha, - gTrue, nonIsolated); - for (y = 0; y < h; ++y) { - pipeSetXY(&pipe, xDest, yDest + y); - ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; - for (x = 0; x < w; ++x) { - src->getPixel(xSrc + x, ySrc + y, pixel); - alpha = *ap++; - if (noClip || state->clip->test(xDest + x, yDest + y)) { - // this uses shape instead of alpha, which isn't technically - // correct, but works out the same - pipe.shape = (SplashCoord)(alpha / 255.0); - pipeRun(&pipe); - updateModX(xDest + x); - updateModY(yDest + y); - } else { - pipeIncX(&pipe); - } - } - } - } else { - pipeInit(&pipe, xDest, yDest, NULL, pixel, state->fillAlpha, - gFalse, nonIsolated); - for (y = 0; y < h; ++y) { - pipeSetXY(&pipe, xDest, yDest + y); - for (x = 0; x < w; ++x) { - src->getPixel(xSrc + x, ySrc + y, pixel); - if (noClip || state->clip->test(xDest + x, yDest + y)) { - pipeRun(&pipe); - updateModX(xDest + x); - updateModY(yDest + y); - } else { - pipeIncX(&pipe); - } - } - } - } - - return splashOk; -} - -void Splash::compositeBackground(SplashColorPtr color) { - SplashColorPtr p; - Guchar *q; - Guchar alpha, alpha1, c, color0, color1, color2; -#if SPLASH_CMYK - Guchar color3; -#endif - int x, y, mask; - - switch (bitmap->mode) { - case splashModeMono1: - color0 = color[0]; - for (y = 0; y < bitmap->height; ++y) { - p = &bitmap->data[y * bitmap->rowSize]; - q = &bitmap->alpha[y * bitmap->width]; - mask = 0x80; - for (x = 0; x < bitmap->width; ++x) { - alpha = *q++; - alpha1 = 255 - alpha; - c = (*p & mask) ? 0xff : 0x00; - c = div255(alpha1 * color0 + alpha * c); - if (c & 0x80) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!(mask >>= 1)) { - mask = 0x80; - ++p; - } - } - } - break; - case splashModeMono8: - color0 = color[0]; - for (y = 0; y < bitmap->height; ++y) { - p = &bitmap->data[y * bitmap->rowSize]; - q = &bitmap->alpha[y * bitmap->width]; - for (x = 0; x < bitmap->width; ++x) { - alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - ++p; - } - } - break; - case splashModeRGB8: - case splashModeBGR8: - color0 = color[0]; - color1 = color[1]; - color2 = color[2]; - for (y = 0; y < bitmap->height; ++y) { - p = &bitmap->data[y * bitmap->rowSize]; - q = &bitmap->alpha[y * bitmap->width]; - for (x = 0; x < bitmap->width; ++x) { - alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - p[1] = div255(alpha1 * color1 + alpha * p[1]); - p[2] = div255(alpha1 * color2 + alpha * p[2]); - p += 3; - } - } - break; - case splashModeXBGR8: - color0 = color[0]; - color1 = color[1]; - color2 = color[2]; - for (y = 0; y < bitmap->height; ++y) { - p = &bitmap->data[y * bitmap->rowSize]; - q = &bitmap->alpha[y * bitmap->width]; - for (x = 0; x < bitmap->width; ++x) { - alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - p[1] = div255(alpha1 * color1 + alpha * p[1]); - p[2] = div255(alpha1 * color2 + alpha * p[2]); - p[3] = 255; - p += 4; - } - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - color0 = color[0]; - color1 = color[1]; - color2 = color[2]; - color3 = color[3]; - for (y = 0; y < bitmap->height; ++y) { - p = &bitmap->data[y * bitmap->rowSize]; - q = &bitmap->alpha[y * bitmap->width]; - for (x = 0; x < bitmap->width; ++x) { - alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - p[1] = div255(alpha1 * color1 + alpha * p[1]); - p[2] = div255(alpha1 * color2 + alpha * p[2]); - p[3] = div255(alpha1 * color3 + alpha * p[3]); - p += 4; - } - } - break; -#endif - } - memset(bitmap->alpha, 255, bitmap->width * bitmap->height); -} - -SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc, - int xDest, int yDest, int w, int h) { - SplashColor pixel; - SplashColorPtr p; - Guchar *q; - int x, y, mask; - - if (src->mode != bitmap->mode) { - return splashErrModeMismatch; - } - - switch (bitmap->mode) { - case splashModeMono1: - for (y = 0; y < h; ++y) { - p = &bitmap->data[(yDest + y) * bitmap->rowSize + (xDest >> 3)]; - mask = 0x80 >> (xDest & 7); - for (x = 0; x < w; ++x) { - src->getPixel(xSrc + x, ySrc + y, pixel); - if (pixel[0]) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!(mask >>= 1)) { - mask = 0x80; - ++p; - } - } - } - break; - case splashModeMono8: - for (y = 0; y < h; ++y) { - p = &bitmap->data[(yDest + y) * bitmap->rowSize + xDest]; - for (x = 0; x < w; ++x) { - src->getPixel(xSrc + x, ySrc + y, pixel); - *p++ = pixel[0]; - } - } - break; - case splashModeRGB8: - case splashModeBGR8: - for (y = 0; y < h; ++y) { - p = &bitmap->data[(yDest + y) * bitmap->rowSize + 3 * xDest]; - for (x = 0; x < w; ++x) { - src->getPixel(xSrc + x, ySrc + y, pixel); - *p++ = pixel[0]; - *p++ = pixel[1]; - *p++ = pixel[2]; - } - } - break; - case splashModeXBGR8: - for (y = 0; y < h; ++y) { - p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest]; - for (x = 0; x < w; ++x) { - src->getPixel(xSrc + x, ySrc + y, pixel); - *p++ = pixel[0]; - *p++ = pixel[1]; - *p++ = pixel[2]; - *p++ = 255; - } - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - for (y = 0; y < h; ++y) { - p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest]; - for (x = 0; x < w; ++x) { - src->getPixel(xSrc + x, ySrc + y, pixel); - *p++ = pixel[0]; - *p++ = pixel[1]; - *p++ = pixel[2]; - *p++ = pixel[3]; - } - } - break; -#endif - } - - if (bitmap->alpha) { - for (y = 0; y < h; ++y) { - q = &bitmap->alpha[(yDest + y) * bitmap->width + xDest]; - for (x = 0; x < w; ++x) { - *q++ = 0x00; - } - } - } - - return splashOk; -} - -SplashPath *Splash::makeStrokePath(SplashPath *path, GBool flatten) { - SplashPath *pathIn, *pathOut; - SplashCoord w, d, dx, dy, wdx, wdy, dxNext, dyNext, wdxNext, wdyNext; - SplashCoord crossprod, dotprod, miter, m; - GBool first, last, closed; - int subpathStart, next, i; - int left0, left1, left2, right0, right1, right2, join0, join1, join2; - int leftFirst, rightFirst, firstPt; - - if (flatten) { - pathIn = flattenPath(path, state->matrix, state->flatness); - if (state->lineDashLength > 0) { - pathOut = makeDashedPath(pathIn); - delete pathIn; - pathIn = pathOut; - } - } else { - pathIn = path; - } - - subpathStart = 0; // make gcc happy - closed = gFalse; // make gcc happy - left0 = left1 = right0 = right1 = join0 = join1 = 0; // make gcc happy - leftFirst = rightFirst = firstPt = 0; // make gcc happy - - pathOut = new SplashPath(); - w = state->lineWidth; - - for (i = 0; i < pathIn->length - 1; ++i) { - if (pathIn->flags[i] & splashPathLast) { - continue; - } - if ((first = pathIn->flags[i] & splashPathFirst)) { - subpathStart = i; - closed = pathIn->flags[i] & splashPathClosed; - } - last = pathIn->flags[i+1] & splashPathLast; - - // compute the deltas for segment (i, i+1) - d = splashDist(pathIn->pts[i].x, pathIn->pts[i].y, - pathIn->pts[i+1].x, pathIn->pts[i+1].y); - if (d == 0) { - // we need to draw end caps on zero-length lines - //~ not clear what the behavior should be for splashLineCapButt - //~ with d==0 - dx = 0; - dy = 1; - } else { - d = (SplashCoord)1 / d; - dx = d * (pathIn->pts[i+1].x - pathIn->pts[i].x); - dy = d * (pathIn->pts[i+1].y - pathIn->pts[i].y); - } - wdx = (SplashCoord)0.5 * w * dx; - wdy = (SplashCoord)0.5 * w * dy; - - // compute the deltas for segment (i+1, next) - next = last ? subpathStart + 1 : i + 2; - d = splashDist(pathIn->pts[i+1].x, pathIn->pts[i+1].y, - pathIn->pts[next].x, pathIn->pts[next].y); - if (d == 0) { - // we need to draw end caps on zero-length lines - //~ not clear what the behavior should be for splashLineCapButt - //~ with d==0 - dxNext = 0; - dyNext = 1; - } else { - d = (SplashCoord)1 / d; - dxNext = d * (pathIn->pts[next].x - pathIn->pts[i+1].x); - dyNext = d * (pathIn->pts[next].y - pathIn->pts[i+1].y); - } - wdxNext = (SplashCoord)0.5 * w * dxNext; - wdyNext = (SplashCoord)0.5 * w * dyNext; - - // draw the start cap - pathOut->moveTo(pathIn->pts[i].x - wdy, pathIn->pts[i].y + wdx); - if (i == subpathStart) { - firstPt = pathOut->length - 1; - } - if (first && !closed) { - switch (state->lineCap) { - case splashLineCapButt: - pathOut->lineTo(pathIn->pts[i].x + wdy, pathIn->pts[i].y - wdx); - break; - case splashLineCapRound: - pathOut->curveTo(pathIn->pts[i].x - wdy - bezierCircle * wdx, - pathIn->pts[i].y + wdx - bezierCircle * wdy, - pathIn->pts[i].x - wdx - bezierCircle * wdy, - pathIn->pts[i].y - wdy + bezierCircle * wdx, - pathIn->pts[i].x - wdx, - pathIn->pts[i].y - wdy); - pathOut->curveTo(pathIn->pts[i].x - wdx + bezierCircle * wdy, - pathIn->pts[i].y - wdy - bezierCircle * wdx, - pathIn->pts[i].x + wdy - bezierCircle * wdx, - pathIn->pts[i].y - wdx - bezierCircle * wdy, - pathIn->pts[i].x + wdy, - pathIn->pts[i].y - wdx); - break; - case splashLineCapProjecting: - pathOut->lineTo(pathIn->pts[i].x - wdx - wdy, - pathIn->pts[i].y + wdx - wdy); - pathOut->lineTo(pathIn->pts[i].x - wdx + wdy, - pathIn->pts[i].y - wdx - wdy); - pathOut->lineTo(pathIn->pts[i].x + wdy, - pathIn->pts[i].y - wdx); - break; - } - } else { - pathOut->lineTo(pathIn->pts[i].x + wdy, pathIn->pts[i].y - wdx); - } - - // draw the left side of the segment rectangle - left2 = pathOut->length - 1; - pathOut->lineTo(pathIn->pts[i+1].x + wdy, pathIn->pts[i+1].y - wdx); - - // draw the end cap - if (last && !closed) { - switch (state->lineCap) { - case splashLineCapButt: - pathOut->lineTo(pathIn->pts[i+1].x - wdy, pathIn->pts[i+1].y + wdx); - break; - case splashLineCapRound: - pathOut->curveTo(pathIn->pts[i+1].x + wdy + bezierCircle * wdx, - pathIn->pts[i+1].y - wdx + bezierCircle * wdy, - pathIn->pts[i+1].x + wdx + bezierCircle * wdy, - pathIn->pts[i+1].y + wdy - bezierCircle * wdx, - pathIn->pts[i+1].x + wdx, - pathIn->pts[i+1].y + wdy); - pathOut->curveTo(pathIn->pts[i+1].x + wdx - bezierCircle * wdy, - pathIn->pts[i+1].y + wdy + bezierCircle * wdx, - pathIn->pts[i+1].x - wdy + bezierCircle * wdx, - pathIn->pts[i+1].y + wdx + bezierCircle * wdy, - pathIn->pts[i+1].x - wdy, - pathIn->pts[i+1].y + wdx); - break; - case splashLineCapProjecting: - pathOut->lineTo(pathIn->pts[i+1].x + wdy + wdx, - pathIn->pts[i+1].y - wdx + wdy); - pathOut->lineTo(pathIn->pts[i+1].x - wdy + wdx, - pathIn->pts[i+1].y + wdx + wdy); - pathOut->lineTo(pathIn->pts[i+1].x - wdy, - pathIn->pts[i+1].y + wdx); - break; - } - } else { - pathOut->lineTo(pathIn->pts[i+1].x - wdy, pathIn->pts[i+1].y + wdx); - } - - // draw the right side of the segment rectangle - right2 = pathOut->length - 1; - pathOut->close(); - - // draw the join - join2 = pathOut->length; - if (!last || closed) { - crossprod = dx * dyNext - dy * dxNext; - dotprod = -(dx * dxNext + dy * dyNext); - if (dotprod > 0.99999) { - // avoid a divide-by-zero -- set miter to something arbitrary - // such that sqrt(miter) will exceed miterLimit (and m is never - // used in that situation) - miter = (state->miterLimit + 1) * (state->miterLimit + 1); - m = 0; - } else { - miter = (SplashCoord)2 / ((SplashCoord)1 - dotprod); - if (miter < 1) { - // this can happen because of floating point inaccuracies - miter = 1; - } - m = splashSqrt(miter - 1); - } - - // round join - if (state->lineJoin == splashLineJoinRound) { - pathOut->moveTo(pathIn->pts[i+1].x + (SplashCoord)0.5 * w, - pathIn->pts[i+1].y); - pathOut->curveTo(pathIn->pts[i+1].x + (SplashCoord)0.5 * w, - pathIn->pts[i+1].y + bezierCircle2 * w, - pathIn->pts[i+1].x + bezierCircle2 * w, - pathIn->pts[i+1].y + (SplashCoord)0.5 * w, - pathIn->pts[i+1].x, - pathIn->pts[i+1].y + (SplashCoord)0.5 * w); - pathOut->curveTo(pathIn->pts[i+1].x - bezierCircle2 * w, - pathIn->pts[i+1].y + (SplashCoord)0.5 * w, - pathIn->pts[i+1].x - (SplashCoord)0.5 * w, - pathIn->pts[i+1].y + bezierCircle2 * w, - pathIn->pts[i+1].x - (SplashCoord)0.5 * w, - pathIn->pts[i+1].y); - pathOut->curveTo(pathIn->pts[i+1].x - (SplashCoord)0.5 * w, - pathIn->pts[i+1].y - bezierCircle2 * w, - pathIn->pts[i+1].x - bezierCircle2 * w, - pathIn->pts[i+1].y - (SplashCoord)0.5 * w, - pathIn->pts[i+1].x, - pathIn->pts[i+1].y - (SplashCoord)0.5 * w); - pathOut->curveTo(pathIn->pts[i+1].x + bezierCircle2 * w, - pathIn->pts[i+1].y - (SplashCoord)0.5 * w, - pathIn->pts[i+1].x + (SplashCoord)0.5 * w, - pathIn->pts[i+1].y - bezierCircle2 * w, - pathIn->pts[i+1].x + (SplashCoord)0.5 * w, - pathIn->pts[i+1].y); - - } else { - pathOut->moveTo(pathIn->pts[i+1].x, pathIn->pts[i+1].y); - - // angle < 180 - if (crossprod < 0) { - pathOut->lineTo(pathIn->pts[i+1].x - wdyNext, - pathIn->pts[i+1].y + wdxNext); - // miter join inside limit - if (state->lineJoin == splashLineJoinMiter && - splashSqrt(miter) <= state->miterLimit) { - pathOut->lineTo(pathIn->pts[i+1].x - wdy + wdx * m, - pathIn->pts[i+1].y + wdx + wdy * m); - pathOut->lineTo(pathIn->pts[i+1].x - wdy, - pathIn->pts[i+1].y + wdx); - // bevel join or miter join outside limit - } else { - pathOut->lineTo(pathIn->pts[i+1].x - wdy, pathIn->pts[i+1].y + wdx); - } - - // angle >= 180 - } else { - pathOut->lineTo(pathIn->pts[i+1].x + wdy, - pathIn->pts[i+1].y - wdx); - // miter join inside limit - if (state->lineJoin == splashLineJoinMiter && - splashSqrt(miter) <= state->miterLimit) { - pathOut->lineTo(pathIn->pts[i+1].x + wdy + wdx * m, - pathIn->pts[i+1].y - wdx + wdy * m); - pathOut->lineTo(pathIn->pts[i+1].x + wdyNext, - pathIn->pts[i+1].y - wdxNext); - // bevel join or miter join outside limit - } else { - pathOut->lineTo(pathIn->pts[i+1].x + wdyNext, - pathIn->pts[i+1].y - wdxNext); - } - } - } - - pathOut->close(); - } - - // add stroke adjustment hints - if (state->strokeAdjust) { - if (i >= subpathStart + 1) { - if (i >= subpathStart + 2) { - pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0); - pathOut->addStrokeAdjustHint(left1, right1, join0, left2); - } else { - pathOut->addStrokeAdjustHint(left1, right1, firstPt, left2); - } - pathOut->addStrokeAdjustHint(left1, right1, right2 + 1, right2 + 1); - } - left0 = left1; - left1 = left2; - right0 = right1; - right1 = right2; - join0 = join1; - join1 = join2; - if (i == subpathStart) { - leftFirst = left2; - rightFirst = right2; - } - if (last) { - if (i >= subpathStart + 2) { - pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0); - pathOut->addStrokeAdjustHint(left1, right1, - join0, pathOut->length - 1); - } else { - pathOut->addStrokeAdjustHint(left1, right1, - firstPt, pathOut->length - 1); - } - if (closed) { - pathOut->addStrokeAdjustHint(left1, right1, firstPt, leftFirst); - pathOut->addStrokeAdjustHint(left1, right1, - rightFirst + 1, rightFirst + 1); - pathOut->addStrokeAdjustHint(leftFirst, rightFirst, - left1 + 1, right1); - pathOut->addStrokeAdjustHint(leftFirst, rightFirst, - join1, pathOut->length - 1); - } - } - } - } - - if (pathIn != path) { - delete pathIn; - } - - return pathOut; -} - -void Splash::dumpPath(SplashPath *path) { - int i; - - for (i = 0; i < path->length; ++i) { - printf(" %3d: x=%8.2f y=%8.2f%s%s%s%s\n", - i, (double)path->pts[i].x, (double)path->pts[i].y, - (path->flags[i] & splashPathFirst) ? " first" : "", - (path->flags[i] & splashPathLast) ? " last" : "", - (path->flags[i] & splashPathClosed) ? " closed" : "", - (path->flags[i] & splashPathCurve) ? " curve" : ""); - } -} - -void Splash::dumpXPath(SplashXPath *path) { - int i; - - for (i = 0; i < path->length; ++i) { - printf(" %4d: x0=%8.2f y0=%8.2f x1=%8.2f y1=%8.2f %s%s%s%s%s%s%s\n", - i, (double)path->segs[i].x0, (double)path->segs[i].y0, - (double)path->segs[i].x1, (double)path->segs[i].y1, - (path->segs[i].flags & splashXPathFirst) ? "F" : " ", - (path->segs[i].flags & splashXPathLast) ? "L" : " ", - (path->segs[i].flags & splashXPathEnd0) ? "0" : " ", - (path->segs[i].flags & splashXPathEnd1) ? "1" : " ", - (path->segs[i].flags & splashXPathHoriz) ? "H" : " ", - (path->segs[i].flags & splashXPathVert) ? "V" : " ", - (path->segs[i].flags & splashXPathFlip) ? "P" : " "); - } -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/Splash.h b/Build/source/libs/poppler/poppler-0.12.4/splash/Splash.h deleted file mode 100644 index c9d57cc7acb..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/Splash.h +++ /dev/null @@ -1,306 +0,0 @@ -//======================================================================== -// -// Splash.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> -// Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASH_H -#define SPLASH_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" -#include "SplashClip.h" - -class Splash; -class SplashBitmap; -struct SplashGlyphBitmap; -class SplashState; -class SplashPattern; -class SplashScreen; -class SplashPath; -class SplashXPath; -class SplashFont; -struct SplashPipe; - -//------------------------------------------------------------------------ - -// Retrieves the next line of pixels in an image mask. Normally, -// fills in *<line> and returns true. If the image stream is -// exhausted, returns false. -typedef GBool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel); - -// Retrieves the next line of pixels in an image. Normally, fills in -// *<line> and returns true. If the image stream is exhausted, -// returns false. -typedef GBool (*SplashImageSource)(void *data, SplashColorPtr colorLine, - Guchar *alphaLine); - -//------------------------------------------------------------------------ - -enum SplashPipeResultColorCtrl { -#if SPLASH_CMYK - splashPipeResultColorNoAlphaBlendCMYK, -#endif - splashPipeResultColorNoAlphaBlendRGB, - splashPipeResultColorNoAlphaBlendMono, - splashPipeResultColorAlphaNoBlendMono, - splashPipeResultColorAlphaNoBlendRGB, -#if SPLASH_CMYK - splashPipeResultColorAlphaNoBlendCMYK, -#endif - splashPipeResultColorAlphaBlendMono, - splashPipeResultColorAlphaBlendRGB -#if SPLASH_CMYK - , - splashPipeResultColorAlphaBlendCMYK -#endif -}; - -//------------------------------------------------------------------------ -// Splash -//------------------------------------------------------------------------ - -class Splash { -public: - - // Create a new rasterizer object. - Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreenParams *screenParams = NULL); - Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreen *screenA); - - ~Splash(); - - //----- state read - - SplashCoord *getMatrix(); - SplashPattern *getStrokePattern(); - SplashPattern *getFillPattern(); - SplashScreen *getScreen(); - SplashBlendFunc getBlendFunc(); - SplashCoord getStrokeAlpha(); - SplashCoord getFillAlpha(); - SplashCoord getLineWidth(); - int getLineCap(); - int getLineJoin(); - SplashCoord getMiterLimit(); - SplashCoord getFlatness(); - SplashCoord *getLineDash(); - int getLineDashLength(); - SplashCoord getLineDashPhase(); - SplashClip *getClip(); - SplashBitmap *getSoftMask(); - GBool getInNonIsolatedGroup(); - - //----- state write - - void setMatrix(SplashCoord *matrix); - void setStrokePattern(SplashPattern *strokeColor); - void setFillPattern(SplashPattern *fillColor); - void setScreen(SplashScreen *screen); - void setBlendFunc(SplashBlendFunc func); - void setStrokeAlpha(SplashCoord alpha); - void setFillAlpha(SplashCoord alpha); - void setLineWidth(SplashCoord lineWidth); - void setLineCap(int lineCap); - void setLineJoin(int lineJoin); - void setMiterLimit(SplashCoord miterLimit); - void setFlatness(SplashCoord flatness); - // the <lineDash> array will be copied - void setLineDash(SplashCoord *lineDash, int lineDashLength, - SplashCoord lineDashPhase); - void setStrokeAdjust(GBool strokeAdjust); - // NB: uses transformed coordinates. - void clipResetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - // NB: uses transformed coordinates. - SplashError clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - // NB: uses untransformed coordinates. - SplashError clipToPath(SplashPath *path, GBool eo); - void setSoftMask(SplashBitmap *softMask); - void setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA, - int alpha0XA, int alpha0YA); - - //----- state save/restore - - void saveState(); - SplashError restoreState(); - - //----- drawing operations - - // Fill the bitmap with <color>. This is not subject to clipping. - void clear(SplashColorPtr color, Guchar alpha = 0x00); - - // Stroke a path using the current stroke pattern. - SplashError stroke(SplashPath *path); - - // Fill a path using the current fill pattern. - SplashError fill(SplashPath *path, GBool eo); - - // Fill a path, XORing with the current fill pattern. - SplashError xorFill(SplashPath *path, GBool eo); - - // Draw a character, using the current fill pattern. - SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font); - - // Draw a glyph, using the current fill pattern. This function does - // not free any data, i.e., it ignores glyph->freeData. - void fillGlyph(SplashCoord x, SplashCoord y, - SplashGlyphBitmap *glyph); - - // Draws an image mask using the fill color. This will read <h> - // lines of <w> pixels from <src>, starting with the top line. "1" - // pixels will be drawn with the current fill color; "0" pixels are - // transparent. The matrix: - // [ mat[0] mat[1] 0 ] - // [ mat[2] mat[3] 0 ] - // [ mat[4] mat[5] 1 ] - // maps a unit square to the desired destination for the image, in - // PostScript style: - // [x' y' 1] = [x y 1] * mat - // Note that the Splash y axis points downward, and the image source - // is assumed to produce pixels in raster order, starting from the - // top line. - SplashError fillImageMask(SplashImageMaskSource src, void *srcData, - int w, int h, SplashCoord *mat, - GBool glyphMode); - - // Draw an image. This will read <h> lines of <w> pixels from - // <src>, starting with the top line. These pixels are assumed to - // be in the source mode, <srcMode>. If <srcAlpha> is true, the - // alpha values returned by <src> are used; otherwise they are - // ignored. The following combinations of source and target modes - // are supported: - // source target - // ------ ------ - // Mono1 Mono1 - // Mono8 Mono1 -- with dithering - // Mono8 Mono8 - // RGB8 RGB8 - // BGR8 BGR8 - // CMYK8 CMYK8 - // The matrix behaves as for fillImageMask. - SplashError drawImage(SplashImageSource src, void *srcData, - SplashColorMode srcMode, GBool srcAlpha, - int w, int h, SplashCoord *mat); - - // Composite a rectangular region from <src> onto this Splash - // object. - SplashError composite(SplashBitmap *src, int xSrc, int ySrc, - int xDest, int yDest, int w, int h, - GBool noClip, GBool nonIsolated); - - // Composite this Splash object onto a background color. The - // background alpha is assumed to be 1. - void compositeBackground(SplashColorPtr color); - - // Copy a rectangular region from <src> onto the bitmap belonging to - // this Splash object. The destination alpha values are all set to - // zero. - SplashError blitTransparent(SplashBitmap *src, int xSrc, int ySrc, - int xDest, int yDest, int w, int h); - - //----- misc - - // Construct a path for a stroke, given the path to be stroked, and - // using the current line parameters. If <flatten> is true, this - // function will first flatten the path and handle the linedash. - SplashPath *makeStrokePath(SplashPath *path, GBool flatten = gTrue); - - // Return the associated bitmap. - SplashBitmap *getBitmap() { return bitmap; } - - // Get a bounding box which includes all modifications since the - // last call to clearModRegion. - void getModRegion(int *xMin, int *yMin, int *xMax, int *yMax) - { *xMin = modXMin; *yMin = modYMin; *xMax = modXMax; *yMax = modYMax; } - - // Clear the modified region bounding box. - void clearModRegion(); - - // Get clipping status for the last drawing operation subject to - // clipping. - SplashClipResult getClipRes() { return opClipRes; } - - // Toggle debug mode on or off. - void setDebugMode(GBool debugModeA) { debugMode = debugModeA; } - -#if 1 //~tmp: turn off anti-aliasing temporarily - GBool getVectorAntialias() { return vectorAntialias; } - void setVectorAntialias(GBool vaa) { vectorAntialias = vaa; } -#endif - -private: - - void pipeInit(SplashPipe *pipe, int x, int y, - SplashPattern *pattern, SplashColorPtr cSrc, - SplashCoord aInput, GBool usesShape, - GBool nonIsolatedGroup); - void pipeRun(SplashPipe *pipe); - void pipeSetXY(SplashPipe *pipe, int x, int y); - void pipeIncX(SplashPipe *pipe); - void drawPixel(SplashPipe *pipe, int x, int y, GBool noClip); - void drawAAPixelInit(); - void drawAAPixel(SplashPipe *pipe, int x, int y); - void drawSpan(SplashPipe *pipe, int x0, int x1, int y, GBool noClip); - void drawAALine(SplashPipe *pipe, int x0, int x1, int y); - void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, - SplashCoord *xo, SplashCoord *yo); - void updateModX(int x); - void updateModY(int y); - void strokeNarrow(SplashPath *path); - void strokeWide(SplashPath *path); - SplashPath *flattenPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness); - void flattenCurve(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3, - SplashCoord *matrix, SplashCoord flatness2, - SplashPath *fPath); - SplashPath *makeDashedPath(SplashPath *xPath); - SplashError fillWithPattern(SplashPath *path, GBool eo, - SplashPattern *pattern, SplashCoord alpha); - void fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noclip); - void dumpPath(SplashPath *path); - void dumpXPath(SplashXPath *path); - - static SplashPipeResultColorCtrl pipeResultColorNoAlphaBlend[]; - static SplashPipeResultColorCtrl pipeResultColorAlphaNoBlend[]; - static SplashPipeResultColorCtrl pipeResultColorAlphaBlend[]; - static int pipeNonIsoGroupCorrection[]; - - SplashBitmap *bitmap; - SplashState *state; - SplashBitmap *aaBuf; - int aaBufY; - SplashBitmap *alpha0Bitmap; // for non-isolated groups, this is the - // bitmap containing the alpha0 values - int alpha0X, alpha0Y; // offset within alpha0Bitmap - SplashCoord aaGamma[splashAASize * splashAASize + 1]; - int modXMin, modYMin, modXMax, modYMax; - SplashClipResult opClipRes; - GBool vectorAntialias; - GBool debugMode; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashBitmap.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashBitmap.cc deleted file mode 100644 index 947becaf28d..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashBitmap.cc +++ /dev/null @@ -1,376 +0,0 @@ -//======================================================================== -// -// SplashBitmap.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006, 2009 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen@gmail.com> -// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> -#include "goo/gmem.h" -#include "SplashErrorCodes.h" -#include "SplashBitmap.h" -#include "poppler/Error.h" -#include "PNGWriter.h" - -//------------------------------------------------------------------------ -// SplashBitmap -//------------------------------------------------------------------------ - -SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad, - SplashColorMode modeA, GBool alphaA, - GBool topDown) { - width = widthA; - height = heightA; - mode = modeA; - switch (mode) { - case splashModeMono1: - if (width > 0) { - rowSize = (width + 7) >> 3; - } else { - rowSize = -1; - } - break; - case splashModeMono8: - if (width > 0) { - rowSize = width; - } else { - rowSize = -1; - } - break; - case splashModeRGB8: - case splashModeBGR8: - if (width > 0 && width <= INT_MAX / 3) { - rowSize = width * 3; - } else { - rowSize = -1; - } - break; - case splashModeXBGR8: - if (width > 0 && width <= INT_MAX / 4) { - rowSize = width * 4; - } else { - rowSize = -1; - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - if (width > 0 && width <= INT_MAX / 4) { - rowSize = width * 4; - } else { - rowSize = -1; - } - break; -#endif - } - if (rowSize > 0) { - rowSize += rowPad - 1; - rowSize -= rowSize % rowPad; - } - data = (SplashColorPtr)gmallocn(rowSize, height); - if (!topDown) { - data += (height - 1) * rowSize; - rowSize = -rowSize; - } - if (alphaA) { - alpha = (Guchar *)gmallocn(width, height); - } else { - alpha = NULL; - } -} - - -SplashBitmap::~SplashBitmap() { - if (rowSize < 0) { - gfree(data + (height - 1) * rowSize); - } else { - gfree(data); - } - gfree(alpha); -} - - -SplashError SplashBitmap::writePNMFile(char *fileName) { - FILE *f; - SplashError e; - - if (!(f = fopen(fileName, "wb"))) { - return splashErrOpenFile; - } - - e = this->writePNMFile(f); - - fclose(f); - return e; -} - - -SplashError SplashBitmap::writePNMFile(FILE *f) { - SplashColorPtr row, p; - int x, y; - - switch (mode) { - - case splashModeMono1: - fprintf(f, "P4\n%d %d\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; x += 8) { - fputc(*p ^ 0xff, f); - ++p; - } - row += rowSize; - } - break; - - case splashModeMono8: - fprintf(f, "P5\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(*p, f); - ++p; - } - row += rowSize; - } - break; - - case splashModeRGB8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashRGB8R(p), f); - fputc(splashRGB8G(p), f); - fputc(splashRGB8B(p), f); - p += 3; - } - row += rowSize; - } - break; - - case splashModeXBGR8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashBGR8R(p), f); - fputc(splashBGR8G(p), f); - fputc(splashBGR8B(p), f); - p += 4; - } - row += rowSize; - } - break; - - - case splashModeBGR8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashBGR8R(p), f); - fputc(splashBGR8G(p), f); - fputc(splashBGR8B(p), f); - p += 3; - } - row += rowSize; - } - break; - -#if SPLASH_CMYK - case splashModeCMYK8: - // PNM doesn't support CMYK - error(-1, "unsupported SplashBitmap mode"); - return splashErrGeneric; - break; -#endif - } - return splashOk; -} - - -void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) { - SplashColorPtr p; - - if (y < 0 || y >= height || x < 0 || x >= width) { - return; - } - switch (mode) { - case splashModeMono1: - p = &data[y * rowSize + (x >> 3)]; - pixel[0] = (p[0] & (0x80 >> (x & 7))) ? 0xff : 0x00; - break; - case splashModeMono8: - p = &data[y * rowSize + x]; - pixel[0] = p[0]; - break; - case splashModeRGB8: - p = &data[y * rowSize + 3 * x]; - pixel[0] = p[0]; - pixel[1] = p[1]; - pixel[2] = p[2]; - break; - case splashModeXBGR8: - p = &data[y * rowSize + 4 * x]; - pixel[0] = p[2]; - pixel[1] = p[1]; - pixel[2] = p[0]; - pixel[3] = p[3]; - break; - case splashModeBGR8: - p = &data[y * rowSize + 3 * x]; - pixel[0] = p[2]; - pixel[1] = p[1]; - pixel[2] = p[0]; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - p = &data[y * rowSize + 4 * x]; - pixel[0] = p[0]; - pixel[1] = p[1]; - pixel[2] = p[2]; - pixel[3] = p[3]; - break; -#endif - } -} - -Guchar SplashBitmap::getAlpha(int x, int y) { - return alpha[y * width + x]; -} - -SplashError SplashBitmap::writePNGFile(char *fileName) { - FILE *f; - SplashError e; - - if (!(f = fopen(fileName, "wb"))) { - return splashErrOpenFile; - } - - e = writePNGFile(f); - - fclose(f); - return e; -} - -SplashError SplashBitmap::writePNGFile(FILE *f) { -#ifndef ENABLE_LIBPNG - error(-1, "PNG support not compiled in"); - return splashErrGeneric; -#else - if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1) { - error(-1, "unsupported SplashBitmap mode"); - return splashErrGeneric; - } - - PNGWriter *writer = new PNGWriter(); - if (!writer->init(f, width, height)) { - delete writer; - return splashErrGeneric; - } - - switch (mode) { - case splashModeRGB8: - { - SplashColorPtr row; - png_bytep *row_pointers = new png_bytep[height]; - row = data; - - for (int y = 0; y < height; ++y) { - row_pointers[y] = row; - row += rowSize; - } - if (!writer->writePointers(row_pointers)) { - delete[] row_pointers; - delete writer; - return splashErrGeneric; - } - delete[] row_pointers; - } - break; - - case splashModeMono8: - { - png_byte *row = new png_byte[3 * width]; - for (int y = 0; y < height; y++) { - // Convert into a PNG row - for (int x = 0; x < width; x++) { - row[3*x] = data[y * rowSize + x]; - row[3*x+1] = data[y * rowSize + x]; - row[3*x+2] = data[y * rowSize + x]; - } - - if (!writer->writeRow(&row)) { - delete[] row; - delete writer; - return splashErrGeneric; - } - } - delete[] row; - } - break; - - case splashModeMono1: - { - png_byte *row = new png_byte[3 * width]; - for (int y = 0; y < height; y++) { - // Convert into a PNG row - for (int x = 0; x < width; x++) { - getPixel(x, y, &row[3*x]); - row[3*x+1] = row[3*x]; - row[3*x+2] = row[3*x]; - } - - if (!writer->writeRow(&row)) { - delete[] row; - delete writer; - return splashErrGeneric; - } - } - delete[] row; - } - break; - - default: - // can't happen - break; - } - - if (writer->close()) { - delete writer; - return splashErrGeneric; - } - - delete writer; - - return splashOk; -#endif -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashBitmap.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashBitmap.h deleted file mode 100644 index 50857632b17..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashBitmap.h +++ /dev/null @@ -1,80 +0,0 @@ -//======================================================================== -// -// SplashBitmap.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen@gmail.com> -// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHBITMAP_H -#define SPLASHBITMAP_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" -#include <stdio.h> - -//------------------------------------------------------------------------ -// SplashBitmap -//------------------------------------------------------------------------ - -class SplashBitmap { -public: - - // Create a new bitmap. It will have <widthA> x <heightA> pixels in - // color mode <modeA>. Rows will be padded out to a multiple of - // <rowPad> bytes. If <topDown> is false, the bitmap will be stored - // upside-down, i.e., with the last row first in memory. - SplashBitmap(int widthA, int heightA, int rowPad, - SplashColorMode modeA, GBool alphaA, - GBool topDown = gTrue); - - ~SplashBitmap(); - - int getWidth() { return width; } - int getHeight() { return height; } - int getRowSize() { return rowSize; } - int getAlphaRowSize() { return width; } - SplashColorMode getMode() { return mode; } - SplashColorPtr getDataPtr() { return data; } - Guchar *getAlphaPtr() { return alpha; } - - SplashError writePNMFile(char *fileName); - SplashError writePNMFile(FILE *f); - - SplashError writePNGFile(char *fileName); - SplashError writePNGFile(FILE *f); - - void getPixel(int x, int y, SplashColorPtr pixel); - Guchar getAlpha(int x, int y); - -private: - - int width, height; // size of bitmap - int rowSize; // size of one row of data, in bytes - // - negative for bottom-up bitmaps - SplashColorMode mode; // color mode - SplashColorPtr data; // pointer to row zero of the color data - Guchar *alpha; // pointer to row zero of the alpha data - // (always top-down) - - friend class Splash; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashClip.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashClip.cc deleted file mode 100644 index 87b0d7ef56b..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashClip.cc +++ /dev/null @@ -1,382 +0,0 @@ -//======================================================================== -// -// SplashClip.cc -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <string.h> -#include "goo/gmem.h" -#include "SplashErrorCodes.h" -#include "SplashPath.h" -#include "SplashXPath.h" -#include "SplashXPathScanner.h" -#include "SplashBitmap.h" -#include "SplashClip.h" - -//------------------------------------------------------------------------ -// SplashClip.flags -//------------------------------------------------------------------------ - -#define splashClipEO 0x01 // use even-odd rule - -//------------------------------------------------------------------------ -// SplashClip -//------------------------------------------------------------------------ - -SplashClip::SplashClip(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - GBool antialiasA) { - antialias = antialiasA; - if (x0 < x1) { - xMin = x0; - xMax = x1; - } else { - xMin = x1; - xMax = x0; - } - if (y0 < y1) { - yMin = y0; - yMax = y1; - } else { - yMin = y1; - yMax = y0; - } - xMinI = splashFloor(xMin); - yMinI = splashFloor(yMin); - xMaxI = splashFloor(xMax); - yMaxI = splashFloor(yMax); - paths = NULL; - flags = NULL; - scanners = NULL; - length = size = 0; -} - -SplashClip::SplashClip(SplashClip *clip) { - int i; - - antialias = clip->antialias; - xMin = clip->xMin; - yMin = clip->yMin; - xMax = clip->xMax; - yMax = clip->yMax; - xMinI = clip->xMinI; - yMinI = clip->yMinI; - xMaxI = clip->xMaxI; - yMaxI = clip->yMaxI; - length = clip->length; - size = clip->size; - paths = (SplashXPath **)gmallocn(size, sizeof(SplashXPath *)); - flags = (Guchar *)gmallocn(size, sizeof(Guchar)); - scanners = (SplashXPathScanner **) - gmallocn(size, sizeof(SplashXPathScanner *)); - for (i = 0; i < length; ++i) { - paths[i] = clip->paths[i]->copy(); - flags[i] = clip->flags[i]; - scanners[i] = new SplashXPathScanner(paths[i], flags[i] & splashClipEO); - } -} - -SplashClip::~SplashClip() { - int i; - - for (i = 0; i < length; ++i) { - delete paths[i]; - delete scanners[i]; - } - gfree(paths); - gfree(flags); - gfree(scanners); -} - -void SplashClip::grow(int nPaths) { - if (length + nPaths > size) { - if (size == 0) { - size = 32; - } - while (size < length + nPaths) { - size *= 2; - } - paths = (SplashXPath **)greallocn(paths, size, sizeof(SplashXPath *)); - flags = (Guchar *)greallocn(flags, size, sizeof(Guchar)); - scanners = (SplashXPathScanner **) - greallocn(scanners, size, sizeof(SplashXPathScanner *)); - } -} - -void SplashClip::resetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - int i; - - for (i = 0; i < length; ++i) { - delete paths[i]; - delete scanners[i]; - } - gfree(paths); - gfree(flags); - gfree(scanners); - paths = NULL; - flags = NULL; - scanners = NULL; - length = size = 0; - - if (x0 < x1) { - xMin = x0; - xMax = x1; - } else { - xMin = x1; - xMax = x0; - } - if (y0 < y1) { - yMin = y0; - yMax = y1; - } else { - yMin = y1; - yMax = y0; - } - xMinI = splashFloor(xMin); - yMinI = splashFloor(yMin); - xMaxI = splashFloor(xMax); - yMaxI = splashFloor(yMax); -} - -SplashError SplashClip::clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - if (x0 < x1) { - if (x0 > xMin) { - xMin = x0; - xMinI = splashFloor(xMin); - } - if (x1 < xMax) { - xMax = x1; - xMaxI = splashFloor(xMax); - } - } else { - if (x1 > xMin) { - xMin = x1; - xMinI = splashFloor(xMin); - } - if (x0 < xMax) { - xMax = x0; - xMaxI = splashFloor(xMax); - } - } - if (y0 < y1) { - if (y0 > yMin) { - yMin = y0; - yMinI = splashFloor(yMin); - } - if (y1 < yMax) { - yMax = y1; - yMaxI = splashFloor(yMax); - } - } else { - if (y1 > yMin) { - yMin = y1; - yMinI = splashFloor(yMin); - } - if (y0 < yMax) { - yMax = y0; - yMaxI = splashFloor(yMax); - } - } - return splashOk; -} - -SplashError SplashClip::clipToPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool eo) { - SplashXPath *xPath; - - xPath = new SplashXPath(path, matrix, flatness, gTrue); - - // check for an empty path - if (xPath->length == 0) { - xMax = xMin - 1; - yMax = yMin - 1; - xMaxI = splashFloor(xMax); - yMaxI = splashFloor(yMax); - delete xPath; - - // check for a rectangle - } else if (xPath->length == 4 && - ((xPath->segs[0].x0 == xPath->segs[0].x1 && - xPath->segs[0].x0 == xPath->segs[1].x0 && - xPath->segs[0].x0 == xPath->segs[3].x1 && - xPath->segs[2].x0 == xPath->segs[2].x1 && - xPath->segs[2].x0 == xPath->segs[1].x1 && - xPath->segs[2].x0 == xPath->segs[3].x0 && - xPath->segs[1].y0 == xPath->segs[1].y1 && - xPath->segs[1].y0 == xPath->segs[0].y1 && - xPath->segs[1].y0 == xPath->segs[2].y0 && - xPath->segs[3].y0 == xPath->segs[3].y1 && - xPath->segs[3].y0 == xPath->segs[0].y0 && - xPath->segs[3].y0 == xPath->segs[2].y1) || - (xPath->segs[0].y0 == xPath->segs[0].y1 && - xPath->segs[0].y0 == xPath->segs[1].y0 && - xPath->segs[0].y0 == xPath->segs[3].y1 && - xPath->segs[2].y0 == xPath->segs[2].y1 && - xPath->segs[2].y0 == xPath->segs[1].y1 && - xPath->segs[2].y0 == xPath->segs[3].y0 && - xPath->segs[1].x0 == xPath->segs[1].x1 && - xPath->segs[1].x0 == xPath->segs[0].x1 && - xPath->segs[1].x0 == xPath->segs[2].x0 && - xPath->segs[3].x0 == xPath->segs[3].x1 && - xPath->segs[3].x0 == xPath->segs[0].x0 && - xPath->segs[3].x0 == xPath->segs[2].x1))) { - clipToRect(xPath->segs[0].x0, xPath->segs[0].y0, - xPath->segs[2].x0, xPath->segs[2].y0); - delete xPath; - - } else { - grow(1); - if (antialias) { - xPath->aaScale(); - } - xPath->sort(); - paths[length] = xPath; - flags[length] = eo ? splashClipEO : 0; - scanners[length] = new SplashXPathScanner(xPath, eo); - ++length; - } - - return splashOk; -} - -GBool SplashClip::test(int x, int y) { - int i; - - // check the rectangle - if (x < xMinI || x > xMaxI || y < yMinI || y > yMaxI) { - return gFalse; - } - - // check the paths - if (antialias) { - for (i = 0; i < length; ++i) { - if (!scanners[i]->test(x * splashAASize, y * splashAASize)) { - return gFalse; - } - } - } else { - for (i = 0; i < length; ++i) { - if (!scanners[i]->test(x, y)) { - return gFalse; - } - } - } - - return gTrue; -} - -SplashClipResult SplashClip::testRect(int rectXMin, int rectYMin, - int rectXMax, int rectYMax) { - // This tests the rectangle: - // x = [rectXMin, rectXMax + 1) (note: rect coords are ints) - // y = [rectYMin, rectYMax + 1) - // against the clipping region: - // x = [xMin, xMax] (note: clipping coords are fp) - // y = [yMin, yMax] - if ((SplashCoord)(rectXMax + 1) <= xMin || (SplashCoord)rectXMin > xMax || - (SplashCoord)(rectYMax + 1) <= yMin || (SplashCoord)rectYMin > yMax) { - return splashClipAllOutside; - } - if ((SplashCoord)rectXMin >= xMin && (SplashCoord)(rectXMax + 1) <= xMax && - (SplashCoord)rectYMin >= yMin && (SplashCoord)(rectYMax + 1) <= yMax && - length == 0) { - return splashClipAllInside; - } - return splashClipPartial; -} - -SplashClipResult SplashClip::testSpan(int spanXMin, int spanXMax, int spanY) { - int i; - - // This tests the rectangle: - // x = [spanXMin, spanXMax + 1) (note: span coords are ints) - // y = [spanY, spanY + 1) - // against the clipping region: - // x = [xMin, xMax] (note: clipping coords are fp) - // y = [yMin, yMax] - if ((SplashCoord)(spanXMax + 1) <= xMin || (SplashCoord)spanXMin > xMax || - (SplashCoord)(spanY + 1) <= yMin || (SplashCoord)spanY > yMax) { - return splashClipAllOutside; - } - if (!((SplashCoord)spanXMin >= xMin && (SplashCoord)(spanXMax + 1) <= xMax && - (SplashCoord)spanY >= yMin && (SplashCoord)(spanY + 1) <= yMax)) { - return splashClipPartial; - } - if (antialias) { - for (i = 0; i < length; ++i) { - if (!scanners[i]->testSpan(spanXMin * splashAASize, - spanXMax * splashAASize + (splashAASize - 1), - spanY * splashAASize)) { - return splashClipPartial; - } - } - } else { - for (i = 0; i < length; ++i) { - if (!scanners[i]->testSpan(spanXMin, spanXMax, spanY)) { - return splashClipPartial; - } - } - } - return splashClipAllInside; -} - -void SplashClip::clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y) { - int xx0, xx1, xx, yy, i; - SplashColorPtr p; - - // zero out pixels with x < xMin - xx0 = *x0 * splashAASize; - xx1 = splashFloor(xMin * splashAASize); - if (xx1 > aaBuf->getWidth()) { - xx1 = aaBuf->getWidth(); - } - if (xx0 < xx1) { - xx0 &= ~7; - for (yy = 0; yy < splashAASize; ++yy) { - p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx0 >> 3); - for (xx = xx0; xx + 7 < xx1; xx += 8) { - *p++ = 0; - } - if (xx < xx1) { - *p &= 0xff >> (xx1 & 7); - } - } - *x0 = splashFloor(xMin); - } - - // zero out pixels with x > xMax - xx0 = splashFloor(xMax * splashAASize) + 1; - if (xx0 < 0) { - xx0 = 0; - } - xx1 = (*x1 + 1) * splashAASize; - if (xx0 < xx1) { - for (yy = 0; yy < splashAASize; ++yy) { - p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx0 >> 3); - xx = xx0; - if (xx & 7) { - *p &= 0xff00 >> (xx & 7); - xx = (xx & ~7) + 8; - ++p; - } - for (; xx < xx1; xx += 8) { - *p++ = 0; - } - } - *x1 = splashFloor(xMax); - } - - // check the paths - for (i = 0; i < length; ++i) { - scanners[i]->clipAALine(aaBuf, x0, x1, y); - } -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashClip.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashClip.h deleted file mode 100644 index 1864149234a..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashClip.h +++ /dev/null @@ -1,105 +0,0 @@ -//======================================================================== -// -// SplashClip.h -// -//======================================================================== - -#ifndef SPLASHCLIP_H -#define SPLASHCLIP_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" -#include "SplashMath.h" - -class SplashPath; -class SplashXPath; -class SplashXPathScanner; -class SplashBitmap; - -//------------------------------------------------------------------------ - -enum SplashClipResult { - splashClipAllInside, - splashClipAllOutside, - splashClipPartial -}; - -//------------------------------------------------------------------------ -// SplashClip -//------------------------------------------------------------------------ - -class SplashClip { -public: - - // Create a clip, for the given rectangle. - SplashClip(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - GBool antialiasA); - - // Copy a clip. - SplashClip *copy() { return new SplashClip(this); } - - ~SplashClip(); - - // Reset the clip to a rectangle. - void resetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - - // Intersect the clip with a rectangle. - SplashError clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - - // Interesect the clip with <path>. - SplashError clipToPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool eo); - - // Returns true if (<x>,<y>) is inside the clip. - GBool test(int x, int y); - - // Tests a rectangle against the clipping region. Returns one of: - // - splashClipAllInside if the entire rectangle is inside the - // clipping region, i.e., all pixels in the rectangle are - // visible - // - splashClipAllOutside if the entire rectangle is outside the - // clipping region, i.e., all the pixels in the rectangle are - // clipped - // - splashClipPartial if the rectangle is part inside and part - // outside the clipping region - SplashClipResult testRect(int rectXMin, int rectYMin, - int rectXMax, int rectYMax); - - // Similar to testRect, but tests a horizontal span. - SplashClipResult testSpan(int spanXMin, int spanXMax, int spanY); - - // Clips an anti-aliased line by setting pixels to zero. On entry, - // all non-zero pixels are between <x0> and <x1>. This function - // will update <x0> and <x1>. - void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y); - - // Get the rectangle part of the clip region, in integer coordinates. - int getXMinI() { return xMinI; } - int getXMaxI() { return xMaxI; } - int getYMinI() { return yMinI; } - int getYMaxI() { return yMaxI; } - - // Get the number of arbitrary paths used by the clip region. - int getNumPaths() { return length; } - -protected: - - SplashClip(SplashClip *clip); - void grow(int nPaths); - - GBool antialias; - SplashCoord xMin, yMin, xMax, yMax; - int xMinI, yMinI, xMaxI, yMaxI; - SplashXPath **paths; - Guchar *flags; - SplashXPathScanner **scanners; - int length, size; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashErrorCodes.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashErrorCodes.h deleted file mode 100644 index d1f81f85dd8..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashErrorCodes.h +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================== -// -// SplashErrorCodes.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006, 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHERRORCODES_H -#define SPLASHERRORCODES_H - -//------------------------------------------------------------------------ - -#define splashOk 0 // no error - -#define splashErrNoCurPt 1 // no current point - -#define splashErrEmptyPath 2 // zero points in path - -#define splashErrBogusPath 3 // only one point in subpath - -#define splashErrNoSave 4 // state stack is empty - -#define splashErrOpenFile 5 // couldn't open file - -#define splashErrNoGlyph 6 // couldn't get the requested glyph - -#define splashErrModeMismatch 7 // invalid combination of color modes - -#define splashErrSingularMatrix 8 // matrix is singular - -#define splashErrBadArg 9 // bad argument - -#define splashErrZeroImage 254 // image of 0x0 - -#define splashErrGeneric 255 - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFont.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFont.cc deleted file mode 100644 index 9dd0c9cc73d..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFont.cc +++ /dev/null @@ -1,428 +0,0 @@ -//======================================================================== -// -// SplashFTFont.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2005, 2007-2010 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2006 Kristian Høgsberg <krh@bitplanet.net> -// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <ft2build.h> -#include FT_OUTLINE_H -#include FT_SIZES_H -#include FT_GLYPH_H -#include "goo/gmem.h" -#include "SplashMath.h" -#include "SplashGlyphBitmap.h" -#include "SplashPath.h" -#include "SplashFTFontEngine.h" -#include "SplashFTFontFile.h" -#include "SplashFTFont.h" - -//------------------------------------------------------------------------ - -static int glyphPathMoveTo(const FT_Vector *pt, void *path); -static int glyphPathLineTo(const FT_Vector *pt, void *path); -static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, - void *path); -static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2, - const FT_Vector *pt, void *path); - -//------------------------------------------------------------------------ -// SplashFTFont -//------------------------------------------------------------------------ - -SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA): - SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa), - enableFreeTypeHinting(fontFileA->engine->enableFreeTypeHinting) -{ - FT_Face face; - double div; - int x, y; - - face = fontFileA->face; - if (FT_New_Size(face, &sizeObj)) { - return; - } - face->size = sizeObj; - size = splashSqrt(mat[2]*mat[2] + mat[3]*mat[3]); - if (FT_Set_Pixel_Sizes(face, 0, (int)size)) { - return; - } - // if the textMat values are too small, FreeType's fixed point - // arithmetic doesn't work so well - textScale = splashSqrt(textMat[2]*textMat[2] + textMat[3]*textMat[3]) / size; - - div = face->bbox.xMax > 20000 ? 65536 : 1; - - // transform the four corners of the font bounding box -- the min - // and max values form the bounding box of the transformed font - x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMin) / - (div * face->units_per_EM)); - xMin = xMax = x; - y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMin) / - (div * face->units_per_EM)); - yMin = yMax = y; - x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMin) / - (div * face->units_per_EM)); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMin) / - (div * face->units_per_EM)); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - // This is a kludge: some buggy PDF generators embed fonts with - // zero bounding boxes. - if (xMax == xMin) { - xMin = 0; - xMax = (int)size; - } - if (yMax == yMin) { - yMin = 0; - yMax = (int)((SplashCoord)1.2 * size); - } - - // compute the transform matrix -#if USE_FIXEDPOINT - matrix.xx = (FT_Fixed)((mat[0] / size).getRaw()); - matrix.yx = (FT_Fixed)((mat[1] / size).getRaw()); - matrix.xy = (FT_Fixed)((mat[2] / size).getRaw()); - matrix.yy = (FT_Fixed)((mat[3] / size).getRaw()); - textMatrix.xx = (FT_Fixed)((textMat[0] / (textScale * size)).getRaw()); - textMatrix.yx = (FT_Fixed)((textMat[1] / (textScale * size)).getRaw()); - textMatrix.xy = (FT_Fixed)((textMat[2] / (textScale * size)).getRaw()); - textMatrix.yy = (FT_Fixed)((textMat[3] / (textScale * size)).getRaw()); -#else - matrix.xx = (FT_Fixed)((mat[0] / size) * 65536); - matrix.yx = (FT_Fixed)((mat[1] / size) * 65536); - matrix.xy = (FT_Fixed)((mat[2] / size) * 65536); - matrix.yy = (FT_Fixed)((mat[3] / size) * 65536); - textMatrix.xx = (FT_Fixed)((textMat[0] / (size * textScale)) * 65536); - textMatrix.yx = (FT_Fixed)((textMat[1] / (size * textScale)) * 65536); - textMatrix.xy = (FT_Fixed)((textMat[2] / (size * textScale)) * 65536); - textMatrix.yy = (FT_Fixed)((textMat[3] / (size * textScale)) * 65536); -#endif -} - -SplashFTFont::~SplashFTFont() { -} - -GBool SplashFTFont::getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { - return SplashFont::getGlyph(c, xFrac, 0, bitmap, x0, y0, clip, clipRes); -} - -static FT_Int32 getFTLoadFlags(GBool aa, GBool enableFreeTypeHinting) -{ - if (aa && enableFreeTypeHinting) return FT_LOAD_NO_BITMAP; - else if (aa && !enableFreeTypeHinting) return FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; - else if (!aa && enableFreeTypeHinting) return FT_LOAD_DEFAULT; - else return FT_LOAD_NO_HINTING; -} - -GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { - SplashFTFontFile *ff; - FT_Vector offset; - FT_GlyphSlot slot; - FT_UInt gid; - int rowSize; - Guchar *p, *q; - int i; - - ff = (SplashFTFontFile *)fontFile; - - ff->face->size = sizeObj; - offset.x = (FT_Pos)(int)((SplashCoord)xFrac * splashFontFractionMul * 64); - offset.y = 0; - FT_Set_Transform(ff->face, &matrix, &offset); - slot = ff->face->glyph; - - if (ff->codeToGID && c < ff->codeToGIDLen) { - gid = (FT_UInt)ff->codeToGID[c]; - } else { - gid = (FT_UInt)c; - } - if (ff->trueType && gid == 0) { - // skip the TrueType notdef glyph - return gFalse; - } - - if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(aa, enableFreeTypeHinting))) { - return gFalse; - } - - FT_Glyph_Metrics *glyphMetrics = &(ff->face->glyph->metrics); - // prelimirary values from FT_Glyph_Metrics - bitmap->x = splashRound(-glyphMetrics->horiBearingX / 64.0); - bitmap->y = splashRound(glyphMetrics->horiBearingY / 64.0); - bitmap->w = splashRound(glyphMetrics->width / 64.0); - bitmap->h = splashRound(glyphMetrics->height / 64.0); - - *clipRes = clip->testRect(x0 - bitmap->x, - y0 - bitmap->y, - x0 - bitmap->x + bitmap->w, - y0 - bitmap->y + bitmap->h); - if (*clipRes == splashClipAllOutside) { - bitmap->freeData = gFalse; - return gTrue; - } - - if (FT_Render_Glyph(slot, aa ? ft_render_mode_normal - : ft_render_mode_mono)) { - return gFalse; - } - - bitmap->x = -slot->bitmap_left; - bitmap->y = slot->bitmap_top; - bitmap->w = slot->bitmap.width; - bitmap->h = slot->bitmap.rows; - bitmap->aa = aa; - if (aa) { - rowSize = bitmap->w; - } else { - rowSize = (bitmap->w + 7) >> 3; - } - bitmap->data = (Guchar *)gmallocn_checkoverflow(rowSize, bitmap->h); - if (!bitmap->data) { - return gFalse; - } - bitmap->freeData = gTrue; - for (i = 0, p = bitmap->data, q = slot->bitmap.buffer; - i < bitmap->h; - ++i, p += rowSize, q += slot->bitmap.pitch) { - memcpy(p, q, rowSize); - } - - return gTrue; -} - -double SplashFTFont::getGlyphAdvance(int c) -{ - SplashFTFontFile *ff; - FT_Vector offset; - FT_UInt gid; - FT_Matrix identityMatrix; - - ff = (SplashFTFontFile *)fontFile; - - // init the matrix - identityMatrix.xx = 65536; // 1 in 16.16 format - identityMatrix.xy = 0; - identityMatrix.yx = 0; - identityMatrix.yy = 65536; // 1 in 16.16 format - - // init the offset - offset.x = 0; - offset.y = 0; - - ff->face->size = sizeObj; - FT_Set_Transform(ff->face, &identityMatrix, &offset); - - if (ff->codeToGID && c < ff->codeToGIDLen) { - gid = (FT_UInt)ff->codeToGID[c]; - } else { - gid = (FT_UInt)c; - } - if (ff->trueType && gid == 0) { - // skip the TrueType notdef glyph - return -1; - } - - if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(aa, enableFreeTypeHinting))) { - return -1; - } - - // 64.0 is 1 in 26.6 format - return ff->face->glyph->metrics.horiAdvance / 64.0 / size; -} - -struct SplashFTFontPath { - SplashPath *path; - SplashCoord textScale; - GBool needClose; -}; - -SplashPath *SplashFTFont::getGlyphPath(int c) { - static FT_Outline_Funcs outlineFuncs = { -#if FREETYPE_MINOR <= 1 - (int (*)(FT_Vector *, void *))&glyphPathMoveTo, - (int (*)(FT_Vector *, void *))&glyphPathLineTo, - (int (*)(FT_Vector *, FT_Vector *, void *))&glyphPathConicTo, - (int (*)(FT_Vector *, FT_Vector *, FT_Vector *, void *))&glyphPathCubicTo, -#else - &glyphPathMoveTo, - &glyphPathLineTo, - &glyphPathConicTo, - &glyphPathCubicTo, -#endif - 0, 0 - }; - SplashFTFontFile *ff; - SplashFTFontPath path; - FT_GlyphSlot slot; - FT_UInt gid; - FT_Glyph glyph; - - ff = (SplashFTFontFile *)fontFile; - ff->face->size = sizeObj; - FT_Set_Transform(ff->face, &textMatrix, NULL); - slot = ff->face->glyph; - if (ff->codeToGID && c < ff->codeToGIDLen) { - gid = ff->codeToGID[c]; - } else { - gid = (FT_UInt)c; - } - if (ff->trueType && gid == 0) { - // skip the TrueType notdef glyph - return NULL; - } - if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(aa, enableFreeTypeHinting))) { - return NULL; - } - if (FT_Get_Glyph(slot, &glyph)) { - return NULL; - } - path.path = new SplashPath(); - path.textScale = textScale; - path.needClose = gFalse; - FT_Outline_Decompose(&((FT_OutlineGlyph)glyph)->outline, - &outlineFuncs, &path); - if (path.needClose) { - path.path->close(); - } - FT_Done_Glyph(glyph); - return path.path; -} - -static int glyphPathMoveTo(const FT_Vector *pt, void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - - if (p->needClose) { - p->path->close(); - p->needClose = gFalse; - } - p->path->moveTo((SplashCoord)pt->x * p->textScale / 64.0, - (SplashCoord)pt->y * p->textScale / 64.0); - return 0; -} - -static int glyphPathLineTo(const FT_Vector *pt, void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - - p->path->lineTo((SplashCoord)pt->x * p->textScale / 64.0, - (SplashCoord)pt->y * p->textScale / 64.0); - p->needClose = gTrue; - return 0; -} - -static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, - void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xc, yc; - - if (!p->path->getCurPt(&x0, &y0)) { - return 0; - } - xc = (SplashCoord)ctrl->x * p->textScale / 64.0; - yc = (SplashCoord)ctrl->y * p->textScale / 64.0; - x3 = (SplashCoord)pt->x * p->textScale / 64.0; - y3 = (SplashCoord)pt->y * p->textScale / 64.0; - - // A second-order Bezier curve is defined by two endpoints, p0 and - // p3, and one control point, pc: - // - // p(t) = (1-t)^2*p0 + t*(1-t)*pc + t^2*p3 - // - // A third-order Bezier curve is defined by the same two endpoints, - // p0 and p3, and two control points, p1 and p2: - // - // p(t) = (1-t)^3*p0 + 3t*(1-t)^2*p1 + 3t^2*(1-t)*p2 + t^3*p3 - // - // Applying some algebra, we can convert a second-order curve to a - // third-order curve: - // - // p1 = (1/3) * (p0 + 2pc) - // p2 = (1/3) * (2pc + p3) - - x1 = (SplashCoord)(1.0 / 3.0) * (x0 + (SplashCoord)2 * xc); - y1 = (SplashCoord)(1.0 / 3.0) * (y0 + (SplashCoord)2 * yc); - x2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * xc + x3); - y2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * yc + y3); - - p->path->curveTo(x1, y1, x2, y2, x3, y3); - p->needClose = gTrue; - return 0; -} - -static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2, - const FT_Vector *pt, void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - - p->path->curveTo((SplashCoord)ctrl1->x * p->textScale / 64.0, - (SplashCoord)ctrl1->y * p->textScale / 64.0, - (SplashCoord)ctrl2->x * p->textScale / 64.0, - (SplashCoord)ctrl2->y * p->textScale / 64.0, - (SplashCoord)pt->x * p->textScale / 64.0, - (SplashCoord)pt->y * p->textScale / 64.0); - p->needClose = gTrue; - return 0; -} - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFont.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFont.h deleted file mode 100644 index cf825042928..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFont.h +++ /dev/null @@ -1,76 +0,0 @@ -//======================================================================== -// -// SplashFTFont.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007-2009 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHFTFONT_H -#define SPLASHFTFONT_H - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include <ft2build.h> -#include FT_FREETYPE_H -#include "SplashFont.h" - -class SplashFTFontFile; - -//------------------------------------------------------------------------ -// SplashFTFont -//------------------------------------------------------------------------ - -class SplashFTFont: public SplashFont { -public: - - SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA); - - virtual ~SplashFTFont(); - - // Munge xFrac and yFrac before calling SplashFont::getGlyph. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); - - // Rasterize a glyph. The <xFrac> and <yFrac> values are the same - // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); - - // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c); - - // Return the advance of a glyph. (in 0..1 range) - virtual double getGlyphAdvance(int c); - -private: - - FT_Size sizeObj; - FT_Matrix matrix; - FT_Matrix textMatrix; - SplashCoord textScale; - double size; - GBool enableFreeTypeHinting; -}; - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontEngine.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontEngine.cc deleted file mode 100644 index 7cf4f0618a4..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontEngine.cc +++ /dev/null @@ -1,213 +0,0 @@ -//======================================================================== -// -// SplashFTFontEngine.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdio.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include "goo/gmem.h" -#include "goo/GooString.h" -#include "goo/gfile.h" -#include "fofi/FoFiTrueType.h" -#include "fofi/FoFiType1C.h" -#include "SplashFTFontFile.h" -#include "SplashFTFontEngine.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ - -#if 0 -static void fileWrite(void *stream, char *data, int len) { - fwrite(data, 1, len, (FILE *)stream); -} -#endif - -//------------------------------------------------------------------------ -// SplashFTFontEngine -//------------------------------------------------------------------------ - -SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, FT_Library libA) { - FT_Int major, minor, patch; - - aa = aaA; - enableFreeTypeHinting = enableFreeTypeHintingA; - lib = libA; - - // as of FT 2.1.8, CID fonts are indexed by CID instead of GID - FT_Library_Version(lib, &major, &minor, &patch); - useCIDs = major > 2 || - (major == 2 && (minor > 1 || (minor == 1 && patch > 7))); -} - -SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA, GBool enableFreeTypeHintingA) { - FT_Library libA; - - if (FT_Init_FreeType(&libA)) { - return NULL; - } - return new SplashFTFontEngine(aaA, enableFreeTypeHintingA, libA); -} - -SplashFTFontEngine::~SplashFTFontEngine() { - FT_Done_FreeType(lib); -} - -SplashFontFile *SplashFTFontEngine::loadType1Font(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - return SplashFTFontFile::loadType1Font(this, idA, src, enc); -} - -SplashFontFile *SplashFTFontEngine::loadType1CFont(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - return SplashFTFontFile::loadType1Font(this, idA, src, enc); -} - -SplashFontFile *SplashFTFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - return SplashFTFontFile::loadType1Font(this, idA, src, enc); -} - -SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA, - SplashFontSrc *src) { - FoFiType1C *ff; - Gushort *cidToGIDMap; - int nCIDs; - SplashFontFile *ret; - - // check for a CFF font - if (useCIDs) { - cidToGIDMap = NULL; - nCIDs = 0; - } else { - if (src->isFile) { - ff = FoFiType1C::load(src->fileName->getCString()); - } else { - ff = FoFiType1C::make(src->buf, src->bufLen); - } - if (ff) { - cidToGIDMap = ff->getCIDToGIDMap(&nCIDs); - delete ff; - } else { - cidToGIDMap = NULL; - nCIDs = 0; - } - } - ret = SplashFTFontFile::loadCIDFont(this, idA, src, cidToGIDMap, nCIDs); - if (!ret) { - gfree(cidToGIDMap); - } - return ret; -} - -SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, - SplashFontSrc *src) { - FoFiTrueType *ff; - GBool isCID; - Gushort *cidToGIDMap; - int nCIDs; - SplashFontFile *ret; - - cidToGIDMap = NULL; - nCIDs = 0; - isCID = gFalse; - if (!useCIDs) { - if (src->isFile) { - ff = FoFiTrueType::load(src->fileName->getCString()); - } else { - ff = FoFiTrueType::make(src->buf, src->bufLen); - } - if (ff) { - if (ff->isOpenTypeCFF()) { - cidToGIDMap = ff->getCIDToGIDMap(&nCIDs); - } - delete ff; - } - } - ret = SplashFTFontFile::loadCIDFont(this, idA, src, - cidToGIDMap, nCIDs); - if (!ret) { - gfree(cidToGIDMap); - } - return ret; -} - -SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA, - SplashFontSrc *src, - Gushort *codeToGID, - int codeToGIDLen, - int faceIndex) { -#if 0 - FoFiTrueType *ff; - GooString *tmpFileName; - FILE *tmpFile; - SplashFontFile *ret; - - if (!(ff = FoFiTrueType::load(fileName))) { - return NULL; - } - tmpFileName = NULL; - if (!openTempFile(&tmpFileName, &tmpFile, "wb")) { - delete ff; - return NULL; - } - ff->writeTTF(&fileWrite, tmpFile); - delete ff; - fclose(tmpFile); - ret = SplashFTFontFile::loadTrueTypeFont(this, idA, - tmpFileName->getCString(), - gTrue, codeToGID, codeToGIDLen, - faceIndex); - if (ret) { - if (deleteFile) { - unlink(fileName); - } - } else { - unlink(tmpFileName->getCString()); - } - delete tmpFileName; - return ret; -#else - SplashFontFile *ret; - ret = SplashFTFontFile::loadTrueTypeFont(this, idA, src, - codeToGID, codeToGIDLen, - faceIndex); - return ret; -#endif -} - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontEngine.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontEngine.h deleted file mode 100644 index 5acb415fda8..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontEngine.h +++ /dev/null @@ -1,75 +0,0 @@ -//======================================================================== -// -// SplashFTFontEngine.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHFTFONTENGINE_H -#define SPLASHFTFONTENGINE_H - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include <ft2build.h> -#include FT_FREETYPE_H -#include "goo/gtypes.h" - -class SplashFontFile; -class SplashFontFileID; -class SplashFontSrc; - -//------------------------------------------------------------------------ -// SplashFTFontEngine -//------------------------------------------------------------------------ - -class SplashFTFontEngine { -public: - - static SplashFTFontEngine *init(GBool aaA, GBool enableFreeTypeHintingA); - - ~SplashFTFontEngine(); - - // Load fonts. - SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src); - SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src); - SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, - Gushort *codeToGID, int codeToGIDLen, int faceIndex = 0); - -private: - - SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, FT_Library libA); - - GBool aa; - GBool enableFreeTypeHinting; - FT_Library lib; - GBool useCIDs; - - friend class SplashFTFontFile; - friend class SplashFTFont; -}; - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontFile.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontFile.cc deleted file mode 100644 index 160481e7a53..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontFile.cc +++ /dev/null @@ -1,139 +0,0 @@ -//======================================================================== -// -// SplashFTFontFile.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "goo/gmem.h" -#include "goo/GooString.h" -#include "SplashFTFontEngine.h" -#include "SplashFTFont.h" -#include "SplashFTFontFile.h" - -//------------------------------------------------------------------------ -// SplashFTFontFile -//------------------------------------------------------------------------ - -SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - char **encA) { - FT_Face faceA; - Gushort *codeToGIDA; - char *name; - int i; - - if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA)) - return NULL; - } else { - if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA)) - return NULL; - } - codeToGIDA = (Gushort *)gmallocn(256, sizeof(int)); - for (i = 0; i < 256; ++i) { - codeToGIDA[i] = 0; - if ((name = encA[i])) { - codeToGIDA[i] = (Gushort)FT_Get_Name_Index(faceA, name); - } - } - - return new SplashFTFontFile(engineA, idA, src, - faceA, codeToGIDA, 256, gFalse); -} - -SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - Gushort *codeToGIDA, - int codeToGIDLenA) { - FT_Face faceA; - - if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA)) - return NULL; - } else { - if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA)) - return NULL; - } - - return new SplashFTFontFile(engineA, idA, src, - faceA, codeToGIDA, codeToGIDLenA, gFalse); -} - -SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - Gushort *codeToGIDA, - int codeToGIDLenA, - int faceIndexA) { - FT_Face faceA; - - if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->getCString(), faceIndexA, &faceA)) - return NULL; - } else { - if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, faceIndexA, &faceA)) - return NULL; - } - - return new SplashFTFontFile(engineA, idA, src, - faceA, codeToGIDA, codeToGIDLenA, gTrue); -} - -SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - FT_Face faceA, - Gushort *codeToGIDA, int codeToGIDLenA, - GBool trueTypeA): - SplashFontFile(idA, src) -{ - engine = engineA; - face = faceA; - codeToGID = codeToGIDA; - codeToGIDLen = codeToGIDLenA; - trueType = trueTypeA; -} - -SplashFTFontFile::~SplashFTFontFile() { - if (face) { - FT_Done_Face(face); - } - if (codeToGID) { - gfree(codeToGID); - } -} - -SplashFont *SplashFTFontFile::makeFont(SplashCoord *mat, - SplashCoord *textMat) { - SplashFont *font; - - font = new SplashFTFont(this, mat, textMat); - font->initCache(); - return font; -} - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontFile.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontFile.h deleted file mode 100644 index 079fb1cb691..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFTFontFile.h +++ /dev/null @@ -1,85 +0,0 @@ -//======================================================================== -// -// SplashFTFontFile.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHFTFONTFILE_H -#define SPLASHFTFONTFILE_H - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include <ft2build.h> -#include FT_FREETYPE_H -#include "SplashFontFile.h" - -class SplashFontFileID; -class SplashFTFontEngine; - -//------------------------------------------------------------------------ -// SplashFTFontFile -//------------------------------------------------------------------------ - -class SplashFTFontFile: public SplashFontFile { -public: - - static SplashFontFile *loadType1Font(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, char **encA); - static SplashFontFile *loadCIDFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - Gushort *codeToCIDA, int codeToGIDLenA); - static SplashFontFile *loadTrueTypeFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - Gushort *codeToGIDA, - int codeToGIDLenA, - int faceIndexA=0); - - virtual ~SplashFTFontFile(); - - // Create a new SplashFTFont, i.e., a scaled instance of this font - // file. - virtual SplashFont *makeFont(SplashCoord *mat, - SplashCoord *textMat); - -private: - - SplashFTFontFile(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - FT_Face faceA, - Gushort *codeToGIDA, int codeToGIDLenA, - GBool trueTypeA); - - SplashFTFontEngine *engine; - FT_Face face; - Gushort *codeToGID; - int codeToGIDLen; - GBool trueType; - - friend class SplashFTFont; -}; - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFont.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFont.cc deleted file mode 100644 index 400d7cc4c08..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFont.cc +++ /dev/null @@ -1,215 +0,0 @@ -//======================================================================== -// -// SplashFont.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <string.h> -#include "goo/gmem.h" -#include "SplashMath.h" -#include "SplashGlyphBitmap.h" -#include "SplashFontFile.h" -#include "SplashFont.h" - -//------------------------------------------------------------------------ - -struct SplashFontCacheTag { - int c; - short xFrac, yFrac; // x and y fractions - int mru; // valid bit (0x80000000) and MRU index - int x, y, w, h; // offset and size of glyph -}; - -//------------------------------------------------------------------------ -// SplashFont -//------------------------------------------------------------------------ - -SplashFont::SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA, GBool aaA) { - fontFile = fontFileA; - fontFile->incRefCnt(); - mat[0] = matA[0]; - mat[1] = matA[1]; - mat[2] = matA[2]; - mat[3] = matA[3]; - textMat[0] = textMatA[0]; - textMat[1] = textMatA[1]; - textMat[2] = textMatA[2]; - textMat[3] = textMatA[3]; - aa = aaA; - - cache = NULL; - cacheTags = NULL; - - xMin = yMin = xMax = yMax = 0; -} - -void SplashFont::initCache() { - int i; - - // this should be (max - min + 1), but we add some padding to - // deal with rounding errors - glyphW = xMax - xMin + 3; - glyphH = yMax - yMin + 3; - if (aa) { - glyphSize = glyphW * glyphH; - } else { - glyphSize = ((glyphW + 7) >> 3) * glyphH; - } - - // set up the glyph pixmap cache - cacheAssoc = 8; - if (glyphSize <= 256) { - cacheSets = 8; - } else if (glyphSize <= 512) { - cacheSets = 4; - } else if (glyphSize <= 1024) { - cacheSets = 2; - } else { - cacheSets = 1; - } - cache = (Guchar *)gmallocn_checkoverflow(cacheSets* cacheAssoc, glyphSize); - if (cache != NULL) { - cacheTags = (SplashFontCacheTag *)gmallocn(cacheSets * cacheAssoc, - sizeof(SplashFontCacheTag)); - for (i = 0; i < cacheSets * cacheAssoc; ++i) { - cacheTags[i].mru = i & (cacheAssoc - 1); - } - } else { - cacheAssoc = 0; - } -} - -SplashFont::~SplashFont() { - fontFile->decRefCnt(); - if (cache) { - gfree(cache); - } - if (cacheTags) { - gfree(cacheTags); - } -} - -GBool SplashFont::getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { - SplashGlyphBitmap bitmap2; - int size; - Guchar *p; - int i, j, k; - - // no fractional coordinates for large glyphs or non-anti-aliased - // glyphs - if (!aa || glyphH > 50) { - xFrac = yFrac = 0; - } - - // check the cache - i = (c & (cacheSets - 1)) * cacheAssoc; - for (j = 0; j < cacheAssoc; ++j) { - if ((cacheTags[i+j].mru & 0x80000000) && - cacheTags[i+j].c == c && - (int)cacheTags[i+j].xFrac == xFrac && - (int)cacheTags[i+j].yFrac == yFrac) { - bitmap->x = cacheTags[i+j].x; - bitmap->y = cacheTags[i+j].y; - bitmap->w = cacheTags[i+j].w; - bitmap->h = cacheTags[i+j].h; - for (k = 0; k < cacheAssoc; ++k) { - if (k != j && - (cacheTags[i+k].mru & 0x7fffffff) < - (cacheTags[i+j].mru & 0x7fffffff)) { - ++cacheTags[i+k].mru; - } - } - cacheTags[i+j].mru = 0x80000000; - bitmap->aa = aa; - bitmap->data = cache + (i+j) * glyphSize; - bitmap->freeData = gFalse; - - *clipRes = clip->testRect(x0 - bitmap->x, - y0 - bitmap->y, - x0 - bitmap->x + bitmap->w - 1, - y0 - bitmap->y + bitmap->h - 1); - - return gTrue; - } - } - - // generate the glyph bitmap - if (!makeGlyph(c, xFrac, yFrac, &bitmap2, x0, y0, clip, clipRes)) { - return gFalse; - } - - if (*clipRes == splashClipAllOutside) - { - bitmap->freeData = gFalse; - if (bitmap2.freeData) gfree(bitmap2.data); - return gTrue; - } - - // if the glyph doesn't fit in the bounding box, return a temporary - // uncached bitmap - if (bitmap2.w > glyphW || bitmap2.h > glyphH) { - *bitmap = bitmap2; - return gTrue; - } - - // insert glyph pixmap in cache - if (aa) { - size = bitmap2.w * bitmap2.h; - } else { - size = ((bitmap2.w + 7) >> 3) * bitmap2.h; - } - p = NULL; // make gcc happy - if (cacheAssoc == 0) - { - // we had problems on the malloc of the cache, so ignore it - *bitmap = bitmap2; - } - else - { - for (j = 0; j < cacheAssoc; ++j) { - if ((cacheTags[i+j].mru & 0x7fffffff) == cacheAssoc - 1) { - cacheTags[i+j].mru = 0x80000000; - cacheTags[i+j].c = c; - cacheTags[i+j].xFrac = (short)xFrac; - cacheTags[i+j].yFrac = (short)yFrac; - cacheTags[i+j].x = bitmap2.x; - cacheTags[i+j].y = bitmap2.y; - cacheTags[i+j].w = bitmap2.w; - cacheTags[i+j].h = bitmap2.h; - p = cache + (i+j) * glyphSize; - memcpy(p, bitmap2.data, size); - } else { - ++cacheTags[i+j].mru; - } - } - *bitmap = bitmap2; - bitmap->data = p; - bitmap->freeData = gFalse; - if (bitmap2.freeData) { - gfree(bitmap2.data); - } - } - return gTrue; -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFont.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFont.h deleted file mode 100644 index 78b00d2dcaf..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFont.h +++ /dev/null @@ -1,121 +0,0 @@ -//======================================================================== -// -// SplashFont.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHFONT_H -#define SPLASHFONT_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "goo/gtypes.h" -#include "SplashTypes.h" -#include "SplashClip.h" - -struct SplashGlyphBitmap; -struct SplashFontCacheTag; -class SplashFontFile; -class SplashPath; - -//------------------------------------------------------------------------ - -// Fractional positioning uses this many bits to the right of the -// decimal points. -#define splashFontFractionBits 2 -#define splashFontFraction (1 << splashFontFractionBits) -#define splashFontFractionMul \ - ((SplashCoord)1 / (SplashCoord)splashFontFraction) - -//------------------------------------------------------------------------ -// SplashFont -//------------------------------------------------------------------------ - -class SplashFont { -public: - - SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA, GBool aaA); - - // This must be called after the constructor, so that the subclass - // constructor has a chance to compute the bbox. - void initCache(); - - virtual ~SplashFont(); - - SplashFontFile *getFontFile() { return fontFile; } - - // Return true if <this> matches the specified font file and matrix. - GBool matches(SplashFontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA) { - return fontFileA == fontFile && - matA[0] == mat[0] && matA[1] == mat[1] && - matA[2] == mat[2] && matA[3] == mat[3] && - textMatA[0] == textMat[0] && textMatA[1] == textMat[1] && - textMatA[2] == textMat[2] && textMatA[3] == textMat[3]; - } - - // Get a glyph - this does a cache lookup first, and if not found, - // creates a new bitmap and adds it to the cache. The <xFrac> and - // <yFrac> values are splashFontFractionBits bits each, representing - // the numerators of fractions in [0, 1), where the denominator is - // splashFontFraction = 1 << splashFontFractionBits. Subclasses - // should override this to zero out xFrac and/or yFrac if they don't - // support fractional coordinates. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); - - // Rasterize a glyph. The <xFrac> and <yFrac> values are the same - // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) = 0; - - // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c) = 0; - - // Return the advance of a glyph. (in 0..1 range) - // < 0 means not known - virtual double getGlyphAdvance(int c) { return -1; } - - // Return the font transform matrix. - SplashCoord *getMatrix() { return mat; } - - // Return the glyph bounding box. - void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) - { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } - -protected: - - SplashFontFile *fontFile; - SplashCoord mat[4]; // font transform matrix - // (text space -> device space) - SplashCoord textMat[4]; // text transform matrix - // (text space -> user space) - GBool aa; // anti-aliasing - int xMin, yMin, xMax, yMax; // glyph bounding box - Guchar *cache; // glyph bitmap cache - SplashFontCacheTag * // cache tags - cacheTags; - int glyphW, glyphH; // size of glyph bitmaps - int glyphSize; // size of glyph bitmaps, in bytes - int cacheSets; // number of sets in cache - int cacheAssoc; // cache associativity (glyphs per set) -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontEngine.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontEngine.cc deleted file mode 100644 index 3c96bfbf1d5..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontEngine.cc +++ /dev/null @@ -1,327 +0,0 @@ -//======================================================================== -// -// SplashFontEngine.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#if HAVE_T1LIB_H -#include <t1lib.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#include "goo/gmem.h" -#include "goo/GooString.h" -#include "SplashMath.h" -#include "SplashT1FontEngine.h" -#include "SplashFTFontEngine.h" -#include "SplashFontFile.h" -#include "SplashFontFileID.h" -#include "SplashFont.h" -#include "SplashFontEngine.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ -// SplashFontEngine -//------------------------------------------------------------------------ - -SplashFontEngine::SplashFontEngine( -#if HAVE_T1LIB_H - GBool enableT1lib, -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - GBool enableFreeType, - GBool enableFreeTypeHinting, -#endif - GBool aa) { - int i; - - for (i = 0; i < splashFontCacheSize; ++i) { - fontCache[i] = NULL; - } - -#if HAVE_T1LIB_H - if (enableT1lib) { - t1Engine = SplashT1FontEngine::init(aa); - } else { - t1Engine = NULL; - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (enableFreeType) { - ftEngine = SplashFTFontEngine::init(aa, enableFreeTypeHinting); - } else { - ftEngine = NULL; - } -#endif -} - -SplashFontEngine::~SplashFontEngine() { - int i; - - for (i = 0; i < splashFontCacheSize; ++i) { - if (fontCache[i]) { - delete fontCache[i]; - } - } - -#if HAVE_T1LIB_H - if (t1Engine) { - delete t1Engine; - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (ftEngine) { - delete ftEngine; - } -#endif -} - -SplashFontFile *SplashFontEngine::getFontFile(SplashFontFileID *id) { - SplashFontFile *fontFile; - int i; - - for (i = 0; i < splashFontCacheSize; ++i) { - if (fontCache[i]) { - fontFile = fontCache[i]->getFontFile(); - if (fontFile && fontFile->getID()->matches(id)) { - return fontFile; - } - } - } - return NULL; -} - -SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_T1LIB_H - if (!fontFile && t1Engine) { - fontFile = t1Engine->loadType1Font(idA, src, enc); - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadType1Font(idA, src, enc); - } -#endif - -#ifndef _WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (src->isFile) - src->unref(); -#endif - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadType1CFont(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_T1LIB_H - if (!fontFile && t1Engine) { - fontFile = t1Engine->loadType1CFont(idA, src, enc); - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadType1CFont(idA, src, enc); - } -#endif - -#ifndef _WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (src->isFile) - src->unref(); -#endif - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadOpenTypeT1CFont(idA, src, enc); - } -#endif - - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (src->isFile) - src->unref(); - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadCIDFont(SplashFontFileID *idA, - SplashFontSrc *src) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadCIDFont(idA, src); - } -#endif - -#ifndef _WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (src->isFile) - src->unref(); -#endif - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, - SplashFontSrc *src) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadOpenTypeCFFFont(idA, src); - } -#endif - - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (src->isFile) - src->unref(); - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA, - SplashFontSrc *src, - Gushort *codeToGID, - int codeToGIDLen, - int faceIndex) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadTrueTypeFont(idA, src, - codeToGID, codeToGIDLen, faceIndex); - } -#endif - - if (!fontFile) { - gfree(codeToGID); - } - -#ifndef _WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (src->isFile) - src->unref(); -#endif - - return fontFile; -} - -SplashFont *SplashFontEngine::getFont(SplashFontFile *fontFile, - SplashCoord *textMat, - SplashCoord *ctm) { - SplashCoord mat[4]; - SplashFont *font; - int i, j; - - mat[0] = textMat[0] * ctm[0] + textMat[1] * ctm[2]; - mat[1] = -(textMat[0] * ctm[1] + textMat[1] * ctm[3]); - mat[2] = textMat[2] * ctm[0] + textMat[3] * ctm[2]; - mat[3] = -(textMat[2] * ctm[1] + textMat[3] * ctm[3]); - if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.01) { - // avoid a singular (or close-to-singular) matrix - mat[0] = 0.01; mat[1] = 0; - mat[2] = 0; mat[3] = 0.01; - } - - font = fontCache[0]; - if (font && font->matches(fontFile, mat, textMat)) { - return font; - } - for (i = 1; i < splashFontCacheSize; ++i) { - font = fontCache[i]; - if (font && font->matches(fontFile, mat, textMat)) { - for (j = i; j > 0; --j) { - fontCache[j] = fontCache[j-1]; - } - fontCache[0] = font; - return font; - } - } - font = fontFile->makeFont(mat, textMat); - if (fontCache[splashFontCacheSize - 1]) { - delete fontCache[splashFontCacheSize - 1]; - } - for (j = splashFontCacheSize - 1; j > 0; --j) { - fontCache[j] = fontCache[j-1]; - } - fontCache[0] = font; - return font; -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontEngine.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontEngine.h deleted file mode 100644 index a9d51f0673d..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontEngine.h +++ /dev/null @@ -1,101 +0,0 @@ -//======================================================================== -// -// SplashFontEngine.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHFONTENGINE_H -#define SPLASHFONTENGINE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "goo/gtypes.h" - -class SplashT1FontEngine; -class SplashFTFontEngine; -class SplashDTFontEngine; -class SplashDT4FontEngine; -class SplashFontFile; -class SplashFontFileID; -class SplashFont; -class SplashFontSrc; - -//------------------------------------------------------------------------ - -#define splashFontCacheSize 16 - -//------------------------------------------------------------------------ -// SplashFontEngine -//------------------------------------------------------------------------ - -class SplashFontEngine { -public: - - // Create a font engine. - SplashFontEngine( -#if HAVE_T1LIB_H - GBool enableT1lib, -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - GBool enableFreeType, - GBool enableFreeTypeHinting, -#endif - GBool aa); - - ~SplashFontEngine(); - - // Get a font file from the cache. Returns NULL if there is no - // matching entry in the cache. - SplashFontFile *getFontFile(SplashFontFileID *id); - - // Load fonts - these create new SplashFontFile objects. - SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src); - SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src); - SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, - Gushort *codeToGID, int codeToGIDLen, int faceIndex = 0); - - // Get a font - this does a cache lookup first, and if not found, - // creates a new SplashFont object and adds it to the cache. The - // matrix, mat = textMat * ctm: - // [ mat[0] mat[1] ] - // [ mat[2] mat[3] ] - // specifies the font transform in PostScript style: - // [x' y'] = [x y] * mat - // Note that the Splash y axis points downward. - SplashFont *getFont(SplashFontFile *fontFile, - SplashCoord *textMat, SplashCoord *ctm); - -private: - - SplashFont *fontCache[splashFontCacheSize]; - -#if HAVE_T1LIB_H - SplashT1FontEngine *t1Engine; -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - SplashFTFontEngine *ftEngine; -#endif -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFile.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFile.cc deleted file mode 100644 index 68e8608b6a7..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFile.cc +++ /dev/null @@ -1,124 +0,0 @@ -//======================================================================== -// -// SplashFontFile.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdio.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include "goo/gmem.h" -#include "goo/GooString.h" -#include "SplashFontFile.h" -#include "SplashFontFileID.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ -// SplashFontFile -//------------------------------------------------------------------------ - -SplashFontFile::SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA) { - id = idA; - src = srcA; - src->ref(); - refCnt = 0; - doAdjustMatrix = gFalse; -} - -SplashFontFile::~SplashFontFile() { - src->unref(); - delete id; -} - -void SplashFontFile::incRefCnt() { - ++refCnt; -} - -void SplashFontFile::decRefCnt() { - if (!--refCnt) { - delete this; - } -} - -// - -SplashFontSrc::SplashFontSrc() { - isFile = gFalse; - deleteSrc = gFalse; - fileName = NULL; - buf = NULL; - refcnt = 1; -} - -SplashFontSrc::~SplashFontSrc() { - if (deleteSrc) { - if (isFile) { - if (fileName) - unlink(fileName->getCString()); - } else { - if (buf) - gfree(buf); - } - } - - if (isFile && fileName) - delete fileName; -} - -void SplashFontSrc::ref() { - refcnt++; -} - -void SplashFontSrc::unref() { - if (! --refcnt) - delete this; -} - -void SplashFontSrc::setFile(GooString *file, GBool del) -{ - isFile = gTrue; - fileName = file->copy(); - deleteSrc = del; -} - -void SplashFontSrc::setFile(const char *file, GBool del) -{ - isFile = gTrue; - fileName = new GooString(file); - deleteSrc = del; -} - -void SplashFontSrc::setBuf(char *bufA, int bufLenA, GBool del) -{ - isFile = gFalse; - buf = bufA; - bufLen = bufLenA; - deleteSrc = del; -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFile.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFile.h deleted file mode 100644 index f2b457099df..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFile.h +++ /dev/null @@ -1,93 +0,0 @@ -//======================================================================== -// -// SplashFontFile.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHFONTFILE_H -#define SPLASHFONTFILE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "goo/gtypes.h" -#include "SplashTypes.h" - -class GooString; -class SplashFontEngine; -class SplashFont; -class SplashFontFileID; - -//------------------------------------------------------------------------ -// SplashFontFile -//------------------------------------------------------------------------ - -class SplashFontSrc { -public: - SplashFontSrc(); - ~SplashFontSrc(); - - void setFile(GooString *file, GBool del); - void setFile(const char *file, GBool del); - void setBuf(char *bufA, int buflenA, GBool del); - - void ref(); - void unref(); - - GBool isFile; - GooString *fileName; - char *buf; - int bufLen; - GBool deleteSrc; - int refcnt; -}; - -class SplashFontFile { -public: - - virtual ~SplashFontFile(); - - // Create a new SplashFont, i.e., a scaled instance of this font - // file. - virtual SplashFont *makeFont(SplashCoord *mat, SplashCoord *textMat) = 0; - - // Get the font file ID. - SplashFontFileID *getID() { return id; } - - // Increment the reference count. - void incRefCnt(); - - // Decrement the reference count. If the new value is zero, delete - // the SplashFontFile object. - void decRefCnt(); - - GBool doAdjustMatrix; - -protected: - - SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA); - - SplashFontFileID *id; - SplashFontSrc *src; - int refCnt; - - friend class SplashFontEngine; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFileID.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFileID.cc deleted file mode 100644 index a66dabf61e3..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFileID.cc +++ /dev/null @@ -1,23 +0,0 @@ -//======================================================================== -// -// SplashFontFileID.cc -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "SplashFontFileID.h" - -//------------------------------------------------------------------------ -// SplashFontFileID -//------------------------------------------------------------------------ - -SplashFontFileID::SplashFontFileID() { -} - -SplashFontFileID::~SplashFontFileID() { -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFileID.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFileID.h deleted file mode 100644 index cfd89ebb56a..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashFontFileID.h +++ /dev/null @@ -1,28 +0,0 @@ -//======================================================================== -// -// SplashFontFileID.h -// -//======================================================================== - -#ifndef SPLASHFONTFILEID_H -#define SPLASHFONTFILEID_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "goo/gtypes.h" - -//------------------------------------------------------------------------ -// SplashFontFileID -//------------------------------------------------------------------------ - -class SplashFontFileID { -public: - - SplashFontFileID(); - virtual ~SplashFontFileID(); - virtual GBool matches(SplashFontFileID *id) = 0; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashGlyphBitmap.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashGlyphBitmap.h deleted file mode 100644 index c062c106e6a..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashGlyphBitmap.h +++ /dev/null @@ -1,24 +0,0 @@ -//======================================================================== -// -// SplashGlyphBitmap.h -// -//======================================================================== - -#ifndef SPLASHGLYPHBITMAP_H -#define SPLASHGLYPHBITMAP_H - -#include "goo/gtypes.h" - -//------------------------------------------------------------------------ -// SplashGlyphBitmap -//------------------------------------------------------------------------ - -struct SplashGlyphBitmap { - int x, y, w, h; // offset and size of glyph - GBool aa; // anti-aliased: true means 8-bit alpha - // bitmap; false means 1-bit - Guchar *data; // bitmap data - GBool freeData; // true if data memory should be freed -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashMath.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashMath.h deleted file mode 100644 index 7a8c8e31d1f..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashMath.h +++ /dev/null @@ -1,88 +0,0 @@ -//======================================================================== -// -// SplashMath.h -// -//======================================================================== - -#ifndef SPLASHMATH_H -#define SPLASHMATH_H - -#if USE_FIXEDPOINT -#include "goo/FixedPoint.h" -#else -#include <math.h> -#endif -#include "SplashTypes.h" - -static inline SplashCoord splashAbs(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::abs(x); -#else - return fabs(x); -#endif -} - -static inline int splashFloor(SplashCoord x) { - #if USE_FIXEDPOINT - return FixedPoint::floor(x); - #else - return (int)floor(x); - #endif -} - -static inline int splashCeil(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::ceil(x); -#else - return (int)ceil(x); -#endif -} - -static inline int splashRound(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::round(x); -#else - return (int)floor(x + 0.5); -#endif -} - -static inline SplashCoord splashSqrt(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::sqrt(x); -#else - return sqrt(x); -#endif -} - -static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) { -#if USE_FIXEDPOINT - return FixedPoint::pow(x, y); -#else - return pow(x, y); -#endif -} - -static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - SplashCoord dx, dy; - dx = x1 - x0; - dy = y1 - y0; -#if USE_FIXEDPOINT - // this handles the situation where dx*dx or dy*dy is too large to - // fit in the 16.16 fixed point format - SplashCoord dxa, dya; - dxa = splashAbs(dx); - dya = splashAbs(dy); - if (dxa == 0 && dya == 0) { - return 0; - } else if (dxa > dya) { - return dxa * FixedPoint::sqrt(dya / dxa + 1); - } else { - return dya * FixedPoint::sqrt(dxa / dya + 1); - } -#else - return sqrt(dx * dx + dy * dy); -#endif -} - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPath.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPath.cc deleted file mode 100644 index 261f77883cd..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPath.cc +++ /dev/null @@ -1,184 +0,0 @@ -//======================================================================== -// -// SplashPath.cc -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <string.h> -#include "goo/gmem.h" -#include "SplashErrorCodes.h" -#include "SplashPath.h" - -//------------------------------------------------------------------------ -// SplashPath -//------------------------------------------------------------------------ - -// A path can be in three possible states: -// -// 1. no current point -- zero or more finished subpaths -// [curSubpath == length] -// -// 2. one point in subpath -// [curSubpath == length - 1] -// -// 3. open subpath with two or more points -// [curSubpath < length - 1] - -SplashPath::SplashPath() { - pts = NULL; - flags = NULL; - length = size = 0; - curSubpath = 0; - hints = NULL; - hintsLength = hintsSize = 0; -} - -SplashPath::SplashPath(SplashPath *path) { - length = path->length; - size = path->size; - pts = (SplashPathPoint *)gmallocn(size, sizeof(SplashPathPoint)); - flags = (Guchar *)gmallocn(size, sizeof(Guchar)); - memcpy(pts, path->pts, length * sizeof(SplashPathPoint)); - memcpy(flags, path->flags, length * sizeof(Guchar)); - curSubpath = path->curSubpath; - if (path->hints) { - hintsLength = hintsSize = path->hintsLength; - hints = (SplashPathHint *)gmallocn(hintsSize, sizeof(SplashPathHint)); - memcpy(hints, path->hints, hintsLength * sizeof(SplashPathHint)); - } else { - hints = NULL; - } -} - -SplashPath::~SplashPath() { - gfree(pts); - gfree(flags); - gfree(hints); -} - -// Add space for <nPts> more points. -void SplashPath::grow(int nPts) { - if (length + nPts > size) { - if (size == 0) { - size = 32; - } - while (size < length + nPts) { - size *= 2; - } - pts = (SplashPathPoint *)greallocn(pts, size, sizeof(SplashPathPoint)); - flags = (Guchar *)greallocn(flags, size, sizeof(Guchar)); - } -} - -void SplashPath::append(SplashPath *path) { - int i; - - curSubpath = length + path->curSubpath; - grow(path->length); - for (i = 0; i < path->length; ++i) { - pts[length] = path->pts[i]; - flags[length] = path->flags[i]; - ++length; - } -} - -SplashError SplashPath::moveTo(SplashCoord x, SplashCoord y) { - if (onePointSubpath()) { - return splashErrBogusPath; - } - grow(1); - pts[length].x = x; - pts[length].y = y; - flags[length] = splashPathFirst | splashPathLast; - curSubpath = length++; - return splashOk; -} - -SplashError SplashPath::lineTo(SplashCoord x, SplashCoord y) { - if (noCurrentPoint()) { - return splashErrNoCurPt; - } - flags[length-1] &= ~splashPathLast; - grow(1); - pts[length].x = x; - pts[length].y = y; - flags[length] = splashPathLast; - ++length; - return splashOk; -} - -SplashError SplashPath::curveTo(SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3) { - if (noCurrentPoint()) { - return splashErrNoCurPt; - } - flags[length-1] &= ~splashPathLast; - grow(3); - pts[length].x = x1; - pts[length].y = y1; - flags[length] = splashPathCurve; - ++length; - pts[length].x = x2; - pts[length].y = y2; - flags[length] = splashPathCurve; - ++length; - pts[length].x = x3; - pts[length].y = y3; - flags[length] = splashPathLast; - ++length; - return splashOk; -} - -SplashError SplashPath::close() { - if (noCurrentPoint()) { - return splashErrNoCurPt; - } - if (curSubpath == length - 1 || - pts[length - 1].x != pts[curSubpath].x || - pts[length - 1].y != pts[curSubpath].y) { - lineTo(pts[curSubpath].x, pts[curSubpath].y); - } - flags[curSubpath] |= splashPathClosed; - flags[length - 1] |= splashPathClosed; - curSubpath = length; - return splashOk; -} - -void SplashPath::addStrokeAdjustHint(int ctrl0, int ctrl1, - int firstPt, int lastPt) { - if (hintsLength == hintsSize) { - hintsSize = hintsLength ? 2 * hintsLength : 8; - hints = (SplashPathHint *)greallocn(hints, hintsSize, - sizeof(SplashPathHint)); - } - hints[hintsLength].ctrl0 = ctrl0; - hints[hintsLength].ctrl1 = ctrl1; - hints[hintsLength].firstPt = firstPt; - hints[hintsLength].lastPt = lastPt; - ++hintsLength; -} - -void SplashPath::offset(SplashCoord dx, SplashCoord dy) { - int i; - - for (i = 0; i < length; ++i) { - pts[i].x += dx; - pts[i].y += dy; - } -} - -GBool SplashPath::getCurPt(SplashCoord *x, SplashCoord *y) { - if (noCurrentPoint()) { - return gFalse; - } - *x = pts[length - 1].x; - *y = pts[length - 1].y; - return gTrue; -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPath.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPath.h deleted file mode 100644 index 991e11438f3..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPath.h +++ /dev/null @@ -1,121 +0,0 @@ -//======================================================================== -// -// SplashPath.h -// -//======================================================================== - -#ifndef SPLASHPATH_H -#define SPLASHPATH_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -//------------------------------------------------------------------------ -// SplashPathPoint -//------------------------------------------------------------------------ - -struct SplashPathPoint { - SplashCoord x, y; -}; - -//------------------------------------------------------------------------ -// SplashPath.flags -//------------------------------------------------------------------------ - -// first point on each subpath sets this flag -#define splashPathFirst 0x01 - -// last point on each subpath sets this flag -#define splashPathLast 0x02 - -// if the subpath is closed, its first and last points must be -// identical, and must set this flag -#define splashPathClosed 0x04 - -// curve control points set this flag -#define splashPathCurve 0x08 - -//------------------------------------------------------------------------ -// SplashPathHint -//------------------------------------------------------------------------ - -struct SplashPathHint { - int ctrl0, ctrl1; - int firstPt, lastPt; -}; - -//------------------------------------------------------------------------ -// SplashPath -//------------------------------------------------------------------------ - -class SplashPath { -public: - - // Create an empty path. - SplashPath(); - - // Copy a path. - SplashPath *copy() { return new SplashPath(this); } - - ~SplashPath(); - - // Append <path> to <this>. - void append(SplashPath *path); - - // Start a new subpath. - SplashError moveTo(SplashCoord x, SplashCoord y); - - // Add a line segment to the last subpath. - SplashError lineTo(SplashCoord x, SplashCoord y); - - // Add a third-order (cubic) Bezier curve segment to the last - // subpath. - SplashError curveTo(SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3); - - // Close the last subpath, adding a line segment if necessary. - SplashError close(); - - // Add a stroke adjustment hint. The controlling segments are - // <ctrl0> and <ctrl1> (where segments are identified by their first - // point), and the points to be adjusted are <firstPt> .. <lastPt>. - void addStrokeAdjustHint(int ctrl0, int ctrl1, int firstPt, int lastPt); - - // Add (<dx>, <dy>) to every point on this path. - void offset(SplashCoord dx, SplashCoord dy); - - // Get the points on the path. - int getLength() { return length; } - void getPoint(int i, double *x, double *y, Guchar *f) - { *x = pts[i].x; *y = pts[i].y; *f = flags[i]; } - - // Get the current point. - GBool getCurPt(SplashCoord *x, SplashCoord *y); - -protected: - - SplashPath(SplashPath *path); - void grow(int nPts); - GBool noCurrentPoint() { return curSubpath == length; } - GBool onePointSubpath() { return curSubpath == length - 1; } - GBool openSubpath() { return curSubpath < length - 1; } - - SplashPathPoint *pts; // array of points - Guchar *flags; // array of flags - int length, size; // length/size of the pts and flags arrays - int curSubpath; // index of first point in last subpath - - SplashPathHint *hints; // list of hints - int hintsLength, hintsSize; - - friend class SplashXPath; - friend class Splash; - // this is a temporary hack, until we read FreeType paths directly - friend class ArthurOutputDev; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPattern.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPattern.cc deleted file mode 100644 index ce490785556..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPattern.cc +++ /dev/null @@ -1,40 +0,0 @@ -//======================================================================== -// -// SplashPattern.cc -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "SplashMath.h" -#include "SplashScreen.h" -#include "SplashPattern.h" - -//------------------------------------------------------------------------ -// SplashPattern -//------------------------------------------------------------------------ - -SplashPattern::SplashPattern() { -} - -SplashPattern::~SplashPattern() { -} - -//------------------------------------------------------------------------ -// SplashSolidColor -//------------------------------------------------------------------------ - -SplashSolidColor::SplashSolidColor(SplashColorPtr colorA) { - splashColorCopy(color, colorA); -} - -SplashSolidColor::~SplashSolidColor() { -} - -void SplashSolidColor::getColor(int x, int y, SplashColorPtr c) { - splashColorCopy(c, color); -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPattern.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPattern.h deleted file mode 100644 index 4e3d9abbfc4..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashPattern.h +++ /dev/null @@ -1,63 +0,0 @@ -//======================================================================== -// -// SplashPattern.h -// -//======================================================================== - -#ifndef SPLASHPATTERN_H -#define SPLASHPATTERN_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashScreen; - -//------------------------------------------------------------------------ -// SplashPattern -//------------------------------------------------------------------------ - -class SplashPattern { -public: - - SplashPattern(); - - virtual SplashPattern *copy() = 0; - - virtual ~SplashPattern(); - - // Return the color value for a specific pixel. - virtual void getColor(int x, int y, SplashColorPtr c) = 0; - - // Returns true if this pattern object will return the same color - // value for all pixels. - virtual GBool isStatic() = 0; - -private: -}; - -//------------------------------------------------------------------------ -// SplashSolidColor -//------------------------------------------------------------------------ - -class SplashSolidColor: public SplashPattern { -public: - - SplashSolidColor(SplashColorPtr colorA); - - virtual SplashPattern *copy() { return new SplashSolidColor(color); } - - virtual ~SplashSolidColor(); - - virtual void getColor(int x, int y, SplashColorPtr c); - - virtual GBool isStatic() { return gTrue; } - -private: - - SplashColor color; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashScreen.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashScreen.cc deleted file mode 100644 index f6be968fb49..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashScreen.cc +++ /dev/null @@ -1,383 +0,0 @@ -//======================================================================== -// -// SplashScreen.cc -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <string.h> -#include "goo/gmem.h" -#include "SplashMath.h" -#include "SplashScreen.h" - -static SplashScreenParams defaultParams = { - splashScreenDispersed, // type - 2, // size - 2, // dotRadius - 1.0, // gamma - 0.0, // blackThreshold - 1.0 // whiteThreshold -}; - -//------------------------------------------------------------------------ - -struct SplashScreenPoint { - int x, y; - int dist; -}; - -static int cmpDistances(const void *p0, const void *p1) { - return ((SplashScreenPoint *)p0)->dist - ((SplashScreenPoint *)p1)->dist; -} - -//------------------------------------------------------------------------ -// SplashScreen -//------------------------------------------------------------------------ - -// If <clustered> is true, this generates a 45 degree screen using a -// circular dot spot function. DPI = resolution / ((size / 2) * -// sqrt(2)). If <clustered> is false, this generates an optimal -// threshold matrix using recursive tesselation. Gamma correction -// (gamma = 1 / 1.33) is also computed here. -SplashScreen::SplashScreen(SplashScreenParams *params) { - Guchar u, black, white; - int i; - - if (!params) { - params = &defaultParams; - } - - switch (params->type) { - - case splashScreenDispersed: - // size must be a power of 2 - for (size = 1; size < params->size; size <<= 1) ; - mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); - buildDispersedMatrix(size/2, size/2, 1, size/2, 1); - break; - - case splashScreenClustered: - // size must be even - size = (params->size >> 1) << 1; - if (size < 2) { - size = 2; - } - mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); - buildClusteredMatrix(); - break; - - case splashScreenStochasticClustered: - // size must be at least 2*r - if (params->size < 2 * params->dotRadius) { - size = 2 * params->dotRadius; - } else { - size = params->size; - } - mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); - buildSCDMatrix(params->dotRadius); - break; - } - - // do gamma correction and compute minVal/maxVal - minVal = 255; - maxVal = 0; - black = splashRound((SplashCoord)255.0 * params->blackThreshold); - if (black < 1) { - black = 1; - } - int whiteAux = splashRound((SplashCoord)255.0 * params->whiteThreshold); - if (whiteAux > 255) { - white = 255; - } else { - white = whiteAux; - } - for (i = 0; i < size * size; ++i) { - u = splashRound((SplashCoord)255.0 * - splashPow((SplashCoord)mat[i] / 255.0, params->gamma)); - if (u < black) { - u = black; - } else if (u >= white) { - u = white; - } - mat[i] = u; - if (u < minVal) { - minVal = u; - } else if (u > maxVal) { - maxVal = u; - } - } -} - -void SplashScreen::buildDispersedMatrix(int i, int j, int val, - int delta, int offset) { - if (delta == 0) { - // map values in [1, size^2] --> [1, 255] - mat[i * size + j] = 1 + (254 * (val - 1)) / (size * size - 1); - } else { - buildDispersedMatrix(i, j, - val, delta / 2, 4*offset); - buildDispersedMatrix((i + delta) % size, (j + delta) % size, - val + offset, delta / 2, 4*offset); - buildDispersedMatrix((i + delta) % size, j, - val + 2*offset, delta / 2, 4*offset); - buildDispersedMatrix((i + 2*delta) % size, (j + delta) % size, - val + 3*offset, delta / 2, 4*offset); - } -} - -void SplashScreen::buildClusteredMatrix() { - SplashCoord *dist; - SplashCoord u, v, d; - Guchar val; - int size2, x, y, x1, y1, i; - - size2 = size >> 1; - - // initialize the threshold matrix - for (y = 0; y < size; ++y) { - for (x = 0; x < size; ++x) { - mat[y * size + x] = 0; - } - } - - // build the distance matrix - dist = (SplashCoord *)gmallocn(size * size2, sizeof(SplashCoord)); - for (y = 0; y < size2; ++y) { - for (x = 0; x < size2; ++x) { - if (x + y < size2 - 1) { - u = (SplashCoord)x + 0.5 - 0; - v = (SplashCoord)y + 0.5 - 0; - } else { - u = (SplashCoord)x + 0.5 - (SplashCoord)size2; - v = (SplashCoord)y + 0.5 - (SplashCoord)size2; - } - dist[y * size2 + x] = u*u + v*v; - } - } - for (y = 0; y < size2; ++y) { - for (x = 0; x < size2; ++x) { - if (x < y) { - u = (SplashCoord)x + 0.5 - 0; - v = (SplashCoord)y + 0.5 - (SplashCoord)size2; - } else { - u = (SplashCoord)x + 0.5 - (SplashCoord)size2; - v = (SplashCoord)y + 0.5 - 0; - } - dist[(size2 + y) * size2 + x] = u*u + v*v; - } - } - - // build the threshold matrix - minVal = 1; - maxVal = 0; - x1 = y1 = 0; // make gcc happy - for (i = 0; i < size * size2; ++i) { - d = -1; - for (y = 0; y < size; ++y) { - for (x = 0; x < size2; ++x) { - if (mat[y * size + x] == 0 && - dist[y * size2 + x] > d) { - x1 = x; - y1 = y; - d = dist[y1 * size2 + x1]; - } - } - } - // map values in [0, 2*size*size2-1] --> [1, 255] - val = 1 + (254 * (2*i)) / (2*size*size2 - 1); - mat[y1 * size + x1] = val; - val = 1 + (254 * (2*i+1)) / (2*size*size2 - 1); - if (y1 < size2) { - mat[(y1 + size2) * size + x1 + size2] = val; - } else { - mat[(y1 - size2) * size + x1 + size2] = val; - } - } - - gfree(dist); -} - -// Compute the distance between two points on a toroid. -int SplashScreen::distance(int x0, int y0, int x1, int y1) { - int dx0, dx1, dx, dy0, dy1, dy; - - dx0 = abs(x0 - x1); - dx1 = size - dx0; - dx = dx0 < dx1 ? dx0 : dx1; - dy0 = abs(y0 - y1); - dy1 = size - dy0; - dy = dy0 < dy1 ? dy0 : dy1; - return dx * dx + dy * dy; -} - -// Algorithm taken from: -// Victor Ostromoukhov and Roger D. Hersch, "Stochastic Clustered-Dot -// Dithering" in Color Imaging: Device-Independent Color, Color -// Hardcopy, and Graphic Arts IV, SPIE Vol. 3648, pp. 496-505, 1999. -void SplashScreen::buildSCDMatrix(int r) { - SplashScreenPoint *dots, *pts; - int dotsLen, dotsSize; - char *tmpl; - char *grid; - int *region, *dist; - int x, y, xx, yy, x0, x1, y0, y1, i, j, d, iMin, dMin, n; - - //~ this should probably happen somewhere else - srand(123); - - // generate the random space-filling curve - pts = (SplashScreenPoint *)gmallocn(size * size, sizeof(SplashScreenPoint)); - i = 0; - for (y = 0; y < size; ++y) { - for (x = 0; x < size; ++x) { - pts[i].x = x; - pts[i].y = y; - ++i; - } - } - for (i = 0; i < size * size; ++i) { - j = i + (int)((double)(size * size - i) * - (double)rand() / ((double)RAND_MAX + 1.0)); - x = pts[i].x; - y = pts[i].y; - pts[i].x = pts[j].x; - pts[i].y = pts[j].y; - pts[j].x = x; - pts[j].y = y; - } - - // construct the circle template - tmpl = (char *)gmallocn((r+1)*(r+1), sizeof(char)); - for (y = 0; y <= r; ++y) { - for (x = 0; x <= r; ++x) { - tmpl[y*(r+1) + x] = (x * y <= r * r) ? 1 : 0; - } - } - - // mark all grid cells as free - grid = (char *)gmallocn(size * size, sizeof(char)); - for (y = 0; y < size; ++y) { - for (x = 0; x < size; ++x) { - grid[y*size + x] = 0; - } - } - - // walk the space-filling curve, adding dots - dotsLen = 0; - dotsSize = 32; - dots = (SplashScreenPoint *)gmallocn(dotsSize, sizeof(SplashScreenPoint)); - for (i = 0; i < size * size; ++i) { - x = pts[i].x; - y = pts[i].y; - if (!grid[y*size + x]) { - if (dotsLen == dotsSize) { - dotsSize *= 2; - dots = (SplashScreenPoint *)greallocn(dots, dotsSize, - sizeof(SplashScreenPoint)); - } - dots[dotsLen++] = pts[i]; - for (yy = 0; yy <= r; ++yy) { - y0 = (y + yy) % size; - y1 = (y - yy + size) % size; - for (xx = 0; xx <= r; ++xx) { - if (tmpl[yy*(r+1) + xx]) { - x0 = (x + xx) % size; - x1 = (x - xx + size) % size; - grid[y0*size + x0] = 1; - grid[y0*size + x1] = 1; - grid[y1*size + x0] = 1; - grid[y1*size + x1] = 1; - } - } - } - } - } - - gfree(tmpl); - gfree(grid); - - // assign each cell to a dot, compute distance to center of dot - region = (int *)gmallocn(size * size, sizeof(int)); - dist = (int *)gmallocn(size * size, sizeof(int)); - for (y = 0; y < size; ++y) { - for (x = 0; x < size; ++x) { - iMin = 0; - dMin = distance(dots[0].x, dots[0].y, x, y); - for (i = 1; i < dotsLen; ++i) { - d = distance(dots[i].x, dots[i].y, x, y); - if (d < dMin) { - iMin = i; - dMin = d; - } - } - region[y*size + x] = iMin; - dist[y*size + x] = dMin; - } - } - - // compute threshold values - for (i = 0; i < dotsLen; ++i) { - n = 0; - for (y = 0; y < size; ++y) { - for (x = 0; x < size; ++x) { - if (region[y*size + x] == i) { - pts[n].x = x; - pts[n].y = y; - pts[n].dist = distance(dots[i].x, dots[i].y, x, y); - ++n; - } - } - } - qsort(pts, n, sizeof(SplashScreenPoint), &cmpDistances); - for (j = 0; j < n; ++j) { - // map values in [0 .. n-1] --> [255 .. 1] - mat[pts[j].y * size + pts[j].x] = 255 - (254 * j) / (n - 1); - } - } - - gfree(pts); - gfree(region); - gfree(dist); - - gfree(dots); -} - -SplashScreen::SplashScreen(SplashScreen *screen) { - size = screen->size; - mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); - memcpy(mat, screen->mat, size * size * sizeof(Guchar)); - minVal = screen->minVal; - maxVal = screen->maxVal; -} - -SplashScreen::~SplashScreen() { - gfree(mat); -} - -int SplashScreen::test(int x, int y, Guchar value) { - int xx, yy; - - if (value < minVal) { - return 0; - } - if (value >= maxVal) { - return 1; - } - if ((xx = x % size) < 0) { - xx = -xx; - } - if ((yy = y % size) < 0) { - yy = -yy; - } - return value < mat[yy * size + xx] ? 0 : 1; -} - -GBool SplashScreen::isStatic(Guchar value) { - return value < minVal || value >= maxVal; -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashScreen.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashScreen.h deleted file mode 100644 index 92639a561fc..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashScreen.h +++ /dev/null @@ -1,53 +0,0 @@ -//======================================================================== -// -// SplashScreen.h -// -//======================================================================== - -#ifndef SPLASHSCREEN_H -#define SPLASHSCREEN_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -//------------------------------------------------------------------------ -// SplashScreen -//------------------------------------------------------------------------ - -class SplashScreen { -public: - - SplashScreen(SplashScreenParams *params); - SplashScreen(SplashScreen *screen); - ~SplashScreen(); - - SplashScreen *copy() { return new SplashScreen(this); } - - // Return the computed pixel value (0=black, 1=white) for the gray - // level <value> at (<x>, <y>). - int test(int x, int y, Guchar value); - - // Returns true if value is above the white threshold or below the - // black threshold, i.e., if the corresponding halftone will be - // solid white or black. - GBool isStatic(Guchar value); - -private: - void buildDispersedMatrix(int i, int j, int val, - int delta, int offset); - void buildClusteredMatrix(); - int distance(int x0, int y0, int x1, int y1); - void buildSCDMatrix(int r); - - Guchar *mat; // threshold matrix - int size; // size of the threshold matrix - Guchar minVal; // any pixel value below minVal generates - // solid black - Guchar maxVal; // any pixel value above maxVal generates - // solid white -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashState.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashState.cc deleted file mode 100644 index b1fa2f566d6..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashState.cc +++ /dev/null @@ -1,182 +0,0 @@ -//======================================================================== -// -// SplashState.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2009 Thomas Freitag <Thomas.Freitag@alfa.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <string.h> -#include "goo/gmem.h" -#include "SplashPattern.h" -#include "SplashScreen.h" -#include "SplashClip.h" -#include "SplashBitmap.h" -#include "SplashState.h" - -//------------------------------------------------------------------------ -// SplashState -//------------------------------------------------------------------------ - -// number of components in each color mode -int splashColorModeNComps[] = { - 1, 1, 3, 3, 4 -#if SPLASH_CMYK - ,4 -#endif -}; - -SplashState::SplashState(int width, int height, GBool vectorAntialias, - SplashScreenParams *screenParams) { - SplashColor color; - - matrix[0] = 1; matrix[1] = 0; - matrix[2] = 0; matrix[3] = 1; - matrix[4] = 0; matrix[5] = 0; - memset(&color, 0, sizeof(SplashColor)); - strokePattern = new SplashSolidColor(color); - fillPattern = new SplashSolidColor(color); - screen = new SplashScreen(screenParams); - blendFunc = NULL; - strokeAlpha = 1; - fillAlpha = 1; - lineWidth = 0; - lineCap = splashLineCapButt; - lineJoin = splashLineJoinMiter; - miterLimit = 10; - flatness = 1; - lineDash = NULL; - lineDashLength = 0; - lineDashPhase = 0; - strokeAdjust = gFalse; - clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias); - softMask = NULL; - deleteSoftMask = gFalse; - inNonIsolatedGroup = gFalse; - next = NULL; -} - -SplashState::SplashState(int width, int height, GBool vectorAntialias, - SplashScreen *screenA) { - SplashColor color; - - matrix[0] = 1; matrix[1] = 0; - matrix[2] = 0; matrix[3] = 1; - matrix[4] = 0; matrix[5] = 0; - memset(&color, 0, sizeof(SplashColor)); - strokePattern = new SplashSolidColor(color); - fillPattern = new SplashSolidColor(color); - screen = screenA->copy(); - blendFunc = NULL; - strokeAlpha = 1; - fillAlpha = 1; - lineWidth = 0; - lineCap = splashLineCapButt; - lineJoin = splashLineJoinMiter; - miterLimit = 10; - flatness = 1; - lineDash = NULL; - lineDashLength = 0; - lineDashPhase = 0; - strokeAdjust = gFalse; - clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias); - softMask = NULL; - deleteSoftMask = gFalse; - inNonIsolatedGroup = gFalse; - next = NULL; -} - -SplashState::SplashState(SplashState *state) { - memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord)); - strokePattern = state->strokePattern->copy(); - fillPattern = state->fillPattern->copy(); - screen = state->screen->copy(); - blendFunc = state->blendFunc; - strokeAlpha = state->strokeAlpha; - fillAlpha = state->fillAlpha; - lineWidth = state->lineWidth; - lineCap = state->lineCap; - lineJoin = state->lineJoin; - miterLimit = state->miterLimit; - flatness = state->flatness; - if (state->lineDash) { - lineDashLength = state->lineDashLength; - lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord)); - memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord)); - } else { - lineDash = NULL; - lineDashLength = 0; - } - lineDashPhase = state->lineDashPhase; - strokeAdjust = state->strokeAdjust; - clip = state->clip->copy(); - softMask = state->softMask; - deleteSoftMask = gFalse; - inNonIsolatedGroup = state->inNonIsolatedGroup; - next = NULL; -} - -SplashState::~SplashState() { - delete strokePattern; - delete fillPattern; - delete screen; - gfree(lineDash); - delete clip; - if (deleteSoftMask && softMask) { - delete softMask; - } -} - -void SplashState::setStrokePattern(SplashPattern *strokePatternA) { - delete strokePattern; - strokePattern = strokePatternA; -} - -void SplashState::setFillPattern(SplashPattern *fillPatternA) { - delete fillPattern; - fillPattern = fillPatternA; -} - -void SplashState::setScreen(SplashScreen *screenA) { - delete screen; - screen = screenA; -} - -void SplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA, - SplashCoord lineDashPhaseA) { - gfree(lineDash); - lineDashLength = lineDashLengthA; - if (lineDashLength > 0) { - lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord)); - memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord)); - } else { - lineDash = NULL; - } - lineDashPhase = lineDashPhaseA; -} - -void SplashState::setSoftMask(SplashBitmap *softMaskA) { - if (deleteSoftMask) { - delete softMask; - } - softMask = softMaskA; - deleteSoftMask = gTrue; -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashState.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashState.h deleted file mode 100644 index d0e05df3d28..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashState.h +++ /dev/null @@ -1,101 +0,0 @@ -//======================================================================== -// -// SplashState.h -// -//======================================================================== - -#ifndef SPLASHSTATE_H -#define SPLASHSTATE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashPattern; -class SplashScreen; -class SplashClip; -class SplashBitmap; - -//------------------------------------------------------------------------ -// line cap values -//------------------------------------------------------------------------ - -#define splashLineCapButt 0 -#define splashLineCapRound 1 -#define splashLineCapProjecting 2 - -//------------------------------------------------------------------------ -// line join values -//------------------------------------------------------------------------ - -#define splashLineJoinMiter 0 -#define splashLineJoinRound 1 -#define splashLineJoinBevel 2 - -//------------------------------------------------------------------------ -// SplashState -//------------------------------------------------------------------------ - -class SplashState { -public: - - // Create a new state object, initialized with default settings. - SplashState(int width, int height, GBool vectorAntialias, - SplashScreenParams *screenParams); - SplashState(int width, int height, GBool vectorAntialias, - SplashScreen *screenA); - - // Copy a state object. - SplashState *copy() { return new SplashState(this); } - - ~SplashState(); - - // Set the stroke pattern. This does not copy <strokePatternA>. - void setStrokePattern(SplashPattern *strokePatternA); - - // Set the fill pattern. This does not copy <fillPatternA>. - void setFillPattern(SplashPattern *fillPatternA); - - // Set the screen. This does not copy <screenA>. - void setScreen(SplashScreen *screenA); - - // Set the line dash pattern. This copies the <lineDashA> array. - void setLineDash(SplashCoord *lineDashA, int lineDashLengthA, - SplashCoord lineDashPhaseA); - - // Set the soft mask bitmap. - void setSoftMask(SplashBitmap *softMaskA); - -private: - - SplashState(SplashState *state); - - SplashCoord matrix[6]; - SplashPattern *strokePattern; - SplashPattern *fillPattern; - SplashScreen *screen; - SplashBlendFunc blendFunc; - SplashCoord strokeAlpha; - SplashCoord fillAlpha; - SplashCoord lineWidth; - int lineCap; - int lineJoin; - SplashCoord miterLimit; - SplashCoord flatness; - SplashCoord *lineDash; - int lineDashLength; - SplashCoord lineDashPhase; - GBool strokeAdjust; - SplashClip *clip; - SplashBitmap *softMask; - GBool deleteSoftMask; - GBool inNonIsolatedGroup; - - SplashState *next; // used by Splash class - - friend class Splash; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1Font.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1Font.cc deleted file mode 100644 index 536c5605ba9..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1Font.cc +++ /dev/null @@ -1,306 +0,0 @@ -//======================================================================== -// -// SplashT1Font.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <t1lib.h> -#include "goo/gmem.h" -#include "SplashMath.h" -#include "SplashGlyphBitmap.h" -#include "SplashPath.h" -#include "SplashT1FontEngine.h" -#include "SplashT1FontFile.h" -#include "SplashT1Font.h" - -//------------------------------------------------------------------------ - -static Guchar bitReverse[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -//------------------------------------------------------------------------ -// SplashT1Font -//------------------------------------------------------------------------ - -SplashT1Font::SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA): - SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa) -{ - T1_TMATRIX matrix; - BBox bbox; - SplashCoord bbx0, bby0, bbx1, bby1; - int x, y; - - t1libID = T1_CopyFont(fontFileA->t1libID); - outlineID = -1; - - // compute font size - size = (float)splashSqrt(mat[2]*mat[2] + mat[3]*mat[3]); - - // transform the four corners of the font bounding box -- the min - // and max values form the bounding box of the transformed font - bbox = T1_GetFontBBox(t1libID); - bbx0 = 0.001 * bbox.llx; - bby0 = 0.001 * bbox.lly; - bbx1 = 0.001 * bbox.urx; - bby1 = 0.001 * bbox.ury; - // some fonts are completely broken, so we fake it (with values - // large enough that most glyphs should fit) - if (bbx0 == 0 && bby0 == 0 && bbx1 == 0 && bby1 == 0) { - bbx0 = bby0 = -0.5; - bbx1 = bby1 = 1.5; - } - x = (int)(mat[0] * bbx0 + mat[2] * bby0); - xMin = xMax = x; - y = (int)(mat[1] * bbx0 + mat[3] * bby0); - yMin = yMax = y; - x = (int)(mat[0] * bbx0 + mat[2] * bby1); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx0 + mat[3] * bby1); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)(mat[0] * bbx1 + mat[2] * bby0); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx1 + mat[3] * bby0); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)(mat[0] * bbx1 + mat[2] * bby1); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx1 + mat[3] * bby1); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - // This is a kludge: some buggy PDF generators embed fonts with - // zero bounding boxes. - if (xMax == xMin) { - xMin = 0; - xMax = (int)size; - } - if (yMax == yMin) { - yMin = 0; - yMax = (int)(1.2 * size); - } - // Another kludge: an unusually large xMin or yMin coordinate is - // probably wrong. - if (xMin > 0) { - xMin = 0; - } - if (yMin > 0) { - yMin = 0; - } - // Another kludge: t1lib doesn't correctly handle fonts with - // real (non-integer) bounding box coordinates. - if (xMax - xMin > 5000) { - xMin = 0; - xMax = (int)size; - } - if (yMax - yMin > 5000) { - yMin = 0; - yMax = (int)(1.2 * size); - } - - // transform the font - matrix.cxx = (double)mat[0] / size; - matrix.cxy = (double)mat[1] / size; - matrix.cyx = (double)mat[2] / size; - matrix.cyy = (double)mat[3] / size; - T1_TransformFont(t1libID, &matrix); -} - -SplashT1Font::~SplashT1Font() { - T1_DeleteFont(t1libID); - if (outlineID >= 0) { - T1_DeleteFont(outlineID); - } -} - -GBool SplashT1Font::getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { - return SplashFont::getGlyph(c, 0, 0, bitmap, x0, y0, clip, clipRes); -} - -GBool SplashT1Font::makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { - GLYPH *glyph; - int n, i; - - if (aa) { - glyph = T1_AASetChar(t1libID, c, size, NULL); - } else { - glyph = T1_SetChar(t1libID, c, size, NULL); - } - if (!glyph) { - return gFalse; - } - - bitmap->x = -glyph->metrics.leftSideBearing; - bitmap->y = glyph->metrics.ascent; - bitmap->w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; - bitmap->h = glyph->metrics.ascent - glyph->metrics.descent; - bitmap->aa = aa; - if (aa) { - bitmap->data = (Guchar *)glyph->bits; - bitmap->freeData = gFalse; - } else { - n = bitmap->h * ((bitmap->w + 7) >> 3); - bitmap->data = (Guchar *)gmalloc(n); - for (i = 0; i < n; ++i) { - bitmap->data[i] = bitReverse[glyph->bits[i] & 0xff]; - } - bitmap->freeData = gTrue; - } - - *clipRes = clip->testRect(x0 - bitmap->x, - y0 - bitmap->y, - x0 - bitmap->x + bitmap->w - 1, - y0 - bitmap->y + bitmap->h - 1); - - return gTrue; -} - -SplashPath *SplashT1Font::getGlyphPath(int c) { - T1_TMATRIX matrix; - SplashPath *path; - T1_OUTLINE *outline; - T1_PATHSEGMENT *seg; - T1_BEZIERSEGMENT *bez; - SplashCoord x, y, x1, y1; - GBool needClose; - - if (outlineID < 0) { - outlineID = T1_CopyFont(((SplashT1FontFile *)fontFile)->t1libID); - outlineSize = (float)splashSqrt(textMat[2]*textMat[2] + - textMat[3]*textMat[3]); - matrix.cxx = (double)textMat[0] / outlineSize; - matrix.cxy = (double)textMat[1] / outlineSize; - matrix.cyx = (double)textMat[2] / outlineSize; - matrix.cyy = (double)textMat[3] / outlineSize; - // t1lib doesn't seem to handle small sizes correctly here, so set - // the size to 1000, and scale the resulting coordinates later - outlineMul = (float)(outlineSize / 65536000.0); - outlineSize = 1000; - T1_TransformFont(outlineID, &matrix); - } - - path = new SplashPath(); - if ((outline = T1_GetCharOutline(outlineID, c, outlineSize, NULL))) { - x = 0; - y = 0; - needClose = gFalse; - for (seg = outline; seg; seg = seg->link) { - switch (seg->type) { - case T1_PATHTYPE_MOVE: - if (needClose) { - path->close(); - needClose = gFalse; - } - x += seg->dest.x * outlineMul; - y += seg->dest.y * outlineMul; - path->moveTo(x, -y); - break; - case T1_PATHTYPE_LINE: - x += seg->dest.x * outlineMul; - y += seg->dest.y * outlineMul; - path->lineTo(x, -y); - needClose = gTrue; - break; - case T1_PATHTYPE_BEZIER: - bez = (T1_BEZIERSEGMENT *)seg; - x1 = x + (SplashCoord)(bez->dest.x * outlineMul); - y1 = y + (SplashCoord)(bez->dest.y * outlineMul); - path->curveTo(x + (SplashCoord)(bez->B.x * outlineMul), - -(y + (SplashCoord)(bez->B.y * outlineMul)), - x + (SplashCoord)(bez->C.x * outlineMul), - -(y + (SplashCoord)(bez->C.y * outlineMul)), - x1, -y1); - x = x1; - y = y1; - needClose = gTrue; - break; - } - } - if (needClose) { - path->close(); - } - T1_FreeOutline(outline); - } - - return path; -} - -#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1Font.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1Font.h deleted file mode 100644 index 1dbe66cd7fc..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1Font.h +++ /dev/null @@ -1,69 +0,0 @@ -//======================================================================== -// -// SplashT1Font.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHT1FONT_H -#define SPLASHT1FONT_H - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashFont.h" - -class SplashT1FontFile; - -//------------------------------------------------------------------------ -// SplashT1Font -//------------------------------------------------------------------------ - -class SplashT1Font: public SplashFont { -public: - - SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA); - - virtual ~SplashT1Font(); - - // Munge xFrac and yFrac before calling SplashFont::getGlyph. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); - - // Rasterize a glyph. The <xFrac> and <yFrac> values are the same - // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); - - // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c); - -private: - - int t1libID; // t1lib font ID - int outlineID; // t1lib font ID for glyph outlines - float size; - float outlineSize; // size for glyph outlines - float outlineMul; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontEngine.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontEngine.cc deleted file mode 100644 index a09a8839abf..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontEngine.cc +++ /dev/null @@ -1,138 +0,0 @@ -//======================================================================== -// -// SplashT1FontEngine.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <stdio.h> -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#include <t1lib.h> -#include "goo/GooString.h" -#include "goo/gfile.h" -#include "fofi/FoFiType1C.h" -#include "SplashT1FontFile.h" -#include "SplashT1FontEngine.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ - -int SplashT1FontEngine::t1libInitCount = 0; - -//------------------------------------------------------------------------ - -static void fileWrite(void *stream, char *data, int len) { - fwrite(data, 1, len, (FILE *)stream); -} - -//------------------------------------------------------------------------ -// SplashT1FontEngine -//------------------------------------------------------------------------ - -SplashT1FontEngine::SplashT1FontEngine(GBool aaA) { - aa = aaA; -} - -SplashT1FontEngine *SplashT1FontEngine::init(GBool aaA) { - // grayVals[i] = round(i * 255 / 16) - static unsigned long grayVals[17] = { - 0, 16, 32, 48, 64, 80, 96, 112, 128, 143, 159, 175, 191, 207, 223, 239, 255 - }; - - //~ for multithreading: need a mutex here - if (t1libInitCount == 0) { - T1_SetBitmapPad(8); - if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE | - T1_NO_AFM)) { - return NULL; - } - if (aaA) { - T1_AASetBitsPerPixel(8); - T1_AASetLevel(T1_AA_HIGH); - T1_AAHSetGrayValues(grayVals); - } else { - T1_AANSetGrayValues(0, 1); - } - } - ++t1libInitCount; - - return new SplashT1FontEngine(aaA); -} - -SplashT1FontEngine::~SplashT1FontEngine() { - //~ for multithreading: need a mutex here - if (--t1libInitCount == 0) { - T1_CloseLib(); - } -} - -SplashFontFile *SplashT1FontEngine::loadType1Font(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - return SplashT1FontFile::loadType1Font(this, idA, src, enc); -} - -SplashFontFile *SplashT1FontEngine::loadType1CFont(SplashFontFileID *idA, - SplashFontSrc *src, - char **enc) { - FoFiType1C *ff; - GooString *tmpFileName; - FILE *tmpFile; - SplashFontFile *ret; - - SplashFontSrc *newsrc; - - if (src->isFile) - ff = FoFiType1C::load(src->fileName->getCString()); - else - ff = FoFiType1C::make(src->buf, src->bufLen); - if (! ff) - return NULL; - - tmpFileName = NULL; - if (!openTempFile(&tmpFileName, &tmpFile, "wb")) { - delete ff; - return NULL; - } - ff->convertToType1(NULL, NULL, gTrue, &fileWrite, tmpFile); - delete ff; - fclose(tmpFile); - newsrc = new SplashFontSrc; - newsrc->setFile(tmpFileName, gTrue); - delete tmpFileName; - ret = SplashT1FontFile::loadType1Font(this, idA, newsrc, enc); - newsrc->unref(); - return ret; -} - -#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontEngine.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontEngine.h deleted file mode 100644 index ffc285bd6d4..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontEngine.h +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================== -// -// SplashT1FontEngine.h -// -//======================================================================== - -#ifndef SPLASHT1FONTENGINE_H -#define SPLASHT1FONTENGINE_H - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "goo/gtypes.h" - -class SplashFontFile; -class SplashFontFileID; -class SplashFontSrc; - -//------------------------------------------------------------------------ -// SplashT1FontEngine -//------------------------------------------------------------------------ - -class SplashT1FontEngine { -public: - - static SplashT1FontEngine *init(GBool aaA); - - ~SplashT1FontEngine(); - - // Load fonts. - SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, char **enc); - -private: - - SplashT1FontEngine(GBool aaA); - - static int t1libInitCount; - GBool aa; - - friend class SplashT1FontFile; - friend class SplashT1Font; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontFile.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontFile.cc deleted file mode 100644 index 3f46ba630d4..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontFile.cc +++ /dev/null @@ -1,134 +0,0 @@ -//======================================================================== -// -// SplashT1FontFile.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <string.h> -#include <t1lib.h> -#include "goo/GooString.h" -#include "goo/gfile.h" -#include "goo/gmem.h" -#include "SplashT1FontEngine.h" -#include "SplashT1Font.h" -#include "SplashT1FontFile.h" - -//------------------------------------------------------------------------ -// SplashT1FontFile -//------------------------------------------------------------------------ - -SplashFontFile *SplashT1FontFile::loadType1Font(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - char **encA) { - int t1libIDA; - char **encTmp; - char *encStrTmp; - int encStrSize; - char *encPtr; - int i; - - GooString *fileNameA; - SplashFontSrc *newsrc = NULL; - SplashFontFile *ff; - - if (! src->isFile) { - GooString *tmpFileName; - FILE *tmpFile; - if (!openTempFile(&tmpFileName, &tmpFile, "wb")) - return NULL; - fwrite(src->buf, 1, src->bufLen, tmpFile); - fclose(tmpFile); - newsrc = new SplashFontSrc; - newsrc->setFile(tmpFileName, gTrue); - src = newsrc; - delete tmpFileName; - } - fileNameA = src->fileName; - // load the font file - if ((t1libIDA = T1_AddFont(fileNameA->getCString())) < 0) { - delete newsrc; - return NULL; - } - T1_LoadFont(t1libIDA); - - // reencode it - encStrSize = 0; - for (i = 0; i < 256; ++i) { - if (encA[i]) { - encStrSize += strlen(encA[i]) + 1; - } - } - encTmp = (char **)gmallocn(257, sizeof(char *)); - encStrTmp = (char *)gmallocn(encStrSize, sizeof(char)); - encPtr = encStrTmp; - for (i = 0; i < 256; ++i) { - if (encA[i]) { - strcpy(encPtr, encA[i]); - encTmp[i] = encPtr; - encPtr += strlen(encPtr) + 1; - } else { - encTmp[i] = ".notdef"; - } - } - encTmp[256] = "custom"; - T1_ReencodeFont(t1libIDA, encTmp); - - ff = new SplashT1FontFile(engineA, idA, src, - t1libIDA, encTmp, encStrTmp); - if (newsrc) - newsrc->unref(); - return ff; -} - -SplashT1FontFile::SplashT1FontFile(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *srcA, - int t1libIDA, char **encA, char *encStrA): - SplashFontFile(idA, srcA) -{ - engine = engineA; - t1libID = t1libIDA; - enc = encA; - encStr = encStrA; -} - -SplashT1FontFile::~SplashT1FontFile() { - gfree(encStr); - gfree(enc); - T1_DeleteFont(t1libID); -} - -SplashFont *SplashT1FontFile::makeFont(SplashCoord *mat, - SplashCoord *textMat) { - SplashFont *font; - - font = new SplashT1Font(this, mat, textMat); - font->initCache(); - return font; -} - -#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontFile.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontFile.h deleted file mode 100644 index 24c958bc0cd..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashT1FontFile.h +++ /dev/null @@ -1,70 +0,0 @@ -//======================================================================== -// -// SplashT1FontFile.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHT1FONTFILE_H -#define SPLASHT1FONTFILE_H - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashFontFile.h" - -class SplashT1FontEngine; - -//------------------------------------------------------------------------ -// SplashT1FontFile -//------------------------------------------------------------------------ - -class SplashT1FontFile: public SplashFontFile { -public: - - static SplashFontFile *loadType1Font(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - char **encA); - - virtual ~SplashT1FontFile(); - - // Create a new SplashT1Font, i.e., a scaled instance of this font - // file. - virtual SplashFont *makeFont(SplashCoord *mat, - SplashCoord *textMat); - -private: - - SplashT1FontFile(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - int t1libIDA, char **encA, char *encStrA); - - SplashT1FontEngine *engine; - int t1libID; // t1lib font ID - char **enc; - char *encStr; - - friend class SplashT1Font; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashTypes.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashTypes.h deleted file mode 100644 index a8686520f91..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashTypes.h +++ /dev/null @@ -1,153 +0,0 @@ -//======================================================================== -// -// SplashTypes.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2008 Tomas Are Haavet <tomasare@gmail.com> -// Copyright (C) 2009 Thomas Freitag <Thomas.Freitag@alfa.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHTYPES_H -#define SPLASHTYPES_H - -#include "goo/gtypes.h" - -//------------------------------------------------------------------------ -// coordinates -//------------------------------------------------------------------------ - -#if USE_FIXEDPOINT -#include "goo/FixedPoint.h" -typedef FixedPoint SplashCoord; -#else -typedef double SplashCoord; -#endif - -//------------------------------------------------------------------------ -// antialiasing -//------------------------------------------------------------------------ - -#define splashAASize 4 - -//------------------------------------------------------------------------ -// colors -//------------------------------------------------------------------------ - -enum SplashColorMode { - splashModeMono1, // 1 bit per component, 8 pixels per byte, - // MSbit is on the left - splashModeMono8, // 1 byte per component, 1 byte per pixel - splashModeRGB8, // 1 byte per component, 3 bytes per pixel: - // RGBRGB... - splashModeBGR8, // 1 byte per component, 3 bytes per pixel: - // BGRBGR... - splashModeXBGR8 // 1 byte per component, 4 bytes per pixel: - // XBGRXBGR... -#if SPLASH_CMYK - , - splashModeCMYK8 // 1 byte per component, 4 bytes per pixel: - // CMYKCMYK... -#endif -}; - -// number of components in each color mode -// (defined in SplashState.cc) -extern int splashColorModeNComps[]; - -// max number of components in any SplashColor -#define splashMaxColorComps 4 - -typedef Guchar SplashColor[splashMaxColorComps]; -typedef Guchar *SplashColorPtr; - -// RGB8 -static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; } -static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; } -static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; } - -// BGR8 -static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; } -static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; } -static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; } - -#if SPLASH_CMYK -// CMYK8 -static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; } -static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; } -static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; } -static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; } -#endif - -static inline void splashClearColor(SplashColorPtr dest) { - dest[0] = 0; - dest[1] = 0; - dest[2] = 0; -#if SPLASH_CMYK - dest[3] = 0; -#endif -} - -static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; -#if SPLASH_CMYK - dest[3] = src[3]; -#endif -} - -static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) { - dest[0] ^= src[0]; - dest[1] ^= src[1]; - dest[2] ^= src[2]; -#if SPLASH_CMYK - dest[3] ^= src[3]; -#endif -} - -//------------------------------------------------------------------------ -// blend functions -//------------------------------------------------------------------------ - -typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm); - -//------------------------------------------------------------------------ -// screen parameters -//------------------------------------------------------------------------ - -enum SplashScreenType { - splashScreenDispersed, - splashScreenClustered, - splashScreenStochasticClustered -}; - -struct SplashScreenParams { - SplashScreenType type; - int size; - int dotRadius; - SplashCoord gamma; - SplashCoord blackThreshold; - SplashCoord whiteThreshold; -}; - -//------------------------------------------------------------------------ -// error results -//------------------------------------------------------------------------ - -typedef int SplashError; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPath.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPath.cc deleted file mode 100644 index d7e114d5d03..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPath.cc +++ /dev/null @@ -1,443 +0,0 @@ -//======================================================================== -// -// SplashXPath.cc -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <string.h> -#include "goo/gmem.h" -#include "SplashMath.h" -#include "SplashPath.h" -#include "SplashXPath.h" - -//------------------------------------------------------------------------ - -struct SplashXPathPoint { - SplashCoord x, y; -}; - -struct SplashXPathAdjust { - int firstPt, lastPt; // range of points - GBool vert; // vertical or horizontal hint - SplashCoord x0a, x0b, // hint boundaries - xma, xmb, - x1a, x1b; - SplashCoord x0, x1, xm; // adjusted coordinates -}; - -//------------------------------------------------------------------------ - -// Transform a point from user space to device space. -inline void SplashXPath::transform(SplashCoord *matrix, - SplashCoord xi, SplashCoord yi, - SplashCoord *xo, SplashCoord *yo) { - // [ m[0] m[1] 0 ] - // [xo yo 1] = [xi yi 1] * [ m[2] m[3] 0 ] - // [ m[4] m[5] 1 ] - *xo = xi * matrix[0] + yi * matrix[2] + matrix[4]; - *yo = xi * matrix[1] + yi * matrix[3] + matrix[5]; -} - -//------------------------------------------------------------------------ -// SplashXPath -//------------------------------------------------------------------------ - -SplashXPath::SplashXPath() { - segs = NULL; - length = size = 0; -} - -SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool closeSubpaths) { - SplashPathHint *hint; - SplashXPathPoint *pts; - SplashXPathAdjust *adjusts, *adjust; - SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xsp, ysp; - SplashCoord adj0, adj1, w; - int ww; - int curSubpath, curSubpathX, i, j; - - // transform the points - pts = (SplashXPathPoint *)gmallocn(path->length, sizeof(SplashXPathPoint)); - for (i = 0; i < path->length; ++i) { - transform(matrix, path->pts[i].x, path->pts[i].y, &pts[i].x, &pts[i].y); - } - - // set up the stroke adjustment hints - if (path->hints) { - adjusts = (SplashXPathAdjust *)gmallocn(path->hintsLength, - sizeof(SplashXPathAdjust)); - for (i = 0; i < path->hintsLength; ++i) { - hint = &path->hints[i]; - if (hint->ctrl0 + 1 >= path->length || hint->ctrl1 + 1 >= path->length) { - gfree(adjusts); - adjusts = NULL; - break; - } - x0 = pts[hint->ctrl0 ].x; y0 = pts[hint->ctrl0 ].y; - x1 = pts[hint->ctrl0 + 1].x; y1 = pts[hint->ctrl0 + 1].y; - x2 = pts[hint->ctrl1 ].x; y2 = pts[hint->ctrl1 ].y; - x3 = pts[hint->ctrl1 + 1].x; y3 = pts[hint->ctrl1 + 1].y; - if (x0 == x1 && x2 == x3) { - adjusts[i].vert = gTrue; - adj0 = x0; - adj1 = x2; - } else if (y0 == y1 && y2 == y3) { - adjusts[i].vert = gFalse; - adj0 = y0; - adj1 = y2; - } else { - gfree(adjusts); - adjusts = NULL; - break; - } - if (adj0 > adj1) { - x0 = adj0; - adj0 = adj1; - adj1 = x0; - } - w = adj1 - adj0; - ww = splashRound(w); - if (ww == 0) { - ww = 1; - } - adjusts[i].x0a = adj0 - 0.01; - adjusts[i].x0b = adj0 + 0.01; - adjusts[i].xma = (SplashCoord)0.5 * (adj0 + adj1) - 0.01; - adjusts[i].xmb = (SplashCoord)0.5 * (adj0 + adj1) + 0.01; - adjusts[i].x1a = adj1 - 0.01; - adjusts[i].x1b = adj1 + 0.01; - adjusts[i].x0 = (SplashCoord)splashRound(adj0); - adjusts[i].x1 = adjusts[i].x0 + ww - 0.01; - adjusts[i].xm = (SplashCoord)0.5 * (adjusts[i].x0 + adjusts[i].x1); - adjusts[i].firstPt = hint->firstPt; - adjusts[i].lastPt = hint->lastPt; - } - - } else { - adjusts = NULL; - } - - // perform stroke adjustment - if (adjusts) { - for (i = 0, adjust = adjusts; i < path->hintsLength; ++i, ++adjust) { - for (j = adjust->firstPt; j <= adjust->lastPt; ++j) { - strokeAdjust(adjust, &pts[j].x, &pts[j].y); - } - } - gfree(adjusts); - } - - segs = NULL; - length = size = 0; - - x0 = y0 = xsp = ysp = 0; // make gcc happy - adj0 = adj1 = 0; // make gcc happy - curSubpath = 0; - curSubpathX = 0; - i = 0; - while (i < path->length) { - - // first point in subpath - skip it - if (path->flags[i] & splashPathFirst) { - x0 = pts[i].x; - y0 = pts[i].y; - xsp = x0; - ysp = y0; - curSubpath = i; - curSubpathX = length; - ++i; - - } else { - - // curve segment - if (path->flags[i] & splashPathCurve) { - x1 = pts[i].x; - y1 = pts[i].y; - x2 = pts[i+1].x; - y2 = pts[i+1].y; - x3 = pts[i+2].x; - y3 = pts[i+2].y; - addCurve(x0, y0, x1, y1, x2, y2, x3, y3, - flatness, - (path->flags[i-1] & splashPathFirst), - (path->flags[i+2] & splashPathLast), - !closeSubpaths && - (path->flags[i-1] & splashPathFirst) && - !(path->flags[i-1] & splashPathClosed), - !closeSubpaths && - (path->flags[i+2] & splashPathLast) && - !(path->flags[i+2] & splashPathClosed)); - x0 = x3; - y0 = y3; - i += 3; - - // line segment - } else { - x1 = pts[i].x; - y1 = pts[i].y; - addSegment(x0, y0, x1, y1, - path->flags[i-1] & splashPathFirst, - path->flags[i] & splashPathLast, - !closeSubpaths && - (path->flags[i-1] & splashPathFirst) && - !(path->flags[i-1] & splashPathClosed), - !closeSubpaths && - (path->flags[i] & splashPathLast) && - !(path->flags[i] & splashPathClosed)); - x0 = x1; - y0 = y1; - ++i; - } - - // close a subpath - if (closeSubpaths && - (path->flags[i-1] & splashPathLast) && - (pts[i-1].x != pts[curSubpath].x || - pts[i-1].y != pts[curSubpath].y)) { - addSegment(x0, y0, xsp, ysp, - gFalse, gTrue, gFalse, gFalse); - } - } - } - - gfree(pts); -} - -// Apply the stroke adjust hints to point <pt>: (*<xp>, *<yp>). -void SplashXPath::strokeAdjust(SplashXPathAdjust *adjust, - SplashCoord *xp, SplashCoord *yp) { - SplashCoord x, y; - - if (adjust->vert) { - x = *xp; - if (x > adjust->x0a && x < adjust->x0b) { - *xp = adjust->x0; - } else if (x > adjust->xma && x < adjust->xmb) { - *xp = adjust->xm; - } else if (x > adjust->x1a && x < adjust->x1b) { - *xp = adjust->x1; - } - } else { - y = *yp; - if (y > adjust->x0a && y < adjust->x0b) { - *yp = adjust->x0; - } else if (y > adjust->xma && y < adjust->xmb) { - *yp = adjust->xm; - } else if (y > adjust->x1a && y < adjust->x1b) { - *yp = adjust->x1; - } - } -} - -SplashXPath::SplashXPath(SplashXPath *xPath) { - length = xPath->length; - size = xPath->size; - segs = (SplashXPathSeg *)gmallocn(size, sizeof(SplashXPathSeg)); - memcpy(segs, xPath->segs, length * sizeof(SplashXPathSeg)); -} - -SplashXPath::~SplashXPath() { - gfree(segs); -} - -// Add space for <nSegs> more segments -void SplashXPath::grow(int nSegs) { - if (length + nSegs > size) { - if (size == 0) { - size = 32; - } - while (size < length + nSegs) { - size *= 2; - } - segs = (SplashXPathSeg *)greallocn(segs, size, sizeof(SplashXPathSeg)); - } -} - -void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3, - SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1) { - SplashCoord cx[splashMaxCurveSplits + 1][3]; - SplashCoord cy[splashMaxCurveSplits + 1][3]; - int cNext[splashMaxCurveSplits + 1]; - SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh; - SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh; - SplashCoord dx, dy, mx, my, d1, d2, flatness2; - int p1, p2, p3; - - flatness2 = flatness * flatness; - - // initial segment - p1 = 0; - p2 = splashMaxCurveSplits; - cx[p1][0] = x0; cy[p1][0] = y0; - cx[p1][1] = x1; cy[p1][1] = y1; - cx[p1][2] = x2; cy[p1][2] = y2; - cx[p2][0] = x3; cy[p2][0] = y3; - cNext[p1] = p2; - - while (p1 < splashMaxCurveSplits) { - - // get the next segment - xl0 = cx[p1][0]; yl0 = cy[p1][0]; - xx1 = cx[p1][1]; yy1 = cy[p1][1]; - xx2 = cx[p1][2]; yy2 = cy[p1][2]; - p2 = cNext[p1]; - xr3 = cx[p2][0]; yr3 = cy[p2][0]; - - // compute the distances from the control points to the - // midpoint of the straight line (this is a bit of a hack, but - // it's much faster than computing the actual distances to the - // line) - mx = (xl0 + xr3) * 0.5; - my = (yl0 + yr3) * 0.5; - dx = xx1 - mx; - dy = yy1 - my; - d1 = dx*dx + dy*dy; - dx = xx2 - mx; - dy = yy2 - my; - d2 = dx*dx + dy*dy; - - // if the curve is flat enough, or no more subdivisions are - // allowed, add the straight line segment - if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) { - addSegment(xl0, yl0, xr3, yr3, - p1 == 0 && first, - p2 == splashMaxCurveSplits && last, - p1 == 0 && end0, - p2 == splashMaxCurveSplits && end1); - p1 = p2; - - // otherwise, subdivide the curve - } else { - xl1 = (xl0 + xx1) * 0.5; - yl1 = (yl0 + yy1) * 0.5; - xh = (xx1 + xx2) * 0.5; - yh = (yy1 + yy2) * 0.5; - xl2 = (xl1 + xh) * 0.5; - yl2 = (yl1 + yh) * 0.5; - xr2 = (xx2 + xr3) * 0.5; - yr2 = (yy2 + yr3) * 0.5; - xr1 = (xh + xr2) * 0.5; - yr1 = (yh + yr2) * 0.5; - xr0 = (xl2 + xr1) * 0.5; - yr0 = (yl2 + yr1) * 0.5; - // add the new subdivision points - p3 = (p1 + p2) / 2; - cx[p1][1] = xl1; cy[p1][1] = yl1; - cx[p1][2] = xl2; cy[p1][2] = yl2; - cNext[p1] = p3; - cx[p3][0] = xr0; cy[p3][0] = yr0; - cx[p3][1] = xr1; cy[p3][1] = yr1; - cx[p3][2] = xr2; cy[p3][2] = yr2; - cNext[p3] = p2; - } - } -} - -void SplashXPath::addSegment(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - GBool first, GBool last, GBool end0, GBool end1) { - grow(1); - segs[length].x0 = x0; - segs[length].y0 = y0; - segs[length].x1 = x1; - segs[length].y1 = y1; - segs[length].flags = 0; - if (first) { - segs[length].flags |= splashXPathFirst; - } - if (last) { - segs[length].flags |= splashXPathLast; - } - if (end0) { - segs[length].flags |= splashXPathEnd0; - } - if (end1) { - segs[length].flags |= splashXPathEnd1; - } - if (y1 == y0) { - segs[length].dxdy = segs[length].dydx = 0; - segs[length].flags |= splashXPathHoriz; - if (x1 == x0) { - segs[length].flags |= splashXPathVert; - } - } else if (x1 == x0) { - segs[length].dxdy = segs[length].dydx = 0; - segs[length].flags |= splashXPathVert; - } else { -#if USE_FIXEDPOINT - if (FixedPoint::divCheck(x1 - x0, y1 - y0, &segs[length].dxdy)) { - segs[length].dydx = (SplashCoord)1 / segs[length].dxdy; - } else { - segs[length].dxdy = segs[length].dydx = 0; - if (splashAbs(x1 - x0) > splashAbs(y1 - y0)) { - segs[length].flags |= splashXPathHoriz; - } else { - segs[length].flags |= splashXPathVert; - } - } -#else - segs[length].dxdy = (x1 - x0) / (y1 - y0); - segs[length].dydx = (SplashCoord)1 / segs[length].dxdy; -#endif - } - if (y0 > y1) { - segs[length].flags |= splashXPathFlip; - } - ++length; -} - -static int cmpXPathSegs(const void *arg0, const void *arg1) { - SplashXPathSeg *seg0 = (SplashXPathSeg *)arg0; - SplashXPathSeg *seg1 = (SplashXPathSeg *)arg1; - SplashCoord x0, y0, x1, y1; - - if (seg0->flags & splashXPathFlip) { - x0 = seg0->x1; - y0 = seg0->y1; - } else { - x0 = seg0->x0; - y0 = seg0->y0; - } - if (seg1->flags & splashXPathFlip) { - x1 = seg1->x1; - y1 = seg1->y1; - } else { - x1 = seg1->x0; - y1 = seg1->y0; - } - if (y0 != y1) { - return (y0 > y1) ? 1 : -1; - } - if (x0 != x1) { - return (x0 > x1) ? 1 : -1; - } - return 0; -} - -void SplashXPath::aaScale() { - SplashXPathSeg *seg; - int i; - - for (i = 0, seg = segs; i < length; ++i, ++seg) { - seg->x0 *= splashAASize; - seg->y0 *= splashAASize; - seg->x1 *= splashAASize; - seg->y1 *= splashAASize; - } -} - -void SplashXPath::sort() { - qsort(segs, length, sizeof(SplashXPathSeg), &cmpXPathSegs); -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPath.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPath.h deleted file mode 100644 index 64c47969ef8..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPath.h +++ /dev/null @@ -1,98 +0,0 @@ -//======================================================================== -// -// SplashXPath.h -// -//======================================================================== - -#ifndef SPLASHXPATH_H -#define SPLASHXPATH_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashPath; -struct SplashXPathAdjust; - -//------------------------------------------------------------------------ - -#define splashMaxCurveSplits (1 << 10) - -//------------------------------------------------------------------------ -// SplashXPathSeg -//------------------------------------------------------------------------ - -struct SplashXPathSeg { - SplashCoord x0, y0; // first endpoint - SplashCoord x1, y1; // second endpoint - SplashCoord dxdy; // slope: delta-x / delta-y - SplashCoord dydx; // slope: delta-y / delta-x - Guint flags; -}; - -#define splashXPathFirst 0x01 // first segment of a subpath -#define splashXPathLast 0x02 // last segment of a subpath -#define splashXPathEnd0 0x04 // first endpoint is end of an open subpath -#define splashXPathEnd1 0x08 // second endpoint is end of an open subpath -#define splashXPathHoriz 0x10 // segment is vertical (y0 == y1) - // (dxdy is undef) -#define splashXPathVert 0x20 // segment is horizontal (x0 == x1) - // (dydx is undef) -#define splashXPathFlip 0x40 // y0 > y1 - -//------------------------------------------------------------------------ -// SplashXPath -//------------------------------------------------------------------------ - -class SplashXPath { -public: - - // Expands (converts to segments) and flattens (converts curves to - // lines) <path>. Transforms all points from user space to device - // space, via <matrix>. If <closeSubpaths> is true, closes all open - // subpaths. - SplashXPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool closeSubpaths); - - // Copy an expanded path. - SplashXPath *copy() { return new SplashXPath(this); } - - ~SplashXPath(); - - // Multiply all coordinates by splashAASize, in preparation for - // anti-aliased rendering. - void aaScale(); - - // Sort by upper coordinate (lower y), in y-major order. - void sort(); - -protected: - - SplashXPath(); - SplashXPath(SplashXPath *xPath); - void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, - SplashCoord *xo, SplashCoord *yo); - void strokeAdjust(SplashXPathAdjust *adjust, - SplashCoord *xp, SplashCoord *yp); - void grow(int nSegs); - void addCurve(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3, - SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1); - void addSegment(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - GBool first, GBool last, GBool end0, GBool end1); - - SplashXPathSeg *segs; - int length, size; // length and size of segs array - - friend class SplashXPathScanner; - friend class SplashClip; - friend class Splash; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPathScanner.cc b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPathScanner.cc deleted file mode 100644 index eab9cef59b3..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPathScanner.cc +++ /dev/null @@ -1,443 +0,0 @@ -//======================================================================== -// -// SplashXPathScanner.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <string.h> -#include "goo/gmem.h" -#include "SplashMath.h" -#include "SplashXPath.h" -#include "SplashBitmap.h" -#include "SplashXPathScanner.h" - -//------------------------------------------------------------------------ - -struct SplashIntersect { - int x0, x1; // intersection of segment with [y, y+1) - int count; // EO/NZWN counter increment -}; - -static int cmpIntersect(const void *p0, const void *p1) { - return ((SplashIntersect *)p0)->x0 - ((SplashIntersect *)p1)->x0; -} - -//------------------------------------------------------------------------ -// SplashXPathScanner -//------------------------------------------------------------------------ - -SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, GBool eoA) { - SplashXPathSeg *seg; - SplashCoord xMinFP, yMinFP, xMaxFP, yMaxFP; - int i; - - xPath = xPathA; - eo = eoA; - - // compute the bbox - if (xPath->length == 0) { - xMin = yMin = 1; - xMax = yMax = 0; - } else { - seg = &xPath->segs[0]; - if (seg->x0 <= seg->x1) { - xMinFP = seg->x0; - xMaxFP = seg->x1; - } else { - xMinFP = seg->x1; - xMaxFP = seg->x0; - } - if (seg->flags & splashXPathFlip) { - yMinFP = seg->y1; - yMaxFP = seg->y0; - } else { - yMinFP = seg->y0; - yMaxFP = seg->y1; - } - for (i = 1; i < xPath->length; ++i) { - seg = &xPath->segs[i]; - if (seg->x0 < xMinFP) { - xMinFP = seg->x0; - } else if (seg->x0 > xMaxFP) { - xMaxFP = seg->x0; - } - if (seg->x1 < xMinFP) { - xMinFP = seg->x1; - } else if (seg->x1 > xMaxFP) { - xMaxFP = seg->x1; - } - if (seg->flags & splashXPathFlip) { - if (seg->y0 > yMaxFP) { - yMaxFP = seg->y0; - } - } else { - if (seg->y1 > yMaxFP) { - yMaxFP = seg->y1; - } - } - } - xMin = splashFloor(xMinFP); - xMax = splashFloor(xMaxFP); - yMin = splashFloor(yMinFP); - yMax = splashFloor(yMaxFP); - } - - interY = yMin - 1; - xPathIdx = 0; - inter = NULL; - interLen = interSize = 0; -} - -SplashXPathScanner::~SplashXPathScanner() { - gfree(inter); -} - -void SplashXPathScanner::getBBoxAA(int *xMinA, int *yMinA, - int *xMaxA, int *yMaxA) { - *xMinA = xMin / splashAASize; - *yMinA = yMin / splashAASize; - *xMaxA = xMax / splashAASize; - *yMaxA = yMax / splashAASize; -} - -void SplashXPathScanner::getSpanBounds(int y, int *spanXMin, int *spanXMax) { - if (interY != y) { - computeIntersections(y); - } - if (interLen > 0) { - *spanXMin = inter[0].x0; - *spanXMax = inter[interLen - 1].x1; - } else { - *spanXMin = xMax + 1; - *spanXMax = xMax; - } -} - -GBool SplashXPathScanner::test(int x, int y) { - int count, i; - - if (interY != y) { - computeIntersections(y); - } - count = 0; - for (i = 0; i < interLen && inter[i].x0 <= x; ++i) { - if (x <= inter[i].x1) { - return gTrue; - } - count += inter[i].count; - } - return eo ? (count & 1) : (count != 0); -} - -GBool SplashXPathScanner::testSpan(int x0, int x1, int y) { - int count, xx1, i; - - if (interY != y) { - computeIntersections(y); - } - - count = 0; - for (i = 0; i < interLen && inter[i].x1 < x0; ++i) { - count += inter[i].count; - } - - // invariant: the subspan [x0,xx1] is inside the path - xx1 = x0 - 1; - while (xx1 < x1) { - if (i >= interLen) { - return gFalse; - } - if (inter[i].x0 > xx1 + 1 && - !(eo ? (count & 1) : (count != 0))) { - return gFalse; - } - if (inter[i].x1 > xx1) { - xx1 = inter[i].x1; - } - count += inter[i].count; - ++i; - } - - return gTrue; -} - -GBool SplashXPathScanner::getNextSpan(int y, int *x0, int *x1) { - int xx0, xx1; - - if (interY != y) { - computeIntersections(y); - } - if (interIdx >= interLen) { - return gFalse; - } - xx0 = inter[interIdx].x0; - xx1 = inter[interIdx].x1; - interCount += inter[interIdx].count; - ++interIdx; - while (interIdx < interLen && - (inter[interIdx].x0 <= xx1 || - (eo ? (interCount & 1) : (interCount != 0)))) { - if (inter[interIdx].x1 > xx1) { - xx1 = inter[interIdx].x1; - } - interCount += inter[interIdx].count; - ++interIdx; - } - *x0 = xx0; - *x1 = xx1; - return gTrue; -} - -void SplashXPathScanner::computeIntersections(int y) { - SplashCoord xSegMin, xSegMax, ySegMin, ySegMax, xx0, xx1; - SplashXPathSeg *seg; - int i, j; - - // find the first segment that intersects [y, y+1) - i = (y >= interY) ? xPathIdx : 0; - while (i < xPath->length && - xPath->segs[i].y0 < y && xPath->segs[i].y1 < y) { - ++i; - } - xPathIdx = i; - - // find all of the segments that intersect [y, y+1) and create an - // Intersect element for each one - interLen = 0; - for (j = i; j < xPath->length; ++j) { - seg = &xPath->segs[j]; - if (seg->flags & splashXPathFlip) { - ySegMin = seg->y1; - ySegMax = seg->y0; - } else { - ySegMin = seg->y0; - ySegMax = seg->y1; - } - - // ensure that: ySegMin < y+1 - // y <= ySegMax - if (ySegMin >= y + 1) { - break; - } - if (ySegMax < y) { - continue; - } - - if (interLen == interSize) { - if (interSize == 0) { - interSize = 16; - } else { - interSize *= 2; - } - inter = (SplashIntersect *)greallocn(inter, interSize, - sizeof(SplashIntersect)); - } - - if (seg->flags & splashXPathHoriz) { - xx0 = seg->x0; - xx1 = seg->x1; - } else if (seg->flags & splashXPathVert) { - xx0 = xx1 = seg->x0; - } else { - if (seg->x0 < seg->x1) { - xSegMin = seg->x0; - xSegMax = seg->x1; - } else { - xSegMin = seg->x1; - xSegMax = seg->x0; - } - // intersection with top edge - xx0 = seg->x0 + ((SplashCoord)y - seg->y0) * seg->dxdy; - // intersection with bottom edge - xx1 = seg->x0 + ((SplashCoord)y + 1 - seg->y0) * seg->dxdy; - // the segment may not actually extend to the top and/or bottom edges - if (xx0 < xSegMin) { - xx0 = xSegMin; - } else if (xx0 > xSegMax) { - xx0 = xSegMax; - } - if (xx1 < xSegMin) { - xx1 = xSegMin; - } else if (xx1 > xSegMax) { - xx1 = xSegMax; - } - } - if (xx0 < xx1) { - inter[interLen].x0 = splashFloor(xx0); - inter[interLen].x1 = splashFloor(xx1); - } else { - inter[interLen].x0 = splashFloor(xx1); - inter[interLen].x1 = splashFloor(xx0); - } - if (ySegMin <= y && - (SplashCoord)y < ySegMax && - !(seg->flags & splashXPathHoriz)) { - inter[interLen].count = eo ? 1 - : (seg->flags & splashXPathFlip) ? 1 : -1; - } else { - inter[interLen].count = 0; - } - ++interLen; - } - - qsort(inter, interLen, sizeof(SplashIntersect), &cmpIntersect); - - interY = y; - interIdx = 0; - interCount = 0; -} - -void SplashXPathScanner::renderAALine(SplashBitmap *aaBuf, - int *x0, int *x1, int y) { - int xx0, xx1, xx, xxMin, xxMax, yy; - Guchar mask; - SplashColorPtr p; - - memset(aaBuf->getDataPtr(), 0, aaBuf->getRowSize() * aaBuf->getHeight()); - xxMin = aaBuf->getWidth(); - xxMax = -1; - for (yy = 0; yy < splashAASize; ++yy) { - computeIntersections(splashAASize * y + yy); - while (interIdx < interLen) { - xx0 = inter[interIdx].x0; - xx1 = inter[interIdx].x1; - interCount += inter[interIdx].count; - ++interIdx; - while (interIdx < interLen && - (inter[interIdx].x0 <= xx1 || - (eo ? (interCount & 1) : (interCount != 0)))) { - if (inter[interIdx].x1 > xx1) { - xx1 = inter[interIdx].x1; - } - interCount += inter[interIdx].count; - ++interIdx; - } - if (xx0 < 0) { - xx0 = 0; - } - ++xx1; - if (xx1 > aaBuf->getWidth()) { - xx1 = aaBuf->getWidth(); - } - // set [xx0, xx1) to 1 - if (xx0 < xx1) { - xx = xx0; - p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx >> 3); - if (xx & 7) { - mask = 0xff >> (xx & 7); - if ((xx & ~7) == (xx1 & ~7)) { - mask &= (Guchar)(0xff00 >> (xx1 & 7)); - } - *p++ |= mask; - xx = (xx & ~7) + 8; - } - for (; xx + 7 < xx1; xx += 8) { - *p++ |= 0xff; - } - if (xx < xx1) { - *p |= (Guchar)(0xff00 >> (xx1 & 7)); - } - } - if (xx0 < xxMin) { - xxMin = xx0; - } - if (xx1 > xxMax) { - xxMax = xx1; - } - } - } - *x0 = xxMin / splashAASize; - *x1 = (xxMax - 1) / splashAASize; -} - -void SplashXPathScanner::clipAALine(SplashBitmap *aaBuf, - int *x0, int *x1, int y) { - int xx0, xx1, xx, yy; - Guchar mask; - SplashColorPtr p; - - for (yy = 0; yy < splashAASize; ++yy) { - xx = *x0 * splashAASize; - computeIntersections(splashAASize * y + yy); - while (interIdx < interLen && xx < (*x1 + 1) * splashAASize) { - xx0 = inter[interIdx].x0; - xx1 = inter[interIdx].x1; - interCount += inter[interIdx].count; - ++interIdx; - while (interIdx < interLen && - (inter[interIdx].x0 <= xx1 || - (eo ? (interCount & 1) : (interCount != 0)))) { - if (inter[interIdx].x1 > xx1) { - xx1 = inter[interIdx].x1; - } - interCount += inter[interIdx].count; - ++interIdx; - } - if (xx0 > aaBuf->getWidth()) { - xx0 = aaBuf->getWidth(); - } - // set [xx, xx0) to 0 - if (xx < xx0) { - p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx >> 3); - if (xx & 7) { - mask = (Guchar)(0xff00 >> (xx & 7)); - if ((xx & ~7) == (xx0 & ~7)) { - mask |= 0xff >> (xx0 & 7); - } - *p++ &= mask; - xx = (xx & ~7) + 8; - } - for (; xx + 7 <= xx0; xx += 8) { - *p++ = 0x00; - } - if (xx < xx0) { - *p &= 0xff >> (xx0 & 7); - } - } - if (xx1 >= xx) { - xx = xx1 + 1; - } - } - xx0 = (*x1 + 1) * splashAASize; - if (xx0 > aaBuf->getWidth()) xx0 = aaBuf->getWidth(); - // set [xx, xx0) to 0 - if (xx < xx0) { - p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx >> 3); - if (xx & 7) { - mask = (Guchar)(0xff00 >> (xx & 7)); - if ((xx & ~7) == (xx0 & ~7)) { - mask &= 0xff >> (xx0 & 7); - } - *p++ &= mask; - xx = (xx & ~7) + 8; - } - for (; xx + 7 <= xx0; xx += 8) { - *p++ = 0x00; - } - if (xx < xx0) { - *p &= 0xff >> (xx0 & 7); - } - } - } -} diff --git a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPathScanner.h b/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPathScanner.h deleted file mode 100644 index 1cc4f3cdecf..00000000000 --- a/Build/source/libs/poppler/poppler-0.12.4/splash/SplashXPathScanner.h +++ /dev/null @@ -1,85 +0,0 @@ -//======================================================================== -// -// SplashXPathScanner.h -// -//======================================================================== - -#ifndef SPLASHXPATHSCANNER_H -#define SPLASHXPATHSCANNER_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashXPath; -class SplashBitmap; -struct SplashIntersect; - -//------------------------------------------------------------------------ -// SplashXPathScanner -//------------------------------------------------------------------------ - -class SplashXPathScanner { -public: - - // Create a new SplashXPathScanner object. <xPathA> must be sorted. - SplashXPathScanner(SplashXPath *xPathA, GBool eoA); - - ~SplashXPathScanner(); - - // Return the path's bounding box. - void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) - { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } - - // Return the path's bounding box. - void getBBoxAA(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA); - - // Return the min/max x values for the span at <y>. - void getSpanBounds(int y, int *spanXMin, int *spanXMax); - - // Returns true if (<x>,<y>) is inside the path. - GBool test(int x, int y); - - // Returns true if the entire span ([<x0>,<x1>], <y>) is inside the - // path. - GBool testSpan(int x0, int x1, int y); - - // Returns the next span inside the path at <y>. If <y> is - // different than the previous call to getNextSpan, this returns the - // first span at <y>; otherwise it returns the next span (relative - // to the previous call to getNextSpan). Returns false if there are - // no more spans at <y>. - GBool getNextSpan(int y, int *x0, int *x1); - - // Renders one anti-aliased line into <aaBuf>. Returns the min and - // max x coordinates with non-zero pixels in <x0> and <x1>. - void renderAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y); - - // Clips an anti-aliased line by setting pixels to zero. On entry, - // all non-zero pixels are between <x0> and <x1>. This function - // will update <x0> and <x1>. - void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y); - -private: - - void computeIntersections(int y); - - SplashXPath *xPath; - GBool eo; - int xMin, yMin, xMax, yMax; - - int interY; // current y value - int interIdx; // current index into <inter> - used by - // getNextSpan - int interCount; // current EO/NZWN counter - used by - // getNextSpan - int xPathIdx; // current index into <xPath> - used by - // computeIntersections - SplashIntersect *inter; // intersections array for <interY> - int interLen; // number of intersections in <inter> - int interSize; // size of the <inter> array -}; - -#endif |