[poppler] 2 commits - poppler/SplashOutputDev.cc splash/SplashClip.cc splash/SplashClip.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 7 21:09:37 UTC 2019


 poppler/SplashOutputDev.cc |    1 +
 splash/SplashClip.cc       |   16 ++++++++++++++++
 splash/SplashClip.h        |   22 +++-------------------
 3 files changed, 20 insertions(+), 19 deletions(-)

New commits:
commit 194e57f21e6a7fe2a5eb3cf687599978b09e03f9
Author: Stefan Brüns <stefan.bruens at rwth-aachen.de>
Date:   Mon Oct 7 20:46:33 2019 +0200

    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 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;
commit 9d875adabdc94f50de78d72528d373b46a8ed280
Author: Stefan Brüns <stefan.bruens at rwth-aachen.de>
Date:   Mon Oct 7 19:57:32 2019 +0200

    Include SplashMath.h only where needed

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 440ee307..214302a7 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -74,6 +74,7 @@
 #include "splash/SplashFont.h"
 #include "splash/SplashFontFile.h"
 #include "splash/SplashFontFileID.h"
+#include "splash/SplashMath.h"
 #include "splash/Splash.h"
 #include "SplashOutputDev.h"
 #include <algorithm>
diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc
index 8a07f24f..a58fd29e 100644
--- a/splash/SplashClip.cc
+++ b/splash/SplashClip.cc
@@ -25,6 +25,7 @@
 #include <string.h>
 #include "goo/gmem.h"
 #include "SplashErrorCodes.h"
+#include "SplashMath.h"
 #include "SplashPath.h"
 #include "SplashXPath.h"
 #include "SplashXPathScanner.h"
diff --git a/splash/SplashClip.h b/splash/SplashClip.h
index ddc48974..a6ab1870 100644
--- a/splash/SplashClip.h
+++ b/splash/SplashClip.h
@@ -23,7 +23,6 @@
 #define SPLASHCLIP_H
 
 #include "SplashTypes.h"
-#include "SplashMath.h"
 #include "SplashXPathScanner.h"
 
 class SplashPath;


More information about the poppler mailing list