[poppler] qt5/src
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Oct 22 21:28:13 UTC 2017
qt5/src/ArthurOutputDev.cc | 14 ++++++++++++++
qt5/src/ArthurOutputDev.h | 9 +++++++++
2 files changed, 23 insertions(+)
New commits:
commit e0926ca8a94bafa6d5bfd694064c5e30da2b79db
Author: Oliver Sander <oliver.sander at tu-dresden.de>
Date: Thu Oct 5 18:32:40 2017 +0200
Properly implement saveState / restoreState
Not all of the internal state was actually saved/restored in
those methods, which lead to inconsistencies between the
ArthurOutputDev state and the GfxState object.
Bug #103118
diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc
index f199e656..3be12672 100644
--- a/qt5/src/ArthurOutputDev.cc
+++ b/qt5/src/ArthurOutputDev.cc
@@ -137,12 +137,26 @@ void ArthurOutputDev::endPage() {
void ArthurOutputDev::saveState(GfxState *state)
{
+ m_currentPenStack.push(m_currentPen);
+ m_currentBrushStack.push(m_currentBrush);
+ m_rawFontStack.push(m_rawFont);
+ m_codeToGIDStack.push(m_codeToGID);
+
m_painter->save();
}
void ArthurOutputDev::restoreState(GfxState *state)
{
m_painter->restore();
+
+ m_codeToGID = m_codeToGIDStack.top();
+ m_codeToGIDStack.pop();
+ m_rawFont = m_rawFontStack.top();
+ m_rawFontStack.pop();
+ m_currentBrush = m_currentBrushStack.top();
+ m_currentBrushStack.pop();
+ m_currentPen = m_currentPenStack.top();
+ m_currentPenStack.pop();
}
void ArthurOutputDev::updateAll(GfxState *state)
diff --git a/qt5/src/ArthurOutputDev.h b/qt5/src/ArthurOutputDev.h
index 496f5a72..480c7827 100644
--- a/qt5/src/ArthurOutputDev.h
+++ b/qt5/src/ArthurOutputDev.h
@@ -36,6 +36,7 @@
#include <memory>
#include <map>
+#include <stack>
#include "goo/gtypes.h"
#include "OutputDev.h"
@@ -172,14 +173,21 @@ public:
private:
QPainter *m_painter;
FontHinting m_fontHinting;
+
QPen m_currentPen;
+ // The various stacks are used to implement the 'saveState' and 'restoreState' methods
+ std::stack<QPen> m_currentPenStack;
+
QBrush m_currentBrush;
+ std::stack<QBrush> m_currentBrushStack;
+
GBool m_needFontUpdate; // set when the font needs to be updated
SplashFontEngine *m_fontEngine;
XRef *xref; // xref table for current document
// The current font in use
QRawFont* m_rawFont;
+ std::stack<QRawFont*> m_rawFontStack;
// Identify a font by its 'Ref' and its font size
struct ArthurFontID
@@ -199,6 +207,7 @@ private:
// The table that maps character codes to glyph indexes
int* m_codeToGID;
+ std::stack<int*> m_codeToGIDStack;
};
#endif
More information about the poppler
mailing list