Make some fxge code Windows / AGG-only Make CFX_RenderDevice::FillRect() fallback code Windows-only, since only CGdiDeviceDriver can trigger this code. All other drivers that implement RenderDeviceDriverIface::FillRect() will always succeed. After this, CFX_DIBitmap::CompositeRect() becomes Windows/AGG-only. Change-Id: I20530d463ec968ae0cdd68b3aa40cccf09568e27 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/147370 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index 52d232d..6b2504f 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp
@@ -853,6 +853,7 @@ return true; } +#if BUILDFLAG(IS_WIN) if (!render_cap_get_bits_) { return false; } @@ -874,6 +875,10 @@ device_driver_->SetDIBits(std::move(bitmap), /*color=*/0, src_rect, rect.left, rect.top, BlendMode::kNormal); return true; +#else + CHECK(!render_cap_get_bits_); + return false; +#endif } bool CFX_RenderDevice::DrawCosmeticLine(
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 94a6c21..7caaa66 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -715,6 +715,7 @@ }); } +#if BUILDFLAG(IS_WIN) || defined(PDF_USE_AGG) bool CFX_DIBitmap::CompositeRect(int left, int top, int width, @@ -886,6 +887,7 @@ } return true; } +#endif // BUILDFLAG(IS_WIN) || defined(PDF_USE_AGG) bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { static constexpr FXDIB_Format kAllowedDestFormats[] = {
diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h index 694aad7..c8fb487 100644 --- a/core/fxge/dib/cfx_dibitmap.h +++ b/core/fxge/dib/cfx_dibitmap.h
@@ -165,11 +165,13 @@ int src_left, int src_top); +#if BUILDFLAG(IS_WIN) || defined(PDF_USE_AGG) bool CompositeRect(int dest_left, int dest_top, int width, int height, uint32_t color); +#endif // When `is_white_on_black` is true, the foreground is white and the // background is black. When `is_white_on_black` is false, the colors are