diff options
author | Lei Zhang <thestig@chromium.org> | 2017-05-18 15:51:20 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-19 01:39:40 +0000 |
commit | 76020fc9751e55661d1c01b6cd92dfcb1fd56e6a (patch) | |
tree | 59d5251b23f5acb78891bf2911a79f2c70812c1c /core/fxge | |
parent | 22644731e0e46eae1f50927376e557c7d64db1d5 (diff) | |
download | pdfium-76020fc9751e55661d1c01b6cd92dfcb1fd56e6a.tar.xz |
Move CCodec_ModuleMgr ownership to CPDF_ModuleMgr.
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr
holding a pointer to it.
Remove assumptions that the codec modules may return nullptr, and do
IWYU.
Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5
Reviewed-on: https://pdfium-review.googlesource.com/5654
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/agg/fx_agg_driver.cpp | 1 | ||||
-rw-r--r-- | core/fxge/apple/fx_quartz_device.cpp | 1 | ||||
-rw-r--r-- | core/fxge/cfx_gemodule.h | 3 | ||||
-rw-r--r-- | core/fxge/cfx_renderdevice.h | 1 | ||||
-rw-r--r-- | core/fxge/dib/cfx_bitmapcomposer.cpp | 1 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.cpp | 1 | ||||
-rw-r--r-- | core/fxge/dib/cfx_scanlinecompositor.cpp | 1 | ||||
-rw-r--r-- | core/fxge/ge/cfx_gemodule.cpp | 2 | ||||
-rw-r--r-- | core/fxge/ge/cfx_renderdevice.cpp | 1 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.cpp | 1 | ||||
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 17 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 1 |
12 files changed, 11 insertions, 20 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 08a6e09324..6174f6e18f 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -11,7 +11,6 @@ #include "core/fxcodec/fx_codec.h" #include "core/fxge/cfx_defaultrenderdevice.h" -#include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/dib/cfx_imagerenderer.h" diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index 5151b02d8b..ad09f91f61 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -11,7 +11,6 @@ #endif #include "core/fxcrt/fx_memory.h" -#include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" diff --git a/core/fxge/cfx_gemodule.h b/core/fxge/cfx_gemodule.h index 429f7d9a39..2816ca9b22 100644 --- a/core/fxge/cfx_gemodule.h +++ b/core/fxge/cfx_gemodule.h @@ -12,7 +12,6 @@ #include "core/fxge/cfx_fontmgr.h" #include "core/fxge/fx_font.h" -class CCodec_ModuleMgr; class CFX_FontCache; class CFX_FontMgr; @@ -25,7 +24,6 @@ class CFX_GEModule { CFX_FontCache* GetFontCache(); CFX_FontMgr* GetFontMgr() { return m_pFontMgr.get(); } - CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule.get(); } void* GetPlatformData() { return m_pPlatformData; } private: @@ -37,7 +35,6 @@ class CFX_GEModule { std::unique_ptr<CFX_FontCache> m_pFontCache; std::unique_ptr<CFX_FontMgr> m_pFontMgr; - std::unique_ptr<CCodec_ModuleMgr> m_pCodecModule; void* m_pPlatformData; const char** m_pUserFontPaths; }; diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index 6aa4528f05..4d8b407b35 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -9,7 +9,6 @@ #include <memory> -#include "core/fxge/cfx_gemodule.h" #include "core/fxge/fx_dib.h" #include "core/fxge/fx_font.h" diff --git a/core/fxge/dib/cfx_bitmapcomposer.cpp b/core/fxge/dib/cfx_bitmapcomposer.cpp index 604c0c2ce0..3f75fae1b6 100644 --- a/core/fxge/dib/cfx_bitmapcomposer.cpp +++ b/core/fxge/dib/cfx_bitmapcomposer.cpp @@ -7,7 +7,6 @@ #include "core/fxge/dib/cfx_bitmapcomposer.h" #include "core/fxcodec/fx_codec.h" -#include "core/fxge/cfx_gemodule.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/ge/cfx_cliprgn.h" diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 4cba073321..48cbc3291c 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -11,7 +11,6 @@ #include <utility> #include "core/fxcodec/fx_codec.h" -#include "core/fxge/cfx_gemodule.h" #include "core/fxge/dib/cfx_scanlinecompositor.h" #include "core/fxge/ge/cfx_cliprgn.h" #include "third_party/base/ptr_util.h" diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp b/core/fxge/dib/cfx_scanlinecompositor.cpp index 8a0185ffe1..5bd654b3e6 100644 --- a/core/fxge/dib/cfx_scanlinecompositor.cpp +++ b/core/fxge/dib/cfx_scanlinecompositor.cpp @@ -9,7 +9,6 @@ #include <algorithm> #include "core/fxcodec/fx_codec.h" -#include "core/fxge/cfx_gemodule.h" #define FX_CCOLOR(val) (255 - (val)) #define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255) diff --git a/core/fxge/ge/cfx_gemodule.cpp b/core/fxge/ge/cfx_gemodule.cpp index d7ae098f31..4516d61e27 100644 --- a/core/fxge/ge/cfx_gemodule.cpp +++ b/core/fxge/ge/cfx_gemodule.cpp @@ -6,7 +6,6 @@ #include "core/fxge/cfx_gemodule.h" -#include "core/fxcodec/fx_codec.h" #include "core/fxge/cfx_fontcache.h" #include "core/fxge/cfx_fontmgr.h" #include "core/fxge/ge/cfx_folderfontinfo.h" @@ -21,7 +20,6 @@ CFX_GEModule* g_pGEModule = nullptr; CFX_GEModule::CFX_GEModule() : m_pFontMgr(pdfium::MakeUnique<CFX_FontMgr>()), - m_pCodecModule(pdfium::MakeUnique<CCodec_ModuleMgr>()), m_pPlatformData(nullptr), m_pUserFontPaths(nullptr) {} diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index d2924bb13c..3949837982 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -14,6 +14,7 @@ #include "core/fxcrt/fx_safe_types.h" #include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_facecache.h" +#include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/dib/cfx_imagerenderer.h" diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index ca5a98ca32..dd48045ce1 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -15,7 +15,6 @@ #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_memory.h" #include "core/fxge/cfx_defaultrenderdevice.h" -#include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index ba027ba6dc..400babd16b 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -8,10 +8,12 @@ #include <memory> +#include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/cfx_maybe_owned.h" #include "core/fxge/cfx_facecache.h" #include "core/fxge/cfx_fontcache.h" +#include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/dib/cfx_dibextractor.h" @@ -48,17 +50,17 @@ void PSCompressData(int PSLevel, if (src_size < 1024) return; - CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); + CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); uint8_t* dest_buf = nullptr; uint32_t dest_size = src_size; if (PSLevel >= 3) { - if (pEncoders && pEncoders->GetFlateModule()->Encode( - src_buf, src_size, &dest_buf, &dest_size)) { + if (pEncoders->GetFlateModule()->Encode(src_buf, src_size, &dest_buf, + &dest_size)) { *filter = "/FlateDecode filter "; } } else { - if (pEncoders && pEncoders->GetBasicModule()->RunLengthEncode( - src_buf, src_size, &dest_buf, &dest_size)) { + if (pEncoders->GetBasicModule()->RunLengthEncode(src_buf, src_size, + &dest_buf, &dest_size)) { *filter = "/RunLengthDecode filter "; } } @@ -681,9 +683,8 @@ bool CFX_PSRenderer::DrawText(int nChars, void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) { uint8_t* dest_buf; uint32_t dest_size; - CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); - if (pEncoders && - pEncoders->GetBasicModule()->A85Encode(data, len, &dest_buf, + CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); + if (pEncoders->GetBasicModule()->A85Encode(data, len, &dest_buf, &dest_size)) { m_pStream->WriteBlock(dest_buf, dest_size); FX_Free(dest_buf); diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 2747339b1d..b495251dee 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -15,6 +15,7 @@ #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_system.h" +#include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_windowsrenderdevice.h" #include "core/fxge/dib/cfx_dibextractor.h" #include "core/fxge/dib/cfx_imagerenderer.h" |