[poppler] 3 commits - poppler/CairoOutputDev.cc regtest/TestReferences.py regtest/TestRun.py

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Jan 2 02:09:18 PST 2016


 poppler/CairoOutputDev.cc |   49 +++++++++++++++++++++-------------------------
 regtest/TestReferences.py |   27 ++++++++++++++++---------
 regtest/TestRun.py        |    2 -
 3 files changed, 42 insertions(+), 36 deletions(-)

New commits:
commit 00422d0c6baaba639fa0660e3a933cdb76b28f88
Author: Jason Crain <jason at aquaticape.us>
Date:   Sun Dec 20 09:54:43 2015 -0600

    cairo: use shape mask with soft mask
    
    Clear target with the shape mask whether the soft mask is set or not.
    Propagate the shape up to any higher level groups and destroy the
    shape pattern when done.
    
    Fix a memory leak by removing a call to 'cairo_reference (cairo_shape)'.
    We already keep track of the lifetime of cairo_shape using
    knockoutCount.
    
    bug 91931

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index d06f3c7..d0d6cb4 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1597,8 +1597,6 @@ void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbo
       cairo_get_matrix (cairo, &matrix);
       //printMatrix(&matrix);
       cairo_set_matrix (cairo_shape, &matrix);
-    } else {
-      cairo_reference (cairo_shape);
     }
   }
   if (groupColorSpaceStack->next && groupColorSpaceStack->next->knockout) {
@@ -1638,33 +1636,22 @@ void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, double * /*bbo
 
   cairo_save (cairo);
   cairo_set_matrix (cairo, &groupColorSpaceStack->group_matrix);
-  cairo_set_source (cairo, group);
-
-  if (!mask) {
-    //XXX: deal with mask && shape case
-    if (shape) {
-      cairo_save (cairo);
-
-      /* OPERATOR_SOURCE w/ a mask is defined as (src IN mask) ADD (dest OUT mask)
-       * however our source has already been clipped to mask so we only need to
-       * do ADD and OUT */
 
-      /* clear the shape mask */
-      cairo_set_source (cairo, shape);
-      cairo_set_operator (cairo, CAIRO_OPERATOR_DEST_OUT);
-      cairo_paint (cairo);
-
-      cairo_set_operator (cairo, CAIRO_OPERATOR_ADD);
-      cairo_set_source (cairo, group);
-      cairo_paint (cairo);
+  if (shape) {
+    /* OPERATOR_SOURCE w/ a mask is defined as (src IN mask) ADD (dest OUT mask)
+     * however our source has already been clipped to mask so we only need to
+     * do ADD and OUT */
 
-      cairo_restore (cairo);
+    /* clear the shape mask */
+    cairo_set_source (cairo, shape);
+    cairo_set_operator (cairo, CAIRO_OPERATOR_DEST_OUT);
+    cairo_paint (cairo);
+    cairo_set_operator (cairo, CAIRO_OPERATOR_ADD);
+  }
+  cairo_set_source (cairo, group);
 
-      cairo_pattern_destroy (shape);
-      shape = NULL;
-    } else {
-      cairo_paint_with_alpha (cairo, fill_opacity);
-    }
+  if (!mask) {
+    cairo_paint_with_alpha (cairo, fill_opacity);
     cairo_status_t status = cairo_status(cairo);
     if (status)
       printf("BAD status: %s\n", cairo_status_to_string(status));
@@ -1684,6 +1671,16 @@ void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, double * /*bbo
     mask = NULL;
   }
 
+  if (shape) {
+    if (cairo_shape) {
+      cairo_set_source (cairo_shape, shape);
+      cairo_paint (cairo_shape);
+      cairo_set_source_rgb (cairo_shape, 0, 0, 0);
+    }
+    cairo_pattern_destroy (shape);
+    shape = NULL;
+  }
+
   popTransparencyGroup();
   cairo_restore(cairo);
 }
commit bc4cab272e4fe28b836cb2ef1ff672f0d79d243c
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sat Jan 2 09:49:27 2016 +0100

    regtest: Fix the number of worker threads spawned reported in log of run-tests command

diff --git a/regtest/TestRun.py b/regtest/TestRun.py
index 95f28b4..e344cc7 100644
--- a/regtest/TestRun.py
+++ b/regtest/TestRun.py
@@ -215,7 +215,7 @@ class TestRun:
         self.printer.printout_ln()
 
         if n_workers > 0:
-            self.printer.printout('Spawning %d workers...' % (self.config.threads))
+            self.printer.printout('Spawning %d workers...' % (n_workers))
 
             for n_thread in range(n_workers):
                 thread = Thread(target=self._worker_thread)
commit ea75de614e666d8235c38048585315e0d7ff5522
Author: Adam Reichold <adam.reichold at t-online.de>
Date:   Sat Jan 2 09:48:03 2016 +0100

    regtest: Limit the number of worker threads to the number of documents to create references
    
    The same way we do for the run-tests command.

diff --git a/regtest/TestReferences.py b/regtest/TestReferences.py
index 4eeb330..e70896f 100644
--- a/regtest/TestReferences.py
+++ b/regtest/TestReferences.py
@@ -100,19 +100,28 @@ class TestReferences:
         backends = self._get_backends()
         self._total_tests = total_docs * len(backends)
 
+        if total_docs == 1:
+            n_workers = 0
+        else:
+            n_workers = min(self.config.threads, total_docs)
+
         self.printer.printout_ln('Found %d documents' % (total_docs))
         self.printer.printout_ln('Backends: %s' % ', '.join([backend.get_name() for backend in backends]))
-        self.printer.printout_ln('Process %d using %d worker threads' % (os.getpid(), self.config.threads))
+        self.printer.printout_ln('Process %d using %d worker threads' % (os.getpid(), n_workers))
         self.printer.printout_ln()
 
-        self.printer.printout('Spawning %d workers...' % (self.config.threads))
+        if n_workers > 0:
+            self.printer.printout('Spawning %d workers...' % (n_workers))
 
-        for n_thread in range(self.config.threads):
-            thread = Thread(target=self._worker_thread)
-            thread.daemon = True
-            thread.start()
+            for n_thread in range(n_workers):
+                thread = Thread(target=self._worker_thread)
+                thread.daemon = True
+                thread.start()
 
-        for doc in docs:
-            self._queue.put(doc)
+            for doc in docs:
+                self._queue.put(doc)
 
-        self._queue.join()
+            self._queue.join()
+        else:
+            for doc in docs:
+                self.create_refs_for_file(doc)


More information about the poppler mailing list