diff options
author | Albert Astals Cid <aacid@kde.org> | 2009-08-01 15:13:35 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2009-08-01 15:13:35 +0200 |
commit | 173451730948c320f16a0f5924a58302603eca0b (patch) | |
tree | 600b539516ffb679301eeef351ec6b9224f22314 | |
parent | 35c408ca49be08144bcf14aa112505fd556725d2 (diff) |
Try to workaround some incorrect PDF
Fixes rendering of PDF where forms/patterns have more q than Q. Fixes
rendering in splash of pdf in bugs #22835, #21899 and #16402
-rw-r--r-- | poppler/Gfx.cc | 13 | ||||
-rw-r--r-- | poppler/GfxState.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index eeefcac0..ccf818a4 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -4274,8 +4274,21 @@ void Gfx::doForm1(Object *str, Dict *resDict, double *matrix, double *bbox, baseMatrix[i] = state->getCTM()[i]; } + GfxState *stateBefore = state; + // draw the form display(str, gFalse); + + if (stateBefore != state) { + if (state->isParentState(stateBefore)) { + error(-1, "There's a form with more q than Q, trying to fix"); + while (stateBefore != state) { + restoreState(); + } + } else { + error(-1, "There's a form with more Q than q"); + } + } if (softMask || transpGroup) { out->endTransparencyGroup(state); diff --git a/poppler/GfxState.h b/poppler/GfxState.h index 536c86ad..51a317d3 100644 --- a/poppler/GfxState.h +++ b/poppler/GfxState.h @@ -1269,6 +1269,7 @@ public: GfxState *save(); GfxState *restore(); GBool hasSaves() { return saved != NULL; } + GBool isParentState(GfxState *state) { return saved == state || (saved && saved->isParentState(state)); } // Misc GBool parseBlendMode(Object *obj, GfxBlendMode *mode); |