Simplify RenderDeviceDriverIface::FillRectWithBlend()
Rename it to FillRect() and remove the BlendMode parameter, which always
gets the same value.
Change-Id: If2d054780b57e0bcac42bc9cc5f61cce6cfde2e4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/123836
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/core/fxge/agg/cfx_agg_devicedriver.cpp b/core/fxge/agg/cfx_agg_devicedriver.cpp
index 60393f7..850a003 100644
--- a/core/fxge/agg/cfx_agg_devicedriver.cpp
+++ b/core/fxge/agg/cfx_agg_devicedriver.cpp
@@ -1185,20 +1185,17 @@
return true;
}
-bool CFX_AggDeviceDriver::FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type) {
- if (blend_type != BlendMode::kNormal)
- return false;
-
- if (m_pBitmap->GetBuffer().empty())
+bool CFX_AggDeviceDriver::FillRect(const FX_RECT& rect, uint32_t fill_color) {
+ if (m_pBitmap->GetBuffer().empty()) {
return true;
+ }
FX_RECT clip_rect = GetClipBox();
FX_RECT draw_rect = clip_rect;
draw_rect.Intersect(rect);
- if (draw_rect.IsEmpty())
+ if (draw_rect.IsEmpty()) {
return true;
+ }
if (!m_pClipRgn || m_pClipRgn->GetType() == CFX_AggClipRgn::kRectI) {
if (m_bRgbByteOrder) {
diff --git a/core/fxge/agg/cfx_agg_devicedriver.h b/core/fxge/agg/cfx_agg_devicedriver.h
index 792e75e..4d97dbd 100644
--- a/core/fxge/agg/cfx_agg_devicedriver.h
+++ b/core/fxge/agg/cfx_agg_devicedriver.h
@@ -59,9 +59,7 @@
uint32_t stroke_color,
const CFX_FillRenderOptions& fill_options,
BlendMode blend_type) override;
- bool FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type) override;
+ bool FillRect(const FX_RECT& rect, uint32_t fill_color) override;
FX_RECT GetClipBox() const override;
bool GetDIBits(RetainPtr<CFX_DIBitmap> bitmap,
int left,
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 9d82bea..0923300 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -780,8 +780,7 @@
}
bool CFX_RenderDevice::FillRect(const FX_RECT& rect, uint32_t fill_color) {
- if (m_pDeviceDriver->FillRectWithBlend(rect, fill_color,
- BlendMode::kNormal)) {
+ if (m_pDeviceDriver->FillRect(rect, fill_color)) {
return true;
}
diff --git a/core/fxge/renderdevicedriver_iface.cpp b/core/fxge/renderdevicedriver_iface.cpp
index c13e2ec..766e7fb 100644
--- a/core/fxge/renderdevicedriver_iface.cpp
+++ b/core/fxge/renderdevicedriver_iface.cpp
@@ -24,9 +24,8 @@
void RenderDeviceDriverIface::SetBaseClip(const FX_RECT& rect) {}
-bool RenderDeviceDriverIface::FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type) {
+bool RenderDeviceDriverIface::FillRect(const FX_RECT& rect,
+ uint32_t fill_color) {
return false;
}
diff --git a/core/fxge/renderdevicedriver_iface.h b/core/fxge/renderdevicedriver_iface.h
index 16e501c..4fefa5a 100644
--- a/core/fxge/renderdevicedriver_iface.h
+++ b/core/fxge/renderdevicedriver_iface.h
@@ -79,9 +79,7 @@
uint32_t stroke_color,
const CFX_FillRenderOptions& fill_options,
BlendMode blend_type) = 0;
- virtual bool FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type);
+ virtual bool FillRect(const FX_RECT& rect, uint32_t fill_color);
virtual bool DrawCosmeticLine(const CFX_PointF& ptMoveTo,
const CFX_PointF& ptLineTo,
uint32_t color);
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index e155fb4..55356f8 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1149,13 +1149,10 @@
return true;
}
-bool CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type) {
+bool CFX_SkiaDeviceDriver::FillRect(const FX_RECT& rect, uint32_t fill_color) {
SkPaint spaint;
spaint.setAntiAlias(true);
spaint.setColor(fill_color);
- spaint.setBlendMode(GetSkiaBlendMode(blend_type));
SkRect srect = SkRect::MakeLTRB(rect.left, std::min(rect.top, rect.bottom),
rect.right, std::max(rect.bottom, rect.top));
DebugShowSkiaDrawRect(this, m_pCanvas, spaint, srect);
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index 4a3b1a5..1214877 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -64,9 +64,7 @@
uint32_t stroke_color,
const CFX_FillRenderOptions& fill_options,
BlendMode blend_type) override;
- bool FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type) override;
+ bool FillRect(const FX_RECT& rect, uint32_t fill_color) override;
FX_RECT GetClipBox() const override;
bool GetDIBits(RetainPtr<CFX_DIBitmap> bitmap,
int left,
diff --git a/core/fxge/win32/cgdi_device_driver.cpp b/core/fxge/win32/cgdi_device_driver.cpp
index fe0cfe4..bcb8cbd 100644
--- a/core/fxge/win32/cgdi_device_driver.cpp
+++ b/core/fxge/win32/cgdi_device_driver.cpp
@@ -706,20 +706,17 @@
return true;
}
-bool CGdiDeviceDriver::FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type) {
- if (blend_type != BlendMode::kNormal)
- return false;
-
+bool CGdiDeviceDriver::FillRect(const FX_RECT& rect, uint32_t fill_color) {
int alpha;
FX_COLORREF colorref;
std::tie(alpha, colorref) = ArgbToAlphaAndColorRef(fill_color);
- if (alpha == 0)
+ if (alpha == 0) {
return true;
+ }
- if (alpha < 255)
+ if (alpha < 255) {
return false;
+ }
HBRUSH hBrush = CreateSolidBrush(colorref);
const RECT* pRect = reinterpret_cast<const RECT*>(&rect);
diff --git a/core/fxge/win32/cgdi_device_driver.h b/core/fxge/win32/cgdi_device_driver.h
index 6b9bdf9..e4971dd 100644
--- a/core/fxge/win32/cgdi_device_driver.h
+++ b/core/fxge/win32/cgdi_device_driver.h
@@ -40,9 +40,7 @@
uint32_t stroke_color,
const CFX_FillRenderOptions& fill_options,
BlendMode blend_type) override;
- bool FillRectWithBlend(const FX_RECT& rect,
- uint32_t fill_color,
- BlendMode blend_type) override;
+ bool FillRect(const FX_RECT& rect, uint32_t fill_color) override;
bool DrawCosmeticLine(const CFX_PointF& ptMoveTo,
const CFX_PointF& ptLineTo,
uint32_t color) override;