[SkiaPath] Fixed an edge case DrawPath() excluded. For a pdf file that contains the same path more than once and when fill type was an even-odd type, the path's surrounding area is not filled if the path was drawn for an even number of times. To fix the issue, we need to make sure DrawChanged() return true when fill type is an even-odd type, since the number of the same path showing up will eventually affect the drawing result. Bug: pdfium:843 Change-Id: Iae9abcddd21180bd49742a02558a95f4506f3d4c Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56651 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 0f0e5d4..1d9b4d0 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp
@@ -304,6 +304,11 @@ : SkPath::kWinding_FillType; } +bool IsEvenOddFillType(SkPath::FillType fill) { + return fill == SkPath::kEvenOdd_FillType || + fill == SkPath::kInverseEvenOdd_FillType; +} + SkPath BuildPath(const CFX_PathData* pPathData) { SkPath skPath; const CFX_PathData* pFPath = pPathData; @@ -1120,9 +1125,9 @@ bool group_knockout) const { return MatrixChanged(pMatrix) || StateChanged(pState, m_drawState) || fill_color != m_fillColor || stroke_color != m_strokeColor || - IsAlternateFillMode(fill_mode) != - (m_skPath.getFillType() == SkPath::kEvenOdd_FillType) || - blend_type != m_blendType || group_knockout != m_groupKnockout; + IsEvenOddFillType(m_skPath.getFillType()) || + IsAlternateFillMode(fill_mode) || blend_type != m_blendType || + group_knockout != m_groupKnockout; } bool FontChanged(CFX_Font* pFont,