Remove CFX_RenderDevice::DrawPathWithBlend()
Since all of its callers pass in BlendMode::kNormal, merge it into
DrawPath(), and change all the variables for the blend mode to
BlendMode::kNormal.
Change-Id: Ib1499841b4bb71b6c6814294a3751221d20042e4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/123832
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 2082fc7..de97aa8 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -430,15 +430,15 @@
: 0;
uint32_t stroke_argb = stroke ? GetStrokeArgb(path_obj) : 0;
CFX_Matrix path_matrix = path_obj->matrix() * mtObj2Device;
- if (!IsAvailableMatrix(path_matrix))
+ if (!IsAvailableMatrix(path_matrix)) {
return true;
+ }
- return m_pDevice->DrawPathWithBlend(
+ return m_pDevice->DrawPath(
*path_obj->path().GetObject(), &path_matrix,
path_obj->graph_state().GetObject(), fill_argb, stroke_argb,
GetFillOptionsForDrawPathWithBlend(options, path_obj, fill_type, stroke,
- m_pType3Char),
- BlendMode::kNormal);
+ m_pType3Char));
}
RetainPtr<CPDF_TransferFunc> CPDF_RenderStatus::GetTransferFunc(
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 2bb4680..02bae8d 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -603,18 +603,6 @@
uint32_t fill_color,
uint32_t stroke_color,
const CFX_FillRenderOptions& fill_options) {
- return DrawPathWithBlend(path, pObject2Device, pGraphState, fill_color,
- stroke_color, fill_options, BlendMode::kNormal);
-}
-
-bool CFX_RenderDevice::DrawPathWithBlend(
- const CFX_Path& path,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- const CFX_FillRenderOptions& fill_options,
- BlendMode blend_type) {
const bool fill =
fill_options.fill_type != CFX_FillRenderOptions::FillType::kNoFill;
uint8_t fill_alpha = fill ? FXARGB_A(fill_color) : 0;
@@ -627,7 +615,7 @@
pos1 = pObject2Device->Transform(pos1);
pos2 = pObject2Device->Transform(pos2);
}
- DrawCosmeticLine(pos1, pos2, fill_color, fill_options, blend_type);
+ DrawCosmeticLine(pos1, pos2, fill_color, fill_options, BlendMode::kNormal);
return true;
}
@@ -671,8 +659,9 @@
--rect_i.bottom;
}
}
- if (FillRectWithBlend(rect_i, fill_color, blend_type))
+ if (FillRectWithBlend(rect_i, fill_color, BlendMode::kNormal)) {
return true;
+ }
}
}
@@ -686,7 +675,7 @@
// Process the existing sub path.
DrawZeroAreaPath(sub_path, pObject2Device, adjust,
fill_options.aliased_path, fill_color, fill_alpha,
- blend_type);
+ BlendMode::kNormal);
sub_path.clear();
// Start forming the next sub path.
@@ -708,7 +697,7 @@
// Process the last sub paths.
DrawZeroAreaPath(sub_path, pObject2Device, adjust,
fill_options.aliased_path, fill_color, fill_alpha,
- blend_type);
+ BlendMode::kNormal);
}
if (fill && fill_alpha && stroke_alpha < 0xff && fill_options.stroke) {
@@ -720,7 +709,7 @@
}
bool draw_fillstroke_path_result = m_pDeviceDriver->DrawPath(
path, pObject2Device, pGraphState, fill_color, stroke_color,
- fill_options, blend_type);
+ fill_options, BlendMode::kNormal);
if (using_skia) {
// Restore the group knockout status for `m_pDeviceDriver` after
@@ -731,11 +720,11 @@
}
#endif // defined(PDF_USE_SKIA)
return DrawFillStrokePath(path, pObject2Device, pGraphState, fill_color,
- stroke_color, fill_options, blend_type);
+ stroke_color, fill_options, BlendMode::kNormal);
}
return m_pDeviceDriver->DrawPath(path, pObject2Device, pGraphState,
fill_color, stroke_color, fill_options,
- blend_type);
+ BlendMode::kNormal);
}
// This can be removed once PDFium entirely relies on Skia
@@ -1280,14 +1269,14 @@
options.fill_type = CFX_FillRenderOptions::FillType::kWinding;
}
options.text_mode = true;
- if (!DrawPathWithBlend(transformed_path, pUser2Device, pGraphState,
- fill_color, stroke_color, options,
- BlendMode::kNormal)) {
+ if (!DrawPath(transformed_path, pUser2Device, pGraphState, fill_color,
+ stroke_color, options)) {
return false;
}
}
- if (pClippingPath)
+ if (pClippingPath) {
pClippingPath->Append(transformed_path, pUser2Device);
+ }
}
return true;
}
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index b7f991f..be76077 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -82,13 +82,6 @@
uint32_t fill_color,
uint32_t stroke_color,
const CFX_FillRenderOptions& fill_options);
- bool DrawPathWithBlend(const CFX_Path& path,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- const CFX_FillRenderOptions& fill_options,
- BlendMode blend_type);
bool FillRect(const FX_RECT& rect, uint32_t color) {
return FillRectWithBlend(rect, color, BlendMode::kNormal);
}