diff options
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | poppler/poppler-config.h.cmake | 6 | ||||
-rw-r--r-- | splash/SplashXPathScanner.cc | 2 | ||||
-rw-r--r-- | splash/SplashXPathScanner.h | 14 |
4 files changed, 35 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7001544c..edcc5a23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,6 +286,14 @@ if(LCMS2_FOUND) include_directories(SYSTEM ${LCMS2_INCLUDE_DIR}) endif() +if(ENABLE_SPLASH) + find_package(Boost 1.58.0) + if(Boost_FOUND) + include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) + set(USE_BOOST_HEADERS ON) + endif() +endif() + # Recent versions of poppler-data install a .pc file. # Use it to determine the encoding data path, if available. # Default to the same prefix otherwise. @@ -730,6 +738,7 @@ show_end_message_yesno("use nss3" ENABLE_NSS3) show_end_message_yesno("use curl" ENABLE_LIBCURL) show_end_message_yesno("use libopenjpeg2" WITH_OPENJPEG) show_end_message_yesno("use lcms2" USE_CMS) +show_end_message_yesno("use boost" Boost_FOUND) show_end_message_yesno("command line utils" ENABLE_UTILS) show_end_message_yesno("fuzz target" ENABLE_FUZZER) show_end_message("test data dir" ${TESTDATADIR}) @@ -762,6 +771,10 @@ if(NOT HAVE_JPX_DECODER) message("Warning: You're not compiling any JPX decoder. Some files will fail to display properly.") endif() +if(ENABLE_SPLASH AND NOT Boost_FOUND) + message("Warning: Use of boost is recommended for better performance.") +endif() + set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${POPPLER_VERSION}) add_custom_target(dist COMMAND diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake index f0a5a1a0..746d8630 100644 --- a/poppler/poppler-config.h.cmake +++ b/poppler/poppler-config.h.cmake @@ -18,6 +18,7 @@ // Copyright (C) 2016 Tor Lillqvist <tml@collabora.com> // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de> +// Copyright (C) 2018 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.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 @@ -115,6 +116,11 @@ #cmakedefine USE_CMS 1 #endif +/* Use header-only classes from Boost in the Splash backend */ +#ifndef USE_BOOST_HEADERS +#cmakedefine USE_BOOST_HEADERS 1 +#endif + //------------------------------------------------------------------------ // version //------------------------------------------------------------------------ diff --git a/splash/SplashXPathScanner.cc b/splash/SplashXPathScanner.cc index e8abe94c..042a6ef6 100644 --- a/splash/SplashXPathScanner.cc +++ b/splash/SplashXPathScanner.cc @@ -344,9 +344,11 @@ bool SplashXPathScanner::addIntersection(double segYMin, double segYMax, } auto& line = allIntersections[y - yMin]; +#ifndef USE_BOOST_HEADERS if (line.empty()) { line.reserve(4); } +#endif line.push_back(intersect); return true; diff --git a/splash/SplashXPathScanner.h b/splash/SplashXPathScanner.h index 1ac8ce84..88b9d8c9 100644 --- a/splash/SplashXPathScanner.h +++ b/splash/SplashXPathScanner.h @@ -25,6 +25,12 @@ #include "SplashTypes.h" +#include <poppler-config.h> + +#ifdef USE_BOOST_HEADERS +#include <boost/container/small_vector.hpp> +#endif + #include <vector> class SplashXPath; @@ -94,7 +100,11 @@ private: int xMin, yMin, xMax, yMax; bool partialClip; +#ifdef USE_BOOST_HEADERS + typedef boost::container::small_vector<SplashIntersect, 4> IntersectionLine; +#else typedef std::vector<SplashIntersect> IntersectionLine; +#endif std::vector<IntersectionLine> allIntersections; friend class SplashXPathScanIterator; @@ -109,7 +119,11 @@ public: bool getNextSpan(int *x0, int *x1); private: +#ifdef USE_BOOST_HEADERS + typedef boost::container::small_vector<SplashIntersect, 4> IntersectionLine; +#else typedef std::vector<SplashIntersect> IntersectionLine; +#endif const IntersectionLine &line; size_t interIdx; // current index into <line> |