[SkiaPath] Fix issue with missing line.
In bug_1296.pdf, the green line wasn't drawn because in
CFX_SkiaDeviceDriver::DrawPath(), when painting a stroke, the check for
"fill_mode & FX_ZEROAREA_FILL" is always true, and the function exited
and skipped drawing process. Also CFX_SkiaDeviceDriver was missing
CFX_SkiaDeviceDriver::GetDriverType(), which resulted in the
discrepancy of the second input for CFX_SkiaDeviceDriver::DrawPath()
when drawing a stroke.
To fix it, need to make CFX_SkiaDeviceDriver::DrawPath() have the same
order of condition checks as CFX_AggDeviceDriver::DrawPath() and the
same input values.
Bug:pdfium:1296
Change-Id: Ie4c318bcf547603edde47a138b48d7a9bd021ff7
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55722
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 1d9b4d0..21ce1f7 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1709,6 +1709,10 @@
return true;
}
+int CFX_SkiaDeviceDriver::GetDriverType() const {
+ return 1;
+}
+
DeviceType CFX_SkiaDeviceDriver::GetDeviceType() const {
return DeviceType::kDisplay;
}
@@ -1940,9 +1944,6 @@
BlendMode blend_type) {
ASSERT(GetAlternateOrWindingFillMode(fill_mode) !=
kAlternateOrWindingFillModeMask);
-
- if (fill_mode & FX_ZEROAREA_FILL)
- return true;
if (m_pCache->DrawPath(pPathData, pObject2Device, pGraphState, fill_color,
stroke_color, fill_mode, blend_type)) {
return true;
@@ -1957,7 +1958,7 @@
if (fill_mode & FXFILL_FULLCOVER)
skPaint.setBlendMode(SkBlendMode::kPlus);
int stroke_alpha = FXARGB_A(stroke_color);
- bool is_paint_stroke = !!(pGraphState && stroke_alpha);
+ bool is_paint_stroke = pGraphState && stroke_alpha;
if (is_paint_stroke)
PaintStroke(&skPaint, pGraphState, skMatrix);
SkPath skPath = BuildPath(pPathData);
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index a4d83ad..2571769 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -138,6 +138,8 @@
float font_size,
uint32_t color) override;
+ int GetDriverType() const override;
+
bool DrawShading(const CPDF_ShadingPattern* pPattern,
const CFX_Matrix* pMatrix,
const FX_RECT& clip_rect,