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.
diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc
index a58fd29..a4c2e73 100644
--- a/splash/SplashClip.cc
+++ b/splash/SplashClip.cc
@@ -406,3 +406,18 @@
}
}
}
+
+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 a6ab187..77b5e6c 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 @@
// 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 @@
SplashClip(SplashClip *clip);
void grow(int nPaths);
+ bool testClipPaths(int x, int y);
bool antialias;
SplashCoord xMin, yMin, xMax, yMax;