[poppler] 2 commits - qt4/src splash/Splash.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Feb 23 14:52:08 PST 2013


 qt4/src/poppler-page.cc |    5 ++++-
 qt4/src/poppler-qt4.h   |    6 ++++--
 splash/Splash.cc        |   14 +++++++++++---
 3 files changed, 19 insertions(+), 6 deletions(-)

New commits:
commit be5d9af38655496a2eaa4eb12cea84461c5aeb3f
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Sat Feb 23 23:41:46 2013 +0100

    expose thin line modes in qt frontend

diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index 7c47573..b5f0a8a 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -294,6 +294,9 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
       }
  
       GBool AA = m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse;
+      SplashThinLineMode thinLineMode = splashThinLineDefault;
+      if (m_page->parentDoc->m_hints & Document::ThinLineShape) thinLineMode = splashThinLineShape;
+      if (m_page->parentDoc->m_hints & Document::ThinLineSolid) thinLineMode = splashThinLineSolid;
 
       SplashOutputDev * splash_output = new SplashOutputDev(
 #if defined(SPLASH_CMYK)
@@ -301,7 +304,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
 #else
                       splashModeXBGR8,
 #endif 
-                      4, gFalse, bgColor, gTrue, AA, splashThinLineDefault, overprint);
+                      4, gFalse, bgColor, gTrue, AA, thinLineMode, overprint);
 
       splash_output->setVectorAntialias(m_page->parentDoc->m_hints & Document::Antialiasing ? gTrue : gFalse);
       splash_output->setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? gTrue : gFalse, 
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index f4f6fc6..1e3efca 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -13,7 +13,7 @@
  * Copyright (C) 2012, Fabio D'Urso <fabiodurso at hotmail.it>
  * Copyright (C) 2012, Tobias Koenig <tobias.koenig at kdab.com>
  * Copyright (C) 2012 Adam Reichold <adamreichold at myopera.com>
- * Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+ * Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -848,7 +848,9 @@ delete it;
 	    TextAntialiasing = 0x00000002,  ///< Antialiasing for text
 	    TextHinting = 0x00000004,       ///< Hinting for text \since 0.12.1
 	    TextSlightHinting = 0x00000008, ///< Lighter hinting for text when combined with TextHinting \since 0.18
-	    OverprintPreview = 0x00000010   ///< Overprint preview \since 0.22
+	    OverprintPreview = 0x00000010,  ///< Overprint preview \since 0.22
+	    ThinLineSolid = 0x00000020,     ///< Enhance thin lines solid \since 0.24
+	    ThinLineShape = 0x00000040      ///< Enhance thin lines shape. Wins over ThinLineSolid \since 0.24
 	};
 	Q_DECLARE_FLAGS( RenderHints, RenderHint )
 
commit f96cbacfdbc97ace35f843854992f06e9322f485
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Sat Feb 23 23:39:52 2013 +0100

    Refine splashThinLineShape support

diff --git a/splash/Splash.cc b/splash/Splash.cc
index 3a355b8..bc8c62d 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -2456,9 +2456,17 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo,
 	if (clipRes != splashClipAllInside) {
 	  state->clip->clipAALine(aaBuf, &x0, &x1, y, thinLineMode != splashThinLineDefault && xMinI == xMaxI);
 	}
-	drawAALine(&pipe, x0, x1, y,
-		thinLineMode == splashThinLineShape && (xMinI == xMaxI || yMinI == yMaxI), 
-		clip255(splashRound(state->lineWidth * 255)));     
+	Guchar lineShape = 255;
+	GBool adjustLine = gFalse;
+	if (thinLineMode == splashThinLineShape && (xMinI == xMaxI || yMinI == yMaxI)) {
+	  // compute line shape for thin lines:
+	  SplashCoord mx, my, delta;
+	  transform(state->matrix, 0, 0, &mx, &my);
+	  transform(state->matrix, state->lineWidth, 0, &delta, &my);
+	  adjustLine = gTrue;
+	  lineShape = clip255((delta - mx) * 255);
+	}
+	drawAALine(&pipe, x0, x1, y, adjustLine, lineShape);
       }
     } else {
       for (y = yMinI; y <= yMaxI; ++y) {


More information about the poppler mailing list