Change parameter type for CFX_PSRenderer::DrawPath().
To avoid bitwise operations, use a struct CFX_FillRenderOptions
|fill_options| as the input of fill rendering options instead of
the integer parameter |fill_mode| for CFX_PSRenderer::DrawPath().
Bug: pdfium:1531
Change-Id: I29d96896c8a157e5fd2f655a8adb0d6eadfe8e1b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/71330
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index bc67e62..5c80646 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -198,7 +198,7 @@
const CFX_GraphStateData* pGraphState,
uint32_t fill_color,
uint32_t stroke_color,
- int fill_mode) {
+ const CFX_FillRenderOptions& fill_options) {
StartRendering();
int fill_alpha = FXARGB_A(fill_color);
int stroke_alpha = FXARGB_A(stroke_color);
@@ -221,14 +221,16 @@
}
OutputPath(pPathData, stroke_alpha ? nullptr : pObject2Device);
- if (fill_mode && fill_alpha) {
+ if (fill_options.fill_type != CFX_FillRenderOptions::FillType::kNoFill &&
+ fill_alpha) {
SetColor(fill_color);
- if ((fill_mode & 3) == FXFILL_WINDING) {
+ if (fill_options.fill_type == CFX_FillRenderOptions::FillType::kWinding) {
if (stroke_alpha)
m_pStream->WriteString("q f Q ");
else
m_pStream->WriteString("f");
- } else if ((fill_mode & 3) == FXFILL_ALTERNATE) {
+ } else if (fill_options.fill_type ==
+ CFX_FillRenderOptions::FillType::kEvenOdd) {
if (stroke_alpha)
m_pStream->WriteString("q F Q ");
else
diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h
index 2b179c0..86a1767 100644
--- a/core/fxge/win32/cfx_psrenderer.h
+++ b/core/fxge/win32/cfx_psrenderer.h
@@ -75,7 +75,7 @@
const CFX_GraphStateData* pGraphState,
uint32_t fill_color,
uint32_t stroke_color,
- int fill_mode);
+ const CFX_FillRenderOptions& fill_options);
bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap,
uint32_t color,
int dest_left,
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index 1ddb881..3be1a24 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -456,8 +456,7 @@
if (blend_type != BlendMode::kNormal)
return false;
return m_PSRenderer.DrawPath(pPathData, pObject2Device, pGraphState,
- fill_color, stroke_color,
- static_cast<int>(fill_options.fill_type));
+ fill_color, stroke_color, fill_options);
}
bool CPSPrinterDriver::GetClipBox(FX_RECT* pRect) {