Change the parameter type for DrawFillStrokePath() and DrawCosmeticLine().
In class CFX_RenderDevice, replace integer parameter |fill_mode| with
struct CFX_FillRenderOptions |fill_options| for DrawFillStrokePath()
and DrawCosmeticLine() as the input of fill rendering options.
Bug: pdfium:1531
Change-Id: I5d66e6bd3a33bfdde83c2afc0ac1b813a4bad5f6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/71090
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Hui Yingst <nigi@chromium.org>
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 6e23dde..6325048 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -542,8 +542,7 @@
pos1 = pObject2Device->Transform(pos1);
pos2 = pObject2Device->Transform(pos2);
}
- DrawCosmeticLine(pos1, pos2, fill_color,
- GetIntegerFlagsFromFillOptions(fill_options), blend_type);
+ DrawCosmeticLine(pos1, pos2, fill_color, fill_options, blend_type);
return true;
}
@@ -629,7 +628,8 @@
blend_type);
}
return DrawFillStrokePath(pPathData, pObject2Device, pGraphState,
- fill_color, stroke_color, fill_mode, blend_type);
+ fill_color, stroke_color, fill_options,
+ blend_type);
}
return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState,
fill_color, stroke_color, fill_mode,
@@ -637,13 +637,14 @@
}
// This can be removed once PDFium entirely relies on Skia
-bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- BlendMode blend_type) {
+bool CFX_RenderDevice::DrawFillStrokePath(
+ const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ const CFX_FillRenderOptions& fill_options,
+ BlendMode blend_type) {
if (!(m_RenderCaps & FXRC_GET_BITS))
return false;
CFX_FloatRect bbox;
@@ -681,8 +682,8 @@
matrix = *pObject2Device;
matrix.Translate(-rect.left, -rect.top);
if (!bitmap_device.GetDeviceDriver()->DrawPath(
- pPathData, &matrix, pGraphState, fill_color, stroke_color, fill_mode,
- blend_type)) {
+ pPathData, &matrix, pGraphState, fill_color, stroke_color,
+ GetIntegerFlagsFromFillOptions(fill_options), blend_type)) {
return false;
}
#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
@@ -719,11 +720,12 @@
return true;
}
-bool CFX_RenderDevice::DrawCosmeticLine(const CFX_PointF& ptMoveTo,
- const CFX_PointF& ptLineTo,
- uint32_t color,
- int fill_mode,
- BlendMode blend_type) {
+bool CFX_RenderDevice::DrawCosmeticLine(
+ const CFX_PointF& ptMoveTo,
+ const CFX_PointF& ptLineTo,
+ uint32_t color,
+ const CFX_FillRenderOptions& fill_options,
+ BlendMode blend_type) {
if ((color >= 0xff000000) && m_pDeviceDriver->DrawCosmeticLine(
ptMoveTo, ptLineTo, color, blend_type)) {
return true;
@@ -733,7 +735,8 @@
path.AppendPoint(ptMoveTo, FXPT_TYPE::MoveTo);
path.AppendPoint(ptLineTo, FXPT_TYPE::LineTo);
return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color,
- fill_mode, blend_type);
+ GetIntegerFlagsFromFillOptions(fill_options),
+ blend_type);
}
bool CFX_RenderDevice::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index da49838..fe2c5dd 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -235,12 +235,12 @@
const CFX_GraphStateData* pGraphState,
uint32_t fill_color,
uint32_t stroke_color,
- int fill_mode,
+ const CFX_FillRenderOptions& fill_options,
BlendMode blend_type);
bool DrawCosmeticLine(const CFX_PointF& ptMoveTo,
const CFX_PointF& ptLineTo,
uint32_t color,
- int fill_mode,
+ const CFX_FillRenderOptions& fill_options,
BlendMode blend_type);
bool FillRectWithBlend(const FX_RECT& rect,
uint32_t color,