Remove dead code in CFX_DefaultRenderDevice::AttachAggImpl()
Remove a check that never evaluates to true in AttachAggImpl() and
replace it with a CHECK() instead. Also add a comment in
AttachSkiaImpl() to explain why the Skia version still needs the check.
Change-Id: I9e81249b18a01e15a1b2bd8e9e21ecbdbc33a0b4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114953
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index fd3c75e..70159ea 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1382,9 +1382,8 @@
bool bRgbByteOrder,
RetainPtr<CFX_DIBitmap> pBackdropBitmap,
bool bGroupKnockout) {
- if (!pBitmap)
- return false;
-
+ // Unlike the Skia version, all callers pass in a non-null `pBitmap`.
+ CHECK(pBitmap);
SetBitmap(pBitmap);
SetDeviceDriver(std::make_unique<pdfium::CFX_AggDeviceDriver>(
std::move(pBitmap), bRgbByteOrder, std::move(pBackdropBitmap),
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index ddd3d44..7c31bcf 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1635,6 +1635,8 @@
bool bRgbByteOrder,
RetainPtr<CFX_DIBitmap> pBackdropBitmap,
bool bGroupKnockout) {
+ // FPDF_FFLDrawSkia() ends up calling this method with a deliberately null
+ // `pBitmap`.
if (!pBitmap)
return false;
SetBitmap(pBitmap);