File indexing completed on 2025-12-11 10:26:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef SPLASHXPATHSCANNER_H
0024 #define SPLASHXPATHSCANNER_H
0025
0026 #include "SplashTypes.h"
0027
0028 #include <poppler-config.h>
0029
0030 #ifdef USE_BOOST_HEADERS
0031 # include <boost/container/small_vector.hpp>
0032 #endif
0033
0034 #include <vector>
0035
0036 class SplashXPath;
0037 class SplashBitmap;
0038
0039 struct SplashIntersect
0040 {
0041 int y;
0042 int x0, x1;
0043 int count;
0044 };
0045
0046
0047
0048
0049
0050 class SplashXPathScanner
0051 {
0052 public:
0053
0054 SplashXPathScanner(const SplashXPath &xPath, bool eoA, int clipYMin, int clipYMax);
0055
0056 ~SplashXPathScanner();
0057
0058 SplashXPathScanner(const SplashXPathScanner &) = delete;
0059 SplashXPathScanner &operator=(const SplashXPathScanner &) = delete;
0060
0061
0062 void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) const
0063 {
0064 *xMinA = xMin;
0065 *yMinA = yMin;
0066 *xMaxA = xMax;
0067 *yMaxA = yMax;
0068 }
0069
0070
0071 void getBBoxAA(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) const;
0072
0073
0074
0075 bool hasPartialClip() const { return partialClip; }
0076
0077
0078 void getSpanBounds(int y, int *spanXMin, int *spanXMax) const;
0079
0080
0081 bool test(int x, int y) const;
0082
0083
0084
0085 bool testSpan(int x0, int x1, int y) const;
0086
0087
0088
0089 void renderAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, bool adjustVertLine = false) const;
0090
0091
0092
0093
0094 void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y) const;
0095
0096 private:
0097 void computeIntersections(const SplashXPath &xPath);
0098 bool addIntersection(double segYMin, double segYMax, int y, int x0, int x1, int count);
0099
0100 bool eo;
0101 int xMin, yMin, xMax, yMax;
0102 bool partialClip;
0103
0104 #ifdef USE_BOOST_HEADERS
0105 typedef boost::container::small_vector<SplashIntersect, 4> IntersectionLine;
0106 #else
0107 typedef std::vector<SplashIntersect> IntersectionLine;
0108 #endif
0109 std::vector<IntersectionLine> allIntersections;
0110
0111 friend class SplashXPathScanIterator;
0112 };
0113
0114 class SplashXPathScanIterator
0115 {
0116 public:
0117 SplashXPathScanIterator(const SplashXPathScanner &scanner, int y);
0118
0119
0120
0121 bool getNextSpan(int *x0, int *x1);
0122
0123 private:
0124 #ifdef USE_BOOST_HEADERS
0125 typedef boost::container::small_vector<SplashIntersect, 4> IntersectionLine;
0126 #else
0127 typedef std::vector<SplashIntersect> IntersectionLine;
0128 #endif
0129 const IntersectionLine &line;
0130
0131 size_t interIdx;
0132 int interCount;
0133 const bool eo;
0134 };
0135
0136 #endif