Commit e0926ca8 authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid
Browse files

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
parent ebf6d1ca
......@@ -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)
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment