[poppler] 5 commits - utils/HtmlOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Apr 25 11:45:41 PDT 2013


 utils/HtmlOutputDev.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5e9654a3eb28b2c8b0985545778dd0e45829f8e1
Merge: eeecd97 a107428
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Apr 25 20:45:34 2013 +0200

    Merge remote-tracking branch 'origin/poppler-0.22'
    
    Conflicts:
    	poppler/Gfx.h

commit a107428e7db0c420b60418a33b9f815909ac9a33
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Apr 25 20:44:36 2013 +0200

    Update my C of the last two previous commits

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index ae103aa..2945234 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
-// Copyright (C) 2005-2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Thorkild Stray <thorkild at ifi.uio.no>
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006-2011 Carlos Garcia Campos <carlosgc at gnome.org>
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 0704597..9798f90 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -17,7 +17,7 @@
 // Copyright (C) 2007 Iñigo Martínez <inigomartinez at gmail.com>
 // Copyright (C) 2008 Brad Hards <bradh at kde.org>
 // Copyright (C) 2008, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
-// Copyright (C) 2009-2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009-2013 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009, 2010, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2010 David Benjamin <davidben at mit.edu>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 8fd2dd1..9eaab42 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -17,7 +17,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005-2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Kjartan Maraas <kmaraas at gnome.org>
 // Copyright (C) 2008 Boris Toloknov <tlknv at yandex.ru>
 // Copyright (C) 2008 Haruyuki Kawabe <Haruyuki.Kawabe at unisys.co.jp>
commit ec298b3b780f885464aa00880150eaa2b9b50b08
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Apr 25 20:29:24 2013 +0200

    Do not start drawing a form we are already drawing
    
    Bug #63190

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 7047482..ae103aa 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4133,10 +4133,25 @@ void Gfx::opXObject(Object args[], int numArgs) {
     }
   } else if (obj2.isName("Form")) {
     res->lookupXObjectNF(name, &refObj);
-    if (out->useDrawForm() && refObj.isRef()) {
-      out->drawForm(refObj.getRef());
-    } else {
-      doForm(&obj1);
+    GBool shouldDoForm = gTrue;
+    std::set<int>::iterator drawingFormIt;
+    if (refObj.isRef()) {
+      const int num = refObj.getRef().num;
+      if (formsDrawing.find(num) == formsDrawing.end()) {
+	drawingFormIt = formsDrawing.insert(num).first;
+      } else {
+	shouldDoForm = gFalse;	
+      }
+    }
+    if (shouldDoForm) {
+      if (out->useDrawForm() && refObj.isRef()) {
+	out->drawForm(refObj.getRef());
+      } else {
+	doForm(&obj1);
+      }
+    }
+    if (refObj.isRef() && shouldDoForm) {
+      formsDrawing.erase(drawingFormIt);
     }
     refObj.free();
   } else if (obj2.isName("PS")) {
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 7c42f14..0704597 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -225,6 +225,8 @@ private:
   MarkedContentStack *mcStack;	// current BMC/EMC stack
 
   Parser *parser;		// parser for page content stream(s)
+  
+  std::set<int> formsDrawing;	// the forms that are being drawn
 
 #ifdef USE_CMS
   PopplerCache iccColorSpaceCache;
commit 11ab42e7e90099d0cebf8f02197413fd5dee044b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Apr 25 20:27:43 2013 +0200

    Make sure getKids returns != 0 before using it
    
    Fixes crash in bug #63909

diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index a718380..8fd2dd1 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -1795,7 +1795,7 @@ GBool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, GooList *outlines, Catalo
 		atLeastOne = gTrue;
 
 		item->open();
-		if (item->hasKids())
+		if (item->hasKids() && item->getKids())
 		{
 			fputs("\n",output);
 			newHtmlOutlineLevel(output, item->getKids(), catalog, level+1);
@@ -1832,7 +1832,7 @@ void HtmlOutputDev::newXmlOutlineLevel(FILE *output, GooList *outlines, Catalog*
         delete titleStr;
 
         item->open();
-        if (item->hasKids())
+        if (item->hasKids() && item->getKids())
         {
             newXmlOutlineLevel(output, item->getKids(), catalog);
         }
commit 4ee78e77f7d6cadc8e150ceff96b546ddca329d4
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sat Apr 20 16:41:56 2013 +0200

    cairo: Always use the trasnfer function if present in setSoftMask
    
    "If the subtype is Alpha, the transparency group XObject G shall be
    evaluated to compute a group alpha only. The colours of the constituent
    objects shall be ignored and the colour compositing computations shall
    not be performed. The transfer function TR shall then be applied to the
    computed group alpha to produce the mask values."
    
    We were using the transfer function only for luminosity soft masks.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=63587

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index b18e703..a27559e 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1552,7 +1552,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha,
 
   LOG(printf ("set softMask\n"));
 
-  if (alpha == false) {
+  if (!alpha || transferFunc) {
     /* We need to mask according to the luminocity of the group.
      * So we paint the group to an image surface convert it to a luminocity map
      * and then use that as the mask. */
@@ -1595,13 +1595,15 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha,
     cairo_t *maskCtx = cairo_create(source);
 
     //XXX: hopefully this uses the correct color space */
-    GfxRGB backdropColorRGB;
-    groupColorSpaceStack->cs->getRGB(backdropColor, &backdropColorRGB);
-    /* paint the backdrop */
-    cairo_set_source_rgb(maskCtx,
-			 colToDbl(backdropColorRGB.r),
-			 colToDbl(backdropColorRGB.g),
-			 colToDbl(backdropColorRGB.b));
+    if (!alpha) {
+      GfxRGB backdropColorRGB;
+      groupColorSpaceStack->cs->getRGB(backdropColor, &backdropColorRGB);
+      /* paint the backdrop */
+      cairo_set_source_rgb(maskCtx,
+                           colToDbl(backdropColorRGB.r),
+                           colToDbl(backdropColorRGB.g),
+                           colToDbl(backdropColorRGB.b));
+    }
     cairo_paint(maskCtx);
 
     /* Copy source ctm to mask ctm and translate origin so that the
@@ -1628,15 +1630,14 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha,
     int stride = cairo_image_surface_get_stride(source)/4;
     for (int y=0; y<height; y++) {
       for (int x=0; x<width; x++) {
-	int lum;
-	lum = luminocity(source_data[y*stride + x]);
-	if (transferFunc) {
-	  double lum_in, lum_out;
-	  lum_in = lum/256.0;
-	  transferFunc->transform(&lum_in, &lum_out);
-	  lum = (int)(lum_out * 255.0 + 0.5);
-	}
-	source_data[y*stride + x] = lum << 24;
+	int lum = alpha ? fill_opacity : luminocity(source_data[y*stride + x]);
+        if (transferFunc) {
+          double lum_in, lum_out;
+          lum_in = lum/256.0;
+          transferFunc->transform(&lum_in, &lum_out);
+          lum = (int)(lum_out * 255.0 + 0.5);
+        }
+        source_data[y*stride + x] = lum << 24;
       }
     }
     cairo_surface_mark_dirty (source);
@@ -1656,7 +1657,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha,
     }
 
     cairo_surface_destroy(source);
-  } else {
+  } else if (alpha) {
     mask = cairo_pattern_reference(group);
     cairo_get_matrix(cairo, &mask_matrix);
   }


More information about the poppler mailing list