summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorStefan Brüns <stefan.bruens@rwth-aachen.de>2019-10-07 20:46:33 +0200
committerStefan Brüns <stefan.bruens@rwth-aachen.de>2019-10-07 20:46:33 +0200
commit194e57f21e6a7fe2a5eb3cf687599978b09e03f9 (patch)
tree049da7cabd6d2e45f510c854cb2317dca5879321 /splash
parent9d875adabdc94f50de78d72528d373b46a8ed280 (diff)
Move the non-trivial part of the clip test to the implementation file
This allows to only have a SplashXPathScanner forward declaration in the header file.
Diffstat (limited to 'splash')
-rw-r--r--splash/SplashClip.cc15
-rw-r--r--splash/SplashClip.h21
2 files changed, 18 insertions, 18 deletions
diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc
index a58fd29e..a4c2e73e 100644
--- a/splash/SplashClip.cc
+++ b/splash/SplashClip.cc
@@ -406,3 +406,18 @@ void SplashClip::clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, bool a
}
}
}
+
+bool SplashClip::testClipPaths(int x, int y) {
+ if (antialias) {
+ x *= splashAASize;
+ y *= splashAASize;
+ }
+
+ for (int i = 0; i < length; ++i) {
+ if (!scanners[i]->test(x, y)) {
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/splash/SplashClip.h b/splash/SplashClip.h
index a6ab1870..77b5e6c3 100644
--- a/splash/SplashClip.h
+++ b/splash/SplashClip.h
@@ -23,10 +23,10 @@
#define SPLASHCLIP_H
#include "SplashTypes.h"
-#include "SplashXPathScanner.h"
class SplashPath;
class SplashXPath;
+class SplashXPathScanner;
class SplashBitmap;
//------------------------------------------------------------------------
@@ -72,29 +72,13 @@ public:
// Returns true if (<x>,<y>) is inside the clip.
bool test(int x, int y)
{
- int i;
-
// check the rectangle
if (x < xMinI || x > xMaxI || y < yMinI || y > yMaxI) {
return false;
}
// check the paths
- if (antialias) {
- for (i = 0; i < length; ++i) {
- if (!scanners[i]->test(x * splashAASize, y * splashAASize)) {
- return false;
- }
- }
- } else {
- for (i = 0; i < length; ++i) {
- if (!scanners[i]->test(x, y)) {
- return false;
- }
- }
- }
-
- return true;
+ return testClipPaths(x, y);
}
// Tests a rectangle against the clipping region. Returns one of:
@@ -137,6 +121,7 @@ protected:
SplashClip(SplashClip *clip);
void grow(int nPaths);
+ bool testClipPaths(int x, int y);
bool antialias;
SplashCoord xMin, yMin, xMax, yMax;