Make some CFX_AggDeviceDriver methods private. In CFX_AggDeviceDriver: - RenderRasterizer() and SetClipMask() should be private, as they have no external callers. - GetBuffer() only has one caller. Remove it and update its caller. Also do more forward declarations in fx_agg_driver.h, so almost all third_party/agg23 includes are contained within fx_agg_driver.cpp. The exception being core/fxge/win32/fx_win32_device.cpp, which now has to do IWYU. Change-Id: Ibc49880878aba0c26d3e1a564acdb02a279a6745 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74394 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Hui Yingst <nigi@chromium.org>
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 0100ea1..7e586cb 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1103,10 +1103,6 @@ DestroyPlatform(); } -uint8_t* CFX_AggDeviceDriver::GetBuffer() const { - return m_pBitmap->GetBuffer(); -} - #if !defined(OS_APPLE) void CFX_AggDeviceDriver::InitPlatform() {} @@ -1291,7 +1287,7 @@ if (blend_type != BlendMode::kNormal) return false; - if (!GetBuffer()) + if (!m_pBitmap->GetBuffer()) return true; m_FillOptions = fill_options;
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 3457478..f5a2727 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h
@@ -13,7 +13,6 @@ #include "build/build_config.h" #include "core/fxge/cfx_fillrenderoptions.h" #include "core/fxge/renderdevicedriver_iface.h" -#include "third_party/agg23/agg_rasterizer_scanline_aa.h" class CFX_ClipRgn; class CFX_GraphStateData; @@ -22,6 +21,10 @@ namespace pdfium { +namespace agg { +class rasterizer_scanline_aa; +} // namespace agg + class CFX_AggDeviceDriver final : public RenderDeviceDriverIface { public: CFX_AggDeviceDriver(const RetainPtr<CFX_DIBitmap>& pBitmap, @@ -92,6 +95,7 @@ const CFX_TextRenderOptions& options) override; int GetDriverType() const override; + private: bool RenderRasterizer(pdfium::agg::rasterizer_scanline_aa& rasterizer, uint32_t color, bool bFullCover, @@ -99,9 +103,6 @@ void SetClipMask(pdfium::agg::rasterizer_scanline_aa& rasterizer); - virtual uint8_t* GetBuffer() const; - - private: RetainPtr<CFX_DIBitmap> const m_pBitmap; std::unique_ptr<CFX_ClipRgn> m_pClipRgn; std::vector<std::unique_ptr<CFX_ClipRgn>> m_StateStack;
diff --git a/core/fxge/win32/DEPS b/core/fxge/win32/DEPS new file mode 100644 index 0000000..5d1d2b3 --- /dev/null +++ b/core/fxge/win32/DEPS
@@ -0,0 +1,5 @@ +specific_include_rules = { + 'fx_win32_device.cpp': [ + '+third_party/agg23/agg_clip_liang_barsky.h', + ] +}
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index e362832..7686506 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp
@@ -34,6 +34,7 @@ #if !defined(_SKIA_SUPPORT_) #include "core/fxge/agg/fx_agg_driver.h" +#include "third_party/agg23/agg_clip_liang_barsky.h" #endif namespace {