[poppler] 3 commits - glib/poppler-page.cc poppler/CairoOutputDev.cc poppler/CairoOutputDev.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 21 17:49:58 UTC 2019


 glib/poppler-page.cc      |    4 +-
 poppler/CairoOutputDev.cc |   92 +++++++++++++++++++++++-----------------------
 poppler/CairoOutputDev.h  |    4 +-
 3 files changed, 50 insertions(+), 50 deletions(-)

New commits:
commit 9de727a969896c5b43f2370c1fb3a1a011bc7ee3
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 21 19:41:30 2019 +0200

    glib: Rename variable to make it more clear what it is
    
    also fixes shadow warning

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 134557e0..8b5b4da0 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -2257,9 +2257,9 @@ poppler_page_get_text_layout_for_area (PopplerPage       *page,
 
           if (j < line_words->size() - 1)
             {
-              TextWordSelection *word_sel = (*line_words)[j + 1];
+              TextWordSelection *next_word_sel = (*line_words)[j + 1];
 
-              word_sel->getWord()->getBBox(&x3, &y3, &x4, &y4);
+              next_word_sel->getWord()->getBBox(&x3, &y3, &x4, &y4);
 	      // space is from one word to other and with the same height as
 	      // first word.
 	      rect->x1 = x2;
commit 7095bc54cd3d11356870be48c10946dc55c350a8
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 21 19:29:57 2019 +0200

    CairoOuputDev: Rename some input variables
    
    Fixes shadow warnings and in some cases makes for better C++ code not using this->

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 09b81b01..68927636 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -87,12 +87,12 @@
 // CairoImage
 //------------------------------------------------------------------------
 
-CairoImage::CairoImage (double x1, double y1, double x2, double y2) {
-  this->image = nullptr;
-  this->x1 = x1;
-  this->y1 = y1;
-  this->x2 = x2;
-  this->y2 = y2;
+CairoImage::CairoImage (double x1A, double y1A, double x2A, double y2A) {
+  image = nullptr;
+  x1 = x1A;
+  y1 = y1A;
+  x2 = x2A;
+  y2 = y2A;
 }
 
 CairoImage::~CairoImage () {
@@ -100,10 +100,10 @@ CairoImage::~CairoImage () {
     cairo_surface_destroy (image);
 }
 
-void CairoImage::setImage (cairo_surface_t *image) {
-  if (this->image)
-    cairo_surface_destroy (this->image);
-  this->image = cairo_surface_reference (image);
+void CairoImage::setImage (cairo_surface_t *i) {
+  if (image)
+    cairo_surface_destroy (image);
+  image = cairo_surface_reference (i);
 }
 
 //------------------------------------------------------------------------
@@ -193,25 +193,25 @@ CairoOutputDev::~CairoOutputDev() {
     delete actualText;  
 }
 
-void CairoOutputDev::setCairo(cairo_t *cairo)
+void CairoOutputDev::setCairo(cairo_t *c)
 {
-  if (this->cairo != nullptr) {
-    cairo_status_t status = cairo_status (this->cairo);
+  if (cairo != nullptr) {
+    cairo_status_t status = cairo_status (cairo);
     if (status) {
       error(errInternal, -1, "cairo context error: {0:s}\n", cairo_status_to_string(status));
     }
-    cairo_destroy (this->cairo);
+    cairo_destroy (cairo);
     assert(!cairo_shape);
   }
-  if (cairo != nullptr) {
-    this->cairo = cairo_reference (cairo);
+  if (c != nullptr) {
+    cairo = cairo_reference (c);
 	/* save the initial matrix so that we can use it for type3 fonts. */
 	//XXX: is this sufficient? could we miss changes to the matrix somehow?
 	cairo_get_matrix(cairo, &orig_matrix);
 	setContextAntialias(cairo, antialias);
   } else {
-    this->cairo = nullptr;
-    this->cairo_shape = nullptr;
+    cairo = nullptr;
+    cairo_shape = nullptr;
   }
 }
 
@@ -231,9 +231,9 @@ void CairoOutputDev::setTextPage(TextPage *text)
   }
 }
 
-void CairoOutputDev::setAntialias(cairo_antialias_t antialias)
+void CairoOutputDev::setAntialias(cairo_antialias_t a)
 {
-  this->antialias = antialias;
+  antialias = a;
   if (cairo)
     setContextAntialias (cairo, antialias);
   if (cairo_shape)
@@ -751,11 +751,11 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do
 
 #undef STROKE_COORD_TOLERANCE
 
-void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) {
+void CairoOutputDev::doPath(cairo_t *c, GfxState *state, GfxPath *path) {
   GfxSubpath *subpath;
   int i, j;
   double x, y;
-  cairo_new_path (cairo);
+  cairo_new_path (c);
   for (i = 0; i < path->getNumSubpaths(); ++i) {
     subpath = path->getSubpath(i);
     if (subpath->getNumPoints() > 0) {
@@ -765,7 +765,7 @@ void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) {
         x = subpath->getX(0);
         y = subpath->getY(0);
       }
-      cairo_move_to (cairo, x, y);
+      cairo_move_to (c, x, y);
       j = 1;
       while (j < subpath->getNumPoints()) {
 	if (subpath->getCurve(j)) {
@@ -775,7 +775,7 @@ void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) {
             x = subpath->getX(j+2);
             y = subpath->getY(j+2);
           }
-	  cairo_curve_to( cairo,
+	  cairo_curve_to( c,
 			  subpath->getX(j), subpath->getY(j),
 			  subpath->getX(j+1), subpath->getY(j+1),
 			  x, y);
@@ -788,13 +788,13 @@ void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) {
             x = subpath->getX(j);
             y = subpath->getY(j);
           }
-          cairo_line_to (cairo, x, y);
+          cairo_line_to (c, x, y);
 	  ++j;
 	}
       }
       if (subpath->isClosed()) {
 	LOG (printf ("close\n"));
-	cairo_close_path (cairo);
+	cairo_close_path (c);
       }
     }
   }
commit e62c83a88fec28aec9bdcdb210abcd8d84034c7b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 21 19:22:32 2019 +0200

    rename text member to textPage
    
    reflects better what it is and fixes several shadow warnings

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index d2769a22..09b81b01 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -161,7 +161,7 @@ CairoOutputDev::CairoOutputDev() {
   cairo_shape = nullptr;
   knockoutCount = 0;
 
-  text = nullptr;
+  textPage = nullptr;
   actualText = nullptr;
 
   // the SA parameter supposedly defaults to false, but Acrobat
@@ -187,8 +187,8 @@ CairoOutputDev::~CairoOutputDev() {
     cairo_pattern_destroy (mask);
   if (shape)
     cairo_pattern_destroy (shape);
-  if (text) 
-    text->decRefCnt();
+  if (textPage)
+    textPage->decRefCnt();
   if (actualText)
     delete actualText;  
 }
@@ -217,16 +217,16 @@ void CairoOutputDev::setCairo(cairo_t *cairo)
 
 void CairoOutputDev::setTextPage(TextPage *text)
 {
-  if (this->text) 
-    this->text->decRefCnt();
+  if (textPage)
+    textPage->decRefCnt();
   if (actualText)
     delete actualText;
   if (text) {
-    this->text = text;
-    this->text->incRefCnt();
+    textPage = text;
+    textPage->incRefCnt();
     actualText = new ActualText(text);
   } else {
-    this->text = nullptr;
+    textPage = nullptr;
     actualText = nullptr;
   }
 }
@@ -276,17 +276,17 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
   stroke_pattern = cairo_pattern_reference(fill_pattern);
   stroke_color.r = stroke_color.g = stroke_color.b = 0;
 
-  if (text)
-    text->startPage(state);
+  if (textPage)
+    textPage->startPage(state);
   if (xrefA != nullptr) {
     xref = xrefA;
   }
 }
 
 void CairoOutputDev::endPage() {
-  if (text) {
-    text->endPage();
-    text->coalesce(true, 0, false);
+  if (textPage) {
+    textPage->endPage();
+    textPage->coalesce(true, 0, false);
   }
 }
 
@@ -354,8 +354,8 @@ void CairoOutputDev::updateAll(GfxState *state) {
   updateStrokeOpacity(state);
   updateBlendMode(state);
   needFontUpdate = true;
-  if (text)
-    text->updateFont(state);
+  if (textPage)
+    textPage->updateFont(state);
 }
 
 void CairoOutputDev::setDefaultCTM(const double *ctm) {
@@ -659,8 +659,8 @@ void CairoOutputDev::updateFont(GfxState *state) {
   needFontUpdate = false;
 
   //FIXME: use cairo font engine?
-  if (text)
-    text->updateFont(state);
+  if (textPage)
+    textPage->updateFont(state);
   
   currentFont = fontEngine->getFont (state->getFont(), doc, printing, xref);
 
@@ -1423,7 +1423,7 @@ void CairoOutputDev::drawChar(GfxState *state, double x, double y,
     }
   }
 
-  if (!text)
+  if (!textPage)
     return;
   actualText->addChar (state, x, y, dx, dy, code, nBytes, u, uLen);
 }
@@ -1580,13 +1580,13 @@ void CairoOutputDev::endTextObject(GfxState *state) {
 
 void CairoOutputDev::beginActualText(GfxState *state, const GooString *text)
 {
-  if (this->text)
+  if (textPage)
     actualText->begin(state, text);
 }
 
 void CairoOutputDev::endActualText(GfxState *state)
 {
-  if (text)
+  if (textPage)
     actualText->end(state);
 }
 
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index b59a9e2e..0fbbf0d5 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -23,7 +23,7 @@
 // Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2016 Jason Crain <jason at aquaticape.us>
-// Copyright (C) 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2018, 2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by the LiMux project of the city of Munich
 //
 // To see a description of the changes please see the Changelog file that
@@ -347,7 +347,7 @@ protected:
   cairo_antialias_t antialias;
   bool prescaleImages;
 
-  TextPage *text;		// text for the current page
+  TextPage *textPage;		// text for the current page
   ActualText *actualText;
 
   cairo_pattern_t *group;


More information about the poppler mailing list