Drawing fake bold text, line and normal text made normal text bolder on PDF.
When PDF uses fake bold text, it uses stroke and fill for the
text. After that, line is drawn. It creates new ContextEntry which
GraphicStateEntry has 0 fTextScaleX. Since fTextScaleX is 0,
GraphicStackState::updateDrawingState() doesn't update text fill mode or
the PDF page. When the normal text is drawn, it reuse the line's
ContextEntry because GraphicStateEntry::compareInitialState() returns
true. However, since the reused GraphicsStateEntry's fTextScaleX is 0,
the text fill mode is not updated to fill, and the text is drawn in
stroke and fill mode.
When the fTextScaleX is changed, we should not reuse GraphicStateEntry
even if ether of fTextScaleX is 0.
BUG=skia:2132
R=reed@google.com, vandebo@chromium.org, bungeman@google.com
Author: yuki.sekiguchi@access-company.com
Review URL: https://codereview.chromium.org/137923005
git-svn-id: http://skia.googlecode.com/svn/trunk@13369 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 0f0c38c..d227dd7 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -232,15 +232,14 @@
fMatrix.reset();
}
-bool GraphicStateEntry::compareInitialState(const GraphicStateEntry& b) {
- return fColor == b.fColor &&
- fShaderIndex == b.fShaderIndex &&
- fGraphicStateIndex == b.fGraphicStateIndex &&
- fMatrix == b.fMatrix &&
- fClipStack == b.fClipStack &&
- (fTextScaleX == 0 ||
- b.fTextScaleX == 0 ||
- (fTextScaleX == b.fTextScaleX && fTextFill == b.fTextFill));
+bool GraphicStateEntry::compareInitialState(const GraphicStateEntry& cur) {
+ return fColor == cur.fColor &&
+ fShaderIndex == cur.fShaderIndex &&
+ fGraphicStateIndex == cur.fGraphicStateIndex &&
+ fMatrix == cur.fMatrix &&
+ fClipStack == cur.fClipStack &&
+ (fTextScaleX == 0 ||
+ (fTextScaleX == cur.fTextScaleX && fTextFill == cur.fTextFill));
}
class GraphicStackState {