[poppler] 2 commits - poppler/SplashOutputDev.cc poppler/TextOutputDev.cc

2012-09-11 Thread Albert Astals Cid
 poppler/SplashOutputDev.cc |7 +--
 poppler/TextOutputDev.cc   |1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit cb93d51ccb6b1f6938946ae5d38fb9817005fd7a
Author: Albert Astals Cid 
Date:   Wed Sep 12 00:12:07 2012 +0200

Make gcc happy

It is stupid and can't see that we only use them when we init them and 
complains
they might be used un-initialized

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 1c1a348..452a5ac 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -277,6 +277,7 @@ void TextWord::addChar(GfxState *state, TextFontInfo 
*fontA, double x, double y,
   CharCode c, Unicode u) {
   GfxFont *gfxFont;
   double ascent, descent;
+  ascent = descent = 0; // make gcc happy
 
   if (len == size) {
 size += 16;
commit 3349a8dd7e0469cc5b5aaa8dd929c6078183ef86
Author: Thomas Freitag 
Date:   Wed Sep 12 00:04:45 2012 +0200

Splash: Avoid bogus memory error for tilingPattern

just return gFalse if the resulting
tiling pattern bitmap reaches a memory limit and so the Gfx implemention of
tiling patterns will be used. I think that this is an acceptable approach 
also
concerning performance, because it would take also a while to paint such a 
huge
bitmap and then draw it to splash.

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 05e9dea..a915f68 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -4084,6 +4084,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, 
Gfx *gfx1, Catalog *ca
   Matrix m1;
   double *ctm, savedCTM[6];
   double kx, ky, sx, sy;
+  GBool retValue = gFalse;
 
   width = bbox[2] - bbox[0];
   height = bbox[3] - bbox[1];
@@ -4143,6 +4144,8 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, 
Gfx *gfx1, Catalog *ca
 repeatX = x1 - x0;
 repeatY = y1 - y0;
   } else {
+if ((unsigned long) result_width * result_height > 0x80L)
+  return gFalse;
 while(fabs(kx) > 16384 || fabs(ky) > 16384) {
   // limit pattern bitmap size
   m1.m[0] /= 2;
@@ -4230,10 +4233,10 @@ GBool SplashOutputDev::tilingPatternFill(GfxState 
*state, Gfx *gfx1, Catalog *ca
   matc[1] = ctm[1];
   matc[2] = ctm[2];
   matc[3] = ctm[3];
-  splash->drawImage(&tilingBitmapSrc, &imgData, colorMode, gTrue, 
result_width, result_height, matc, gTrue);
+  retValue = splash->drawImage(&tilingBitmapSrc, &imgData, colorMode, gTrue, 
result_width, result_height, matc, gTrue) == splashOk;
   delete tBitmap;
   delete gfx;
-  return gTrue;
+  return retValue;
 }
 
 GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, 
GfxGouraudTriangleShading *shading)
___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


[poppler] 6 commits - CMakeLists.txt configure.ac cpp/Doxyfile glib/poppler-page.cc NEWS poppler/Makefile.am poppler/TextOutputDev.cc poppler/TextOutputDev.h qt4/src

2012-09-11 Thread Albert Astals Cid
 CMakeLists.txt   |4 
 NEWS |   13 ++
 configure.ac |2 
 cpp/Doxyfile |2 
 glib/poppler-page.cc |   49 +-
 poppler/Makefile.am  |2 
 poppler/TextOutputDev.cc |  230 ++-
 poppler/TextOutputDev.h  |   21 ++--
 qt4/src/Doxyfile |2 
 9 files changed, 168 insertions(+), 157 deletions(-)

New commits:
commit cb2ed646c4ef4161e443ee0a377db3be28ff
Merge: f3a1b76... 3ce4d21...
Author: Albert Astals Cid 
Date:   Tue Sep 11 19:29:19 2012 +0200

Merge remote-tracking branch 'origin/poppler-0.20'

diff --cc poppler/TextOutputDev.cc
index ca445ff,a9c9d70..1c1a348
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@@ -18,9 -18,9 +18,9 @@@
  // Copyright (C) 2006-2008, 2011 Carlos Garcia Campos 
  // Copyright (C) 2006, 2007 Ed Catmur 
  // Copyright (C) 2006 Jeff Muizelaar 
 -// Copyright (C) 2007, 2008 Adrian Johnson 
 +// Copyright (C) 2007, 2008, 2012 Adrian Johnson 
  // Copyright (C) 2008 Koji Otani 
- // Copyright (C) 2008, 2010, 2011 Albert Astals Cid 
+ // Copyright (C) 2008, 2010-2012 Albert Astals Cid 
  // Copyright (C) 2008 Pino Toscano 
  // Copyright (C) 2008, 2010 Hib Eris 
  // Copyright (C) 2009 Ross Moore 
commit f3a1b765bd6a58d327a80feedbe30e1c0792076e
Author: Jason Crain 
Date:   Tue Sep 11 19:28:28 2012 +0200

Allow multiple fonts in a TextWord

Bug #6923

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 8113e9c..fce173d 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1545,9 +1545,9 @@ poppler_text_attributes_new (void)
 }
 
 static gchar *
-get_font_name_from_word (TextWord *word)
+get_font_name_from_word (TextWord *word, gint word_i)
 {
-  GooString *font_name = word->getFontName();
+  GooString *font_name = word->getFontName(word_i);
   const gchar *name;
   gboolean subset;
   gint i;
@@ -1573,12 +1573,12 @@ get_font_name_from_word (TextWord *word)
  * Allocates a new PopplerTextAttributes with word attributes
  */
 static PopplerTextAttributes *
-poppler_text_attributes_new_from_word (TextWord *word)
+poppler_text_attributes_new_from_word (TextWord *word, gint i)
 {
   PopplerTextAttributes *attrs = poppler_text_attributes_new ();
   gdouble r, g, b;
 
-  attrs->font_name = get_font_name_from_word (word);
+  attrs->font_name = get_font_name_from_word (word, i);
   attrs->font_size = word->getFontSize();
   attrs->is_underlined = word->isUnderlined();
   word->getColor (&r, &g, &b);
@@ -2071,11 +2071,11 @@ poppler_page_free_text_attributes (GList *list)
 }
 
 static gboolean
-word_text_attributes_equal (TextWord *a, TextWord *b)
+word_text_attributes_equal (TextWord *a, gint ai, TextWord *b, gint bi)
 {
   double ar, ag, ab, br, bg, bb;
 
-  if (!a->getFontInfo()->matches (b->getFontInfo()))
+  if (!a->getFontInfo(ai)->matches (b->getFontInfo(bi)))
 return FALSE;
 
   if (a->getFontSize() != b->getFontSize())
@@ -2125,23 +2125,32 @@ poppler_page_get_text_attributes (PopplerPage *page)
   return NULL;
 }
 
+  TextWord *word, *prev_word = NULL;
+  gint word_i, prev_word_i;
+
   // Calculating each word attributes
   for (i = 0; i < wordlist->getLength (); i++)
 {
-  TextWord *word = wordlist->get (i);
-
-  // each char of the word has the same attributes
-  if (i > 0 && word_text_attributes_equal (word, wordlist->get (i - 1))) {
-attrs = previous;
-  } else {
-attrs = poppler_text_attributes_new_from_word (word);
-attrs->start_index = offset;
-if (previous)
-  previous->end_index--;
-previous = attrs;
-attributes = g_list_prepend (attributes, attrs);
-  }
-  offset += word->getLength () + 1;
+  word = wordlist->get (i);
+
+  for (word_i = 0; word_i < word->getLength (); word_i++)
+   {
+ if (prev_word && word_text_attributes_equal (word, word_i, prev_word, 
prev_word_i)) {
+   attrs = previous;
+ } else {
+   attrs = poppler_text_attributes_new_from_word (word, word_i);
+   attrs->start_index = offset;
+   if (previous)
+ previous->end_index--;
+   previous = attrs;
+   attributes = g_list_prepend (attributes, attrs);
+ }
+ offset++;
+ attrs->end_index = offset;
+ prev_word = word;
+ prev_word_i = word_i;
+   }
+  offset++;
   attrs->end_index = offset;
 }
   if (attrs)
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index adbb79f..ca445ff 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -29,6 +29,7 @@
 // Copyright (C) 2010 Suzuki Toshiya 
 // Copyright (C) 2011 Sam Liao 
 // Copyright (C) 2012 Horst Prote 
+// Copyright (C) 2012 Jason Crain 
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -234,104 +235,14 @@ GBoo

[poppler] Branch 'poppler-0.20' - 3 commits - NEWS poppler/TextOutputDev.cc

2012-09-11 Thread Albert Astals Cid
 NEWS |4 ++--
 poppler/TextOutputDev.cc |7 +--
 2 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 3ce4d213480471dfd8e307c24c99bf3c6308cd6f
Author: Albert Astals Cid 
Date:   Tue Sep 11 19:24:58 2012 +0200

Do not use isnan as it is C99

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 0795bb3..a9c9d70 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -20,7 +20,7 @@
 // Copyright (C) 2006 Jeff Muizelaar 
 // Copyright (C) 2007, 2008 Adrian Johnson 
 // Copyright (C) 2008 Koji Otani 
-// Copyright (C) 2008, 2010, 2011 Albert Astals Cid 
+// Copyright (C) 2008, 2010-2012 Albert Astals Cid 
 // Copyright (C) 2008 Pino Toscano 
 // Copyright (C) 2008, 2010 Hib Eris 
 // Copyright (C) 2009 Ross Moore 
@@ -2301,8 +2301,8 @@ void TextPage::addChar(GfxState *state, double x, double 
y,
   if (x1 + w1 < 0 || x1 > pageWidth ||
   y1 + h1 < 0 || y1 > pageHeight ||
   w1 > pageWidth || h1 > pageHeight ||
-  isnan(x1) || isnan(y1) ||
-  isnan(w1) || isnan(h1)) {
+  x1 != x1 || y1 != y1 || // IEEE way of checking for isnan
+  w1 != w1 || h1 != h1) {
 charPos += nBytes;
 return;
   }
commit 4d7a64a23fd4b4b5ee0d47ead8677f374aaaf6c9
Author: Jason Crain 
Date:   Tue Sep 11 19:24:11 2012 +0200

Check for NaN in TextPage::addChar

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index e8d993b..0795bb3 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -29,6 +29,7 @@
 // Copyright (C) 2010 Suzuki Toshiya 
 // Copyright (C) 2011 Sam Liao 
 // Copyright (C) 2012 Horst Prote 
+// Copyright (C) 2012 Jason Crain 
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -2299,7 +2300,9 @@ void TextPage::addChar(GfxState *state, double x, double 
y,
   state->transform(x, y, &x1, &y1);
   if (x1 + w1 < 0 || x1 > pageWidth ||
   y1 + h1 < 0 || y1 > pageHeight ||
-  w1 > pageWidth || h1 > pageHeight) {
+  w1 > pageWidth || h1 > pageHeight ||
+  isnan(x1) || isnan(y1) ||
+  isnan(w1) || isnan(h1)) {
 charPos += nBytes;
 return;
   }
commit 5f338ea7d01cabc0f8c50690d0bc262d85baa0ed
Author: Albert Astals Cid 
Date:   Mon Sep 10 19:47:20 2012 +0200

Fix typo

diff --git a/NEWS b/NEWS
index f73dac0..2e874b9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 Release 0.20.4
 core:
- * Improvements regarding embeddef file handling. (KDE Bug #306008)
+ * Improvements regarding embedded file handling. (KDE Bug #306008)
  * Fix opening some broken files (Bug #14303)
  * Fix memory leaks
  * Fix crashes in various broken files
@@ -9,7 +9,7 @@ Release 0.20.4
  * Remove execution permissions from a header file
 
 qt4:
- * Improvements regarding embeddef file handling. (KDE Bug #306008)
+ * Improvements regarding embedded file handling. (KDE Bug #306008)
 
 Release 0.20.3
 core:
___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


[poppler] qt4/src

2012-09-11 Thread Albert Astals Cid
 qt4/src/poppler-annotation-private.h |3 +
 qt4/src/poppler-annotation.cc|   99 ++-
 qt4/src/poppler-annotation.h |   68 +++-
 3 files changed, 168 insertions(+), 2 deletions(-)

New commits:
commit e79b70ec13ab4d2cce8f245d150fa9329b436658
Author: Tobias Koenig 
Date:   Tue Sep 11 16:39:55 2012 +0200

Make 'additional actions' available in Annotation API of Qt4 frontend

Bug #53589

diff --git a/qt4/src/poppler-annotation-private.h 
b/qt4/src/poppler-annotation-private.h
index 2ee7d77..68c1b8e 100644
--- a/qt4/src/poppler-annotation-private.h
+++ b/qt4/src/poppler-annotation-private.h
@@ -31,6 +31,7 @@
 
 class Annot;
 class AnnotPath;
+class Link;
 class Page;
 class PDFRectangle;
 
@@ -100,6 +101,8 @@ class AnnotationPrivate : public QSharedData
 static void removeAnnotationFromPage(::Page *pdfPage, const Annotation 
* ann);
 
 Ref pdfObjectReference() const;
+
+Link* additionalAction( Annotation::AdditionalActionsType type ) const;
 };
 
 }
diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index d4f12d4..c93c5b7 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -3,6 +3,7 @@
  * Copyright (C) 2006, 2008, 2010 Pino Toscano 
  * Copyright (C) 2012, Guillermo A. Amaral B. 
  * Copyright (C) 2012, Fabio D'Urso 
+ * Copyright (C) 2012, Tobias Koenig 
  * Adapting code from
  *   Copyright (C) 2004 by Enrico Ros 
  *
@@ -42,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Almost all getters directly query the underlying poppler annotation, with
  * the exceptions of link, file attachment, sound, movie and screen 
annotations,
@@ -455,7 +457,8 @@ QList 
AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD
 case Annot::typeUnknown:
 continue; // special case for ignoring unknown annotations
 case Annot::typeWidget:
-continue; // handled as forms or some other way
+annotation = new WidgetAnnotation();
+break;
 default:
 {
 #define CASE_FOR_TYPE( thetype ) \
@@ -493,6 +496,42 @@ Ref AnnotationPrivate::pdfObjectReference() const
 return pdfAnnot->getRef();
 }
 
+Link* AnnotationPrivate::additionalAction( Annotation::AdditionalActionsType 
type ) const
+{
+if ( pdfAnnot->getType() != Annot::typeScreen && pdfAnnot->getType() != 
Annot::typeWidget )
+return 0;
+
+Annot::AdditionalActionsType actionType = Annot::actionCursorEntering;
+switch ( type )
+{
+case Annotation::CursorEnteringAction: actionType = 
Annot::actionCursorEntering; break;
+case Annotation::CursorLeavingAction: actionType = 
Annot::actionCursorLeaving; break;
+case Annotation::MousePressedAction: actionType = 
Annot::actionMousePressed; break;
+case Annotation::MouseReleasedAction: actionType = 
Annot::actionMouseReleased; break;
+case Annotation::FocusInAction: actionType = Annot::actionFocusIn; 
break;
+case Annotation::FocusOutAction: actionType = Annot::actionFocusOut; 
break;
+case Annotation::PageOpeningAction: actionType = 
Annot::actionPageOpening; break;
+case Annotation::PageClosingAction: actionType = 
Annot::actionPageClosing; break;
+case Annotation::PageVisibleAction: actionType = 
Annot::actionPageVisible; break;
+case Annotation::PageInvisibleAction: actionType = 
Annot::actionPageInvisible; break;
+}
+
+::LinkAction *linkAction = 0;
+if ( pdfAnnot->getType() == Annot::typeScreen )
+linkAction = static_cast( pdfAnnot 
)->getAdditionalAction( actionType );
+else
+linkAction = static_cast( pdfAnnot 
)->getAdditionalAction( actionType );
+
+Link *link = 0;
+
+if ( linkAction )
+link = PageData::convertLinkActionToLink( linkAction, parentDoc, 
QRectF() );
+
+delete linkAction;
+
+return link;
+}
+
 void AnnotationPrivate::addAnnotationToPage(::Page *pdfPage, DocumentData 
*doc, const Annotation * ann)
 {
 if (ann->d_ptr->pdfAnnot != 0)
@@ -4261,6 +4300,64 @@ void ScreenAnnotation::setScreenTitle( const QString 
&title )
 d->title = title;
 }
 
+Link* ScreenAnnotation::additionalAction( AdditionalActionsType type ) const
+{
+Q_D( const ScreenAnnotation );
+return d->additionalAction( type );
+}
+
+/** WidgetAnnotation [Annotation] */
+class WidgetAnnotationPrivate : public AnnotationPrivate
+{
+public:
+Annotation * makeAlias();
+Annot* createNativeAnnot(::Page *destPage, DocumentData *doc);
+};
+
+Annotation * WidgetAnnotationPrivate::makeAlias()
+{
+return new WidgetAnnotation(*this);
+}
+
+Annot* WidgetAnnotationPrivate::createNativeAnnot(::Page *destPage, 
DocumentData *doc)
+{
+return 0; // Not implemented
+}
+
+WidgetAnnotation::WidgetAnnotation(WidgetAnnotationPrivate &dd)
+: Annotation( dd )
+{}
+
+WidgetAnnotation::WidgetAnnotatio