From 0b95042db2e6dab5876abd12ce485fff0a8e08fe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 21 Sep 2017 15:49:49 -0400 Subject: Rename CFX_RetainPtr to RetainPtr This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fde/cfde_texteditengine.cpp | 2 +- xfa/fde/cfde_texteditengine.h | 8 +-- xfa/fde/cfde_texteditengine_unittest.cpp | 2 +- xfa/fde/cfde_textout.cpp | 8 +-- xfa/fde/cfde_textout.h | 6 +- xfa/fgas/font/cfgas_defaultfontmanager.cpp | 8 +-- xfa/fgas/font/cfgas_defaultfontmanager.h | 20 +++---- xfa/fgas/font/cfgas_fontmgr.cpp | 82 +++++++++++++-------------- xfa/fgas/font/cfgas_fontmgr.h | 90 +++++++++++++++--------------- xfa/fgas/font/cfgas_gefont.cpp | 36 ++++++------ xfa/fgas/font/cfgas_gefont.h | 46 ++++++++------- xfa/fgas/font/cfgas_pdffontmgr.cpp | 19 +++---- xfa/fgas/font/cfgas_pdffontmgr.h | 28 +++++----- xfa/fgas/layout/cfx_break.cpp | 2 +- xfa/fgas/layout/cfx_break.h | 6 +- xfa/fgas/layout/cfx_breakpiece.h | 4 +- xfa/fgas/layout/cfx_rtfbreak.cpp | 5 +- xfa/fgas/layout/cfx_rtfbreak.h | 8 +-- xfa/fgas/layout/cfx_rtfbreak_unittest.cpp | 2 +- xfa/fgas/layout/cfx_txtbreak.cpp | 4 +- xfa/fgas/layout/cfx_txtbreak.h | 2 +- xfa/fwl/cfwl_barcode.cpp | 2 +- xfa/fwl/cfwl_edit.cpp | 4 +- xfa/fwl/cfwl_themebackground.h | 2 +- xfa/fwl/cfx_barcode_unittest.cpp | 2 +- xfa/fwl/ifwl_themeprovider.h | 5 +- xfa/fwl/theme/cfwl_widgettp.cpp | 2 +- xfa/fwl/theme/cfwl_widgettp.h | 16 +++--- xfa/fxfa/cxfa_ffapp.h | 2 +- xfa/fxfa/cxfa_ffdoc.cpp | 10 ++-- xfa/fxfa/cxfa_ffdoc.h | 18 +++--- xfa/fxfa/cxfa_ffimage.cpp | 2 +- xfa/fxfa/cxfa_ffimageedit.cpp | 2 +- xfa/fxfa/cxfa_ffwidget.cpp | 49 ++++++++-------- xfa/fxfa/cxfa_ffwidget.h | 16 +++--- xfa/fxfa/cxfa_fileread.h | 4 +- xfa/fxfa/cxfa_fontmgr.cpp | 4 +- xfa/fxfa/cxfa_fontmgr.h | 12 ++-- xfa/fxfa/cxfa_fwltheme.cpp | 2 +- xfa/fxfa/cxfa_fwltheme.h | 5 +- xfa/fxfa/cxfa_linkuserdata.h | 6 +- xfa/fxfa/cxfa_loadercontext.h | 2 +- xfa/fxfa/cxfa_textlayout.cpp | 8 +-- xfa/fxfa/cxfa_textlayout.h | 4 +- xfa/fxfa/cxfa_textparsecontext.h | 2 +- xfa/fxfa/cxfa_textparser.cpp | 10 ++-- xfa/fxfa/cxfa_textparser.h | 12 ++-- xfa/fxfa/cxfa_textpiece.h | 4 +- xfa/fxfa/cxfa_textuserdata.cpp | 6 +- xfa/fxfa/cxfa_textuserdata.h | 16 +++--- xfa/fxfa/cxfa_widgetacc.cpp | 19 +++---- xfa/fxfa/cxfa_widgetacc.h | 12 ++-- xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp | 2 +- xfa/fxfa/fxfa.h | 6 +- xfa/fxfa/parser/cxfa_dataexporter.cpp | 11 ++-- xfa/fxfa/parser/cxfa_dataexporter.h | 8 +-- xfa/fxfa/parser/cxfa_dataimporter.cpp | 2 +- xfa/fxfa/parser/cxfa_dataimporter.h | 4 +- xfa/fxfa/parser/cxfa_document_parser.cpp | 2 +- xfa/fxfa/parser/cxfa_document_parser.h | 2 +- xfa/fxfa/parser/cxfa_simple_parser.cpp | 2 +- xfa/fxfa/parser/cxfa_simple_parser.h | 6 +- xfa/fxfa/parser/xfa_utils.h | 2 +- xfa/fxgraphics/cxfa_graphics.cpp | 25 ++++----- xfa/fxgraphics/cxfa_graphics.h | 6 +- 65 files changed, 355 insertions(+), 371 deletions(-) (limited to 'xfa') diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp index 143bac49f9..d54126f3c3 100644 --- a/xfa/fde/cfde_texteditengine.cpp +++ b/xfa/fde/cfde_texteditengine.cpp @@ -623,7 +623,7 @@ void CFDE_TextEditEngine::SetCharacterLimit(size_t limit) { is_dirty_ = true; } -void CFDE_TextEditEngine::SetFont(CFX_RetainPtr font) { +void CFDE_TextEditEngine::SetFont(RetainPtr font) { if (font_ == font) return; diff --git a/xfa/fde/cfde_texteditengine.h b/xfa/fde/cfde_texteditengine.h index dbb12f3953..7b739be711 100644 --- a/xfa/fde/cfde_texteditengine.h +++ b/xfa/fde/cfde_texteditengine.h @@ -11,8 +11,8 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_dib.h" #include "xfa/fgas/font/cfgas_gefont.h" @@ -96,8 +96,8 @@ class CFDE_TextEditEngine { CFX_RectF GetContentsBoundingBox(); void SetAvailableWidth(size_t width); - void SetFont(CFX_RetainPtr font); - CFX_RetainPtr GetFont() const { return font_; } + void SetFont(RetainPtr font); + RetainPtr GetFont() const { return font_; } void SetFontSize(float size); float GetFontSize() const { return font_size_; } void SetFontColor(FX_ARGB color) { font_color_ = color; } @@ -204,7 +204,7 @@ class CFDE_TextEditEngine { std::vector text_piece_info_; std::vector char_widths_; CFX_TxtBreak text_break_; - CFX_RetainPtr font_; + RetainPtr font_; FX_ARGB font_color_; float font_size_; float line_spacing_; diff --git a/xfa/fde/cfde_texteditengine_unittest.cpp b/xfa/fde/cfde_texteditengine_unittest.cpp index b0a27f331c..e6cff04507 100644 --- a/xfa/fde/cfde_texteditengine_unittest.cpp +++ b/xfa/fde/cfde_texteditengine_unittest.cpp @@ -49,7 +49,7 @@ class CFDE_TextEditEngineTest : public testing::Test { CFDE_TextEditEngine* engine() const { return engine_.get(); } private: - CFX_RetainPtr font_; + RetainPtr font_; std::unique_ptr engine_; }; diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp index 3cf4ed36e0..0e9005d88e 100644 --- a/xfa/fde/cfde_textout.cpp +++ b/xfa/fde/cfde_textout.cpp @@ -33,7 +33,7 @@ bool IsTextAlignmentTop(const FDE_TextAlignment align) { // static bool CFDE_TextOut::DrawString(CFX_RenderDevice* device, FX_ARGB color, - const CFX_RetainPtr& pFont, + const RetainPtr& pFont, FXTEXT_CHARPOS* pCharPos, int32_t iCount, float fFontSize, @@ -63,11 +63,11 @@ bool CFDE_TextOut::DrawString(CFX_RenderDevice* device, FxFont.SetSubstFont(std::move(SubstFxFont)); #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - CFX_RetainPtr pCurFont; + RetainPtr pCurFont; FXTEXT_CHARPOS* pCurCP = nullptr; int32_t iCurCount = 0; for (int32_t i = 0; i < iCount; ++i) { - CFX_RetainPtr pSTFont = + RetainPtr pSTFont = pFont->GetSubstFont(static_cast(pCharPos->m_GlyphIndex)); pCharPos->m_GlyphIndex &= 0x00FFFFFF; pCharPos->m_bFontStyle = false; @@ -140,7 +140,7 @@ CFDE_TextOut::CFDE_TextOut() CFDE_TextOut::~CFDE_TextOut() {} -void CFDE_TextOut::SetFont(const CFX_RetainPtr& pFont) { +void CFDE_TextOut::SetFont(const RetainPtr& pFont) { ASSERT(pFont); m_pFont = pFont; m_pTxtBreak->SetFont(pFont); diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h index b936eb4415..f69c0a8717 100644 --- a/xfa/fde/cfde_textout.h +++ b/xfa/fde/cfde_textout.h @@ -77,7 +77,7 @@ class CFDE_TextOut { public: static bool DrawString(CFX_RenderDevice* device, FX_ARGB color, - const CFX_RetainPtr& pFont, + const RetainPtr& pFont, FXTEXT_CHARPOS* pCharPos, int32_t iCount, float fFontSize, @@ -86,7 +86,7 @@ class CFDE_TextOut { CFDE_TextOut(); ~CFDE_TextOut(); - void SetFont(const CFX_RetainPtr& pFont); + void SetFont(const RetainPtr& pFont); void SetFontSize(float fFontSize); void SetTextColor(FX_ARGB color) { m_TxtColor = color; } void SetStyles(const FDE_TextStyle& dwStyles); @@ -121,7 +121,7 @@ class CFDE_TextOut { int32_t GetDisplayPos(FDE_TTOPIECE* pPiece); std::unique_ptr m_pTxtBreak; - CFX_RetainPtr m_pFont; + RetainPtr m_pFont; float m_fFontSize; float m_fLineSpace; float m_fLinePos; diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp index 480525802b..d3864be16a 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp +++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp @@ -12,13 +12,13 @@ CFGAS_DefaultFontManager::CFGAS_DefaultFontManager() {} CFGAS_DefaultFontManager::~CFGAS_DefaultFontManager() {} -CFX_RetainPtr CFGAS_DefaultFontManager::GetFont( +RetainPtr CFGAS_DefaultFontManager::GetFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { WideString wsFontName(wsFontFamily); - CFX_RetainPtr pFont = + RetainPtr pFont = pFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); if (!pFont) { const FGAS_FontInfo* pCurFont = @@ -54,12 +54,12 @@ CFX_RetainPtr CFGAS_DefaultFontManager::GetFont( return pFont; } -CFX_RetainPtr CFGAS_DefaultFontManager::GetDefaultFont( +RetainPtr CFGAS_DefaultFontManager::GetDefaultFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - CFX_RetainPtr pFont = + RetainPtr pFont = pFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) { pFont = pFontMgr->LoadFont(static_cast(nullptr), diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.h b/xfa/fgas/font/cfgas_defaultfontmanager.h index b596efc719..4e2e5e10d4 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.h +++ b/xfa/fgas/font/cfgas_defaultfontmanager.h @@ -9,8 +9,8 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_gefont.h" class CFGAS_DefaultFontManager { @@ -18,17 +18,17 @@ class CFGAS_DefaultFontManager { CFGAS_DefaultFontManager(); ~CFGAS_DefaultFontManager(); - CFX_RetainPtr GetFont(CFGAS_FontMgr* pFontMgr, - const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); - CFX_RetainPtr GetDefaultFont(CFGAS_FontMgr* pFontMgr, - const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); + RetainPtr GetFont(CFGAS_FontMgr* pFontMgr, + const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + RetainPtr GetDefaultFont(CFGAS_FontMgr* pFontMgr, + const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); private: - std::vector> m_CacheFonts; + std::vector> m_CacheFonts; }; #endif // XFA_FGAS_FONT_CFGAS_DEFAULTFONTMANAGER_H_ diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index f2405e9844..da1763214b 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -197,7 +197,7 @@ CFGAS_FontMgr::CFGAS_FontMgr(FX_LPEnumAllFonts pEnumerator) CFGAS_FontMgr::~CFGAS_FontMgr() {} -CFX_RetainPtr CFGAS_FontMgr::GetFontByCodePage( +RetainPtr CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -215,7 +215,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByCodePage( if (!pFD) return nullptr; - CFX_RetainPtr pFont = + RetainPtr pFont = CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); if (!pFont) return nullptr; @@ -227,7 +227,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByCodePage( return LoadFont(pFont, dwFontStyles, wCodePage); } -CFX_RetainPtr CFGAS_FontMgr::GetFontByUnicode( +RetainPtr CFGAS_FontMgr::GetFontByUnicode( wchar_t wUnicode, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -254,7 +254,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByUnicode( uint16_t wCodePage = GetCodePageFromCharset(pFD->uCharSet); const wchar_t* pFontFace = pFD->wsFontFace; - CFX_RetainPtr pFont = + RetainPtr pFont = CFGAS_GEFont::LoadFont(pFontFace, dwFontStyles, wCodePage, this); if (!pFont) return nullptr; @@ -266,11 +266,10 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByUnicode( return LoadFont(pFont, dwFontStyles, wCodePage); } -CFX_RetainPtr CFGAS_FontMgr::LoadFont( - const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { - CFX_RetainPtr pFont; +RetainPtr CFGAS_FontMgr::LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { + RetainPtr pFont; uint32_t dwHash = GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); auto it = m_FamilyFonts.find(dwHash); if (it != m_FamilyFonts.end()) @@ -298,8 +297,8 @@ CFX_RetainPtr CFGAS_FontMgr::LoadFont( return LoadFont(pFont, dwFontStyles, wCodePage); } -CFX_RetainPtr CFGAS_FontMgr::LoadFont( - const CFX_RetainPtr& pSrcFont, +RetainPtr CFGAS_FontMgr::LoadFont( + const RetainPtr& pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage) { if (pSrcFont->GetFontStyles() == dwFontStyles) @@ -313,7 +312,7 @@ CFX_RetainPtr CFGAS_FontMgr::LoadFont( if (it != m_DeriveFonts.end() && it->second) return it->second; - CFX_RetainPtr pFont = pSrcFont->Derive(dwFontStyles, wCodePage); + RetainPtr pFont = pSrcFont->Derive(dwFontStyles, wCodePage); if (!pFont) return nullptr; @@ -325,8 +324,8 @@ CFX_RetainPtr CFGAS_FontMgr::LoadFont( } void CFGAS_FontMgr::RemoveFont( - std::map>* pFontMap, - const CFX_RetainPtr& pFont) { + std::map>* pFontMap, + const RetainPtr& pFont) { auto iter = pFontMap->begin(); while (iter != pFontMap->end()) { auto old_iter = iter++; @@ -335,7 +334,7 @@ void CFGAS_FontMgr::RemoveFont( } } -void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr& pFont) { +void CFGAS_FontMgr::RemoveFont(const RetainPtr& pFont) { RemoveFont(&m_CPFonts, pFont); RemoveFont(&m_FamilyFonts, pFont); RemoveFont(&m_UnicodeFonts, pFont); @@ -680,7 +679,7 @@ bool CFX_FontSourceEnum_File::HasStartPosition() { return m_wsNext.GetLength() != 0; } -CFX_RetainPtr CFX_FontSourceEnum_File::GetNext() { +RetainPtr CFX_FontSourceEnum_File::GetNext() { if (m_wsNext.GetLength() == 0) return nullptr; @@ -717,7 +716,7 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { pSystemFontInfo->EnumFontList(pFontMapper); for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { - CFX_RetainPtr pFontStream = + RetainPtr pFontStream = CreateFontStream(pFontMapper, pSystemFontInfo, i); if (!pFontStream) continue; @@ -734,9 +733,8 @@ bool CFGAS_FontMgr::EnumFontsFromFiles() { if (!m_pFontSource->HasStartPosition()) return !m_InstalledFonts.empty(); - while (CFX_RetainPtr pFontSource = - m_pFontSource->GetNext()) { - CFX_RetainPtr pFontStream = + while (RetainPtr pFontSource = m_pFontSource->GetNext()) { + RetainPtr pFontStream = pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly); if (pFontStream) RegisterFaces(pFontStream, nullptr); @@ -748,14 +746,13 @@ bool CFGAS_FontMgr::EnumFonts() { return EnumFontsFromFontMapper() || EnumFontsFromFiles(); } -CFX_RetainPtr CFGAS_FontMgr::LoadFont( - const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +RetainPtr CFGAS_FontMgr::LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); } -CFX_RetainPtr CFGAS_FontMgr::GetFontByCodePage( +RetainPtr CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -763,7 +760,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByCodePage( bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); - std::vector>* pFontArray = &m_Hash2Fonts[dwHash]; + std::vector>* pFontArray = &m_Hash2Fonts[dwHash]; if (!pFontArray->empty()) return (*pFontArray)[0]; @@ -780,7 +777,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByCodePage( return nullptr; CFX_FontDescriptor* pDesc = (*sortedFontInfos)[0].pFont; - CFX_RetainPtr pFont = + RetainPtr pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); if (!pFont) return nullptr; @@ -790,7 +787,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByCodePage( return pFont; } -CFX_RetainPtr CFGAS_FontMgr::GetFontByUnicode( +RetainPtr CFGAS_FontMgr::GetFontByUnicode( wchar_t wUnicode, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -807,7 +804,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByUnicode( bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); - std::vector>* pFonts = &m_Hash2Fonts[dwHash]; + std::vector>* pFonts = &m_Hash2Fonts[dwHash]; for (size_t i = 0; i < pFonts->size(); ++i) { if (VerifyUnicode((*pFonts)[i], wUnicode)) return (*pFonts)[i]; @@ -825,7 +822,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByUnicode( CFX_FontDescriptor* pDesc = info.pFont; if (!VerifyUnicode(pDesc, wUnicode)) continue; - CFX_RetainPtr pFont = + RetainPtr pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); if (!pFont) continue; @@ -840,7 +837,7 @@ CFX_RetainPtr CFGAS_FontMgr::GetFontByUnicode( bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode) { - CFX_RetainPtr pFileRead = + RetainPtr pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); if (!pFileRead) return false; @@ -858,7 +855,7 @@ bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc, return !retCharmap && retIndex; } -bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr& pFont, +bool CFGAS_FontMgr::VerifyUnicode(const RetainPtr& pFont, wchar_t wcUnicode) { if (!pFont) return false; @@ -875,10 +872,9 @@ bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr& pFont, return true; } -CFX_RetainPtr CFGAS_FontMgr::LoadFont( - const WideString& wsFaceName, - int32_t iFaceIndex, - int32_t* pFaceCount) { +RetainPtr CFGAS_FontMgr::LoadFont(const WideString& wsFaceName, + int32_t iFaceIndex, + int32_t* pFaceCount) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); if (!pFontMapper) @@ -888,7 +884,7 @@ CFX_RetainPtr CFGAS_FontMgr::LoadFont( if (!pSystemFontInfo) return nullptr; - CFX_RetainPtr pFontStream = + RetainPtr pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); if (!pFontStream) return nullptr; @@ -897,7 +893,7 @@ CFX_RetainPtr CFGAS_FontMgr::LoadFont( if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) return nullptr; - CFX_RetainPtr pFont = + RetainPtr pFont = CFGAS_GEFont::LoadFont(std::move(pInternalFont), this); if (!pFont) return nullptr; @@ -930,7 +926,7 @@ void _ftStreamClose(FXFT_Stream stream) {} }; // extern "C" FXFT_Face CFGAS_FontMgr::LoadFace( - const CFX_RetainPtr& pFontStream, + const RetainPtr& pFontStream, int32_t iFaceIndex) { if (!pFontStream) return nullptr; @@ -971,7 +967,7 @@ FXFT_Face CFGAS_FontMgr::LoadFace( return pFace; } -CFX_RetainPtr CFGAS_FontMgr::CreateFontStream( +RetainPtr CFGAS_FontMgr::CreateFontStream( CFX_FontMapper* pFontMapper, IFX_SystemFontInfo* pSystemFontInfo, uint32_t index) { @@ -992,7 +988,7 @@ CFX_RetainPtr CFGAS_FontMgr::CreateFontStream( return pdfium::MakeRetain(pBuffer, dwFileSize, true); } -CFX_RetainPtr CFGAS_FontMgr::CreateFontStream( +RetainPtr CFGAS_FontMgr::CreateFontStream( const ByteString& bsFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); @@ -1101,7 +1097,7 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, return nPenalty; } -void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr& pEFont) { +void CFGAS_FontMgr::RemoveFont(const RetainPtr& pEFont) { if (!pEFont) return; @@ -1155,7 +1151,7 @@ void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, const WideString* pFaceName) { } void CFGAS_FontMgr::RegisterFaces( - const CFX_RetainPtr& pFontStream, + const RetainPtr& pFontStream, const WideString* pFaceName) { int32_t index = 0; int32_t num_faces = 0; diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 642ba6fb67..0bcee12e4d 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -14,10 +14,10 @@ #include #include "core/fxcrt/cfx_crtfileaccess.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/observable.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_fontmapper.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ifx_systemfontinfo.h" @@ -88,24 +88,23 @@ class CFGAS_FontMgr : public Observable { explicit CFGAS_FontMgr(FX_LPEnumAllFonts pEnumerator); ~CFGAS_FontMgr(); - CFX_RetainPtr GetFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr GetFontByUnicode(wchar_t wUnicode, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); - void RemoveFont(const CFX_RetainPtr& pFont); + RetainPtr GetFontByCodePage(uint16_t wCodePage, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr GetFontByUnicode(wchar_t wUnicode, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage); + void RemoveFont(const RetainPtr& pFont); private: - CFX_RetainPtr LoadFont( - const CFX_RetainPtr& pSrcFont, - uint32_t dwFontStyles, - uint16_t wCodePage); - void RemoveFont(std::map>* pFontMap, - const CFX_RetainPtr& pFont); + RetainPtr LoadFont(const RetainPtr& pSrcFont, + uint32_t dwFontStyles, + uint16_t wCodePage); + void RemoveFont(std::map>* pFontMap, + const RetainPtr& pFont); const FX_FONTDESCRIPTOR* FindFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint32_t dwMatchFlags, @@ -115,13 +114,13 @@ class CFGAS_FontMgr : public Observable { FX_LPEnumAllFonts m_pEnumerator; std::deque m_FontFaces; - std::vector> m_Fonts; - std::map> m_CPFonts; - std::map> m_FamilyFonts; - std::map> m_UnicodeFonts; - std::map> m_BufferFonts; - std::map> m_StreamFonts; - std::map> m_DeriveFonts; + std::vector> m_Fonts; + std::map> m_CPFonts; + std::map> m_FamilyFonts; + std::map> m_UnicodeFonts; + std::map> m_BufferFonts; + std::map> m_StreamFonts; + std::map> m_DeriveFonts; }; #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -170,7 +169,7 @@ class CFX_FontSourceEnum_File { ~CFX_FontSourceEnum_File(); bool HasStartPosition(); - CFX_RetainPtr GetNext(); + RetainPtr GetNext(); private: ByteString GetNextFile(); @@ -188,31 +187,30 @@ class CFGAS_FontMgr : public Observable { explicit CFGAS_FontMgr(CFX_FontSourceEnum_File* pFontEnum); ~CFGAS_FontMgr(); - CFX_RetainPtr GetFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr GetFontByUnicode(wchar_t wUnicode, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); - void RemoveFont(const CFX_RetainPtr& pFont); + RetainPtr GetFontByCodePage(uint16_t wCodePage, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr GetFontByUnicode(wchar_t wUnicode, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage); + void RemoveFont(const RetainPtr& pFont); private: bool EnumFonts(); bool EnumFontsFromFontMapper(); bool EnumFontsFromFiles(); void RegisterFace(FXFT_Face pFace, const WideString* pFaceName); - void RegisterFaces(const CFX_RetainPtr& pFontStream, + void RegisterFaces(const RetainPtr& pFontStream, const WideString* pFaceName); void GetNames(const uint8_t* name_table, std::vector& Names); std::vector GetCharsets(FXFT_Face pFace) const; void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode); - bool VerifyUnicode(const CFX_RetainPtr& pFont, - wchar_t wcUnicode); + bool VerifyUnicode(const RetainPtr& pFont, wchar_t wcUnicode); int32_t IsPartName(const WideString& Name1, const WideString& Name2); void MatchFonts(std::vector* MatchedFonts, uint16_t wCodePage, @@ -224,24 +222,24 @@ class CFGAS_FontMgr : public Observable { uint32_t dwFontStyles, const WideString& FontName, wchar_t wcUnicode = 0xFFFE); - CFX_RetainPtr LoadFont(const WideString& wsFaceName, - int32_t iFaceIndex, - int32_t* pFaceCount); - FXFT_Face LoadFace(const CFX_RetainPtr& pFontStream, + RetainPtr LoadFont(const WideString& wsFaceName, + int32_t iFaceIndex, + int32_t* pFaceCount); + FXFT_Face LoadFace(const RetainPtr& pFontStream, int32_t iFaceIndex); - CFX_RetainPtr CreateFontStream( + RetainPtr CreateFontStream( CFX_FontMapper* pFontMapper, IFX_SystemFontInfo* pSystemFontInfo, uint32_t index); - CFX_RetainPtr CreateFontStream( + RetainPtr CreateFontStream( const ByteString& bsFaceName); CFX_FontSourceEnum_File* const m_pFontSource; std::vector> m_InstalledFonts; std::map>> m_Hash2CandidateList; - std::map>> m_Hash2Fonts; - std::map, CFX_RetainPtr> + std::map>> m_Hash2Fonts; + std::map, RetainPtr> m_IFXFont2FileRead; std::set m_FailedUnicodesSet; }; diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp index 404b23cf7b..ba79d77ca0 100644 --- a/xfa/fgas/font/cfgas_gefont.cpp +++ b/xfa/fgas/font/cfgas_gefont.cpp @@ -17,10 +17,10 @@ #include "xfa/fgas/font/fgas_fontutils.h" // static -CFX_RetainPtr CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage, - CFGAS_FontMgr* pFontMgr) { +RetainPtr CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage, + CFGAS_FontMgr* pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (!pFontMgr) return nullptr; @@ -35,8 +35,8 @@ CFX_RetainPtr CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily, } // static -CFX_RetainPtr CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont, - CFGAS_FontMgr* pFontMgr) { +RetainPtr CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont, + CFGAS_FontMgr* pFontMgr) { auto pFont = pdfium::MakeRetain(pFontMgr); if (!pFont->LoadFontInternal(pExternalFont)) return nullptr; @@ -44,7 +44,7 @@ CFX_RetainPtr CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont, } // static -CFX_RetainPtr CFGAS_GEFont::LoadFont( +RetainPtr CFGAS_GEFont::LoadFont( std::unique_ptr pInternalFont, CFGAS_FontMgr* pFontMgr) { auto pFont = pdfium::MakeRetain(pFontMgr); @@ -64,7 +64,7 @@ CFGAS_GEFont::CFGAS_GEFont(CFGAS_FontMgr* pFontMgr) m_pFontMgr(pFontMgr) { } -CFGAS_GEFont::CFGAS_GEFont(const CFX_RetainPtr& src, +CFGAS_GEFont::CFGAS_GEFont(const RetainPtr& src, uint32_t dwFontStyles) : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ @@ -164,9 +164,9 @@ bool CFGAS_GEFont::InitFont() { return !!m_pFontEncoding; } -CFX_RetainPtr CFGAS_GEFont::Derive(uint32_t dwFontStyles, - uint16_t wCodePage) { - CFX_RetainPtr pFont(this); +RetainPtr CFGAS_GEFont::Derive(uint32_t dwFontStyles, + uint16_t wCodePage) { + RetainPtr pFont(this); if (GetFontStyles() == dwFontStyles) return pFont; return pdfium::MakeRetain(pFont, dwFontStyles); @@ -223,9 +223,9 @@ bool CFGAS_GEFont::GetCharWidthInternal(wchar_t wUnicode, return true; if (!m_pProvider || - !m_pProvider->GetCharWidth(CFX_RetainPtr(this), wUnicode, + !m_pProvider->GetCharWidth(RetainPtr(this), wUnicode, bCharCode, &iWidth)) { - CFX_RetainPtr pFont; + RetainPtr pFont; int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont) { if (pFont.Get() == this) { @@ -260,7 +260,7 @@ bool CFGAS_GEFont::GetCharBBoxInternal(wchar_t wUnicode, return true; } - CFX_RetainPtr pFont; + RetainPtr pFont; int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (!pFont || iGlyph == 0xFFFF) return false; @@ -296,7 +296,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, bool bCharCode) { int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, bool bRecursive, - CFX_RetainPtr* ppFont, + RetainPtr* ppFont, bool bCharCode) { int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { @@ -330,7 +330,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, return 0xFFFF; WideString wsFamily = GetFamilyName(); - CFX_RetainPtr pFont = + RetainPtr pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), wsFamily.c_str()); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (!pFont) @@ -358,9 +358,9 @@ int32_t CFGAS_GEFont::GetDescent() const { return m_pFont->GetDescent(); } -CFX_RetainPtr CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) { +RetainPtr CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) { iGlyphIndex = static_cast(iGlyphIndex) >> 24; if (iGlyphIndex == 0) - return CFX_RetainPtr(this); + return RetainPtr(this); return m_SubstFonts[iGlyphIndex - 1]; } diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h index c83fc4319d..f88f8b4cd9 100644 --- a/xfa/fgas/font/cfgas_gefont.h +++ b/xfa/fgas/font/cfgas_gefont.h @@ -11,9 +11,9 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fgas/font/cfgas_pdffontmgr.h" @@ -22,25 +22,24 @@ class CFGAS_FontMgr; class CFX_UnicodeEncoding; -class CFGAS_GEFont : public CFX_Retainable { +class CFGAS_GEFont : public Retainable { public: template - friend class CFX_RetainPtr; + friend class RetainPtr; template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); - static CFX_RetainPtr LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage, - CFGAS_FontMgr* pFontMgr); - static CFX_RetainPtr LoadFont(CFX_Font* pExternalFont, - CFGAS_FontMgr* pFontMgr); - static CFX_RetainPtr LoadFont( + static RetainPtr LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage, + CFGAS_FontMgr* pFontMgr); + static RetainPtr LoadFont(CFX_Font* pExternalFont, + CFGAS_FontMgr* pFontMgr); + static RetainPtr LoadFont( std::unique_ptr pInternalFont, CFGAS_FontMgr* pFontMgr); - CFX_RetainPtr Derive(uint32_t dwFontStyles, - uint16_t wCodePage = 0); + RetainPtr Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); uint32_t GetFontStyles() const; bool GetCharWidth(wchar_t wUnicode, int32_t& iWidth, bool bCharCode); int32_t GetGlyphIndex(wchar_t wUnicode, bool bCharCode = false); @@ -48,7 +47,7 @@ class CFGAS_GEFont : public CFX_Retainable { int32_t GetDescent() const; bool GetCharBBox(wchar_t wUnicode, CFX_Rect* bbox, bool bCharCode = false); bool GetBBox(CFX_Rect* bbox); - CFX_RetainPtr GetSubstFont(int32_t iGlyphIndex); + RetainPtr GetSubstFont(int32_t iGlyphIndex); CFX_Font* GetDevFont() const { return m_pFont; } void SetFontProvider(CFGAS_PDFFontMgr* pProvider) { m_pProvider.Reset(pProvider); @@ -62,7 +61,7 @@ class CFGAS_GEFont : public CFX_Retainable { private: explicit CFGAS_GEFont(CFGAS_FontMgr* pFontMgr); - CFGAS_GEFont(const CFX_RetainPtr& src, uint32_t dwFontStyles); + CFGAS_GEFont(const RetainPtr& src, uint32_t dwFontStyles); ~CFGAS_GEFont() override; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -70,9 +69,8 @@ class CFGAS_GEFont : public CFX_Retainable { uint32_t dwFontStyles, uint16_t wCodePage); bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); - bool LoadFontInternal( - const CFX_RetainPtr& pFontStream, - bool bSaveStream); + bool LoadFontInternal(const RetainPtr& pFontStream, + bool bSaveStream); #endif bool LoadFontInternal(CFX_Font* pExternalFont); bool LoadFontInternal(std::unique_ptr pInternalFont); @@ -87,7 +85,7 @@ class CFGAS_GEFont : public CFX_Retainable { bool bCharCode); int32_t GetGlyphIndex(wchar_t wUnicode, bool bRecursive, - CFX_RetainPtr* ppFont, + RetainPtr* ppFont, bool bCharCode = false); WideString GetFamilyName() const; @@ -97,16 +95,16 @@ class CFGAS_GEFont : public CFX_Retainable { #endif CFX_Font* m_pFont; bool m_bExternalFont; - CFX_RetainPtr m_pSrcFont; // Only set by ctor, so no cycles. + RetainPtr m_pSrcFont; // Only set by ctor, so no cycles. CFGAS_FontMgr::ObservedPtr m_pFontMgr; CFGAS_PDFFontMgr::ObservedPtr m_pProvider; - CFX_RetainPtr m_pStream; - CFX_RetainPtr m_pFileRead; + RetainPtr m_pStream; + RetainPtr m_pFileRead; std::unique_ptr m_pFontEncoding; std::map m_CharWidthMap; std::map m_BBoxMap; - std::vector> m_SubstFonts; - std::map> m_FontMapper; + std::vector> m_SubstFonts; + std::map> m_FontMapper; }; #endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_ diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp index 2b8e30e5ee..0fd18aa9b9 100644 --- a/xfa/fgas/font/cfgas_pdffontmgr.cpp +++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp @@ -32,12 +32,11 @@ CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(CPDF_Document* pDoc, CFGAS_FontMgr* pFontMgr) CFGAS_PDFFontMgr::~CFGAS_PDFFontMgr() {} -CFX_RetainPtr CFGAS_PDFFontMgr::FindFont( - const ByteString& strPsName, - bool bBold, - bool bItalic, - CPDF_Font** pDstPDFFont, - bool bStrictMatch) { +RetainPtr CFGAS_PDFFontMgr::FindFont(const ByteString& strPsName, + bool bBold, + bool bItalic, + CPDF_Font** pDstPDFFont, + bool bStrictMatch) { CPDF_Dictionary* pFontSetDict = m_pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR"); if (!pFontSetDict) @@ -73,7 +72,7 @@ CFX_RetainPtr CFGAS_PDFFontMgr::FindFont( return nullptr; } -CFX_RetainPtr CFGAS_PDFFontMgr::GetFont( +RetainPtr CFGAS_PDFFontMgr::GetFont( const WideStringView& wsFontFamily, uint32_t dwFontStyles, CPDF_Font** pPDFFont, @@ -89,7 +88,7 @@ CFX_RetainPtr CFGAS_PDFFontMgr::GetFont( bool bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold; bool bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic; ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic); - CFX_RetainPtr pFont = + RetainPtr pFont = FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch); if (pFont) m_FontMap[strKey] = pFont; @@ -185,7 +184,7 @@ bool CFGAS_PDFFontMgr::PsNameMatchDRFontName(const ByteStringView& bsPsName, return true; } -bool CFGAS_PDFFontMgr::GetCharWidth(const CFX_RetainPtr& pFont, +bool CFGAS_PDFFontMgr::GetCharWidth(const RetainPtr& pFont, wchar_t wUnicode, bool bCharCode, int32_t* pWidth) { @@ -201,7 +200,7 @@ bool CFGAS_PDFFontMgr::GetCharWidth(const CFX_RetainPtr& pFont, return true; } -void CFGAS_PDFFontMgr::SetFont(const CFX_RetainPtr& pFont, +void CFGAS_PDFFontMgr::SetFont(const RetainPtr& pFont, CPDF_Font* pPDFFont) { m_FDE2PDFFont[pFont] = pPDFFont; } diff --git a/xfa/fgas/font/cfgas_pdffontmgr.h b/xfa/fgas/font/cfgas_pdffontmgr.h index a31d865cec..1f7d49a4e7 100644 --- a/xfa/fgas/font/cfgas_pdffontmgr.h +++ b/xfa/fgas/font/cfgas_pdffontmgr.h @@ -11,9 +11,9 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/observable.h" +#include "core/fxcrt/retain_ptr.h" class CFGAS_FontMgr; class CFGAS_GEFont; @@ -25,22 +25,22 @@ class CFGAS_PDFFontMgr : public Observable { explicit CFGAS_PDFFontMgr(CPDF_Document* pDoc, CFGAS_FontMgr* pFontMgr); ~CFGAS_PDFFontMgr(); - CFX_RetainPtr GetFont(const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - CPDF_Font** pPDFFont, - bool bStrictMatch); - bool GetCharWidth(const CFX_RetainPtr& pFont, + RetainPtr GetFont(const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + CPDF_Font** pPDFFont, + bool bStrictMatch); + bool GetCharWidth(const RetainPtr& pFont, wchar_t wUnicode, bool bCharCode, int32_t* pWidth); - void SetFont(const CFX_RetainPtr& pFont, CPDF_Font* pPDFFont); + void SetFont(const RetainPtr& pFont, CPDF_Font* pPDFFont); private: - CFX_RetainPtr FindFont(const ByteString& strFamilyName, - bool bBold, - bool bItalic, - CPDF_Font** pPDFFont, - bool bStrictMatch); + RetainPtr FindFont(const ByteString& strFamilyName, + bool bBold, + bool bItalic, + CPDF_Font** pPDFFont, + bool bStrictMatch); ByteString PsNameToFontName(const ByteString& strPsName, bool bBold, bool bItalic); @@ -52,8 +52,8 @@ class CFGAS_PDFFontMgr : public Observable { CFX_UnownedPtr const m_pDoc; CFX_UnownedPtr const m_pFontMgr; - std::map, CPDF_Font*> m_FDE2PDFFont; - std::map> m_FontMap; + std::map, CPDF_Font*> m_FDE2PDFFont; + std::map> m_FontMap; }; #endif // XFA_FGAS_FONT_CFGAS_PDFFONTMGR_H_ diff --git a/xfa/fgas/layout/cfx_break.cpp b/xfa/fgas/layout/cfx_break.cpp index 52236f3176..5c5569ad44 100644 --- a/xfa/fgas/layout/cfx_break.cpp +++ b/xfa/fgas/layout/cfx_break.cpp @@ -73,7 +73,7 @@ void CFX_Break::SetVerticalScale(int32_t iScale) { m_iVerticalScale = iScale; } -void CFX_Break::SetFont(const CFX_RetainPtr& pFont) { +void CFX_Break::SetFont(const RetainPtr& pFont) { if (!pFont || pFont == m_pFont) return; diff --git a/xfa/fgas/layout/cfx_break.h b/xfa/fgas/layout/cfx_break.h index b45924e1e7..322fa2be8e 100644 --- a/xfa/fgas/layout/cfx_break.h +++ b/xfa/fgas/layout/cfx_break.h @@ -9,7 +9,7 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fgas/layout/cfx_breakline.h" @@ -37,7 +37,7 @@ class CFX_Break { void SetLayoutStyles(uint32_t dwLayoutStyles); uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; } - void SetFont(const CFX_RetainPtr& pFont); + void SetFont(const RetainPtr& pFont); void SetFontSize(float fFontSize); void SetTabWidth(float fTabWidth); int32_t GetTabWidth() const { return m_iTabWidth; } @@ -80,7 +80,7 @@ class CFX_Break { int32_t m_iCharSpace; int32_t m_iDefChar; wchar_t m_wDefChar; - CFX_RetainPtr m_pFont; + RetainPtr m_pFont; CFX_BreakLine m_Line[2]; CFX_BreakLine* m_pCurLine; int8_t m_iReadyLineIndex; diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h index bbf4558eb1..1109e2296b 100644 --- a/xfa/fgas/layout/cfx_breakpiece.h +++ b/xfa/fgas/layout/cfx_breakpiece.h @@ -10,9 +10,9 @@ #include #include "core/fxcrt/cfx_char.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fxfa/cxfa_textuserdata.h" class CFX_BreakPiece { @@ -41,7 +41,7 @@ class CFX_BreakPiece { uint32_t m_dwIdentity; uint32_t m_dwCharStyles; CFX_UnownedPtr> m_pChars; - CFX_RetainPtr m_pUserData; + RetainPtr m_pUserData; }; #endif // XFA_FGAS_LAYOUT_CFX_BREAKPIECE_H_ diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp index be5780fc7a..8768aa34ff 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak.cpp @@ -41,8 +41,7 @@ void CFX_RTFBreak::AddPositionedTab(float fTabPos) { m_PositionedTabs.insert(it, iTabPos); } -void CFX_RTFBreak::SetUserData( - const CFX_RetainPtr& pUserData) { +void CFX_RTFBreak::SetUserData(const RetainPtr& pUserData) { if (m_pUserData == pUserData) return; @@ -668,7 +667,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, ASSERT(pText->pFont && pText->pRect); - CFX_RetainPtr pFont = pText->pFont; + RetainPtr pFont = pText->pFont; CFX_RectF rtText(*pText->pRect); bool bRTLPiece = FX_IsOdd(pText->iBidiLevel); float fFontSize = pText->fFontSize; diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h index f5ad90838f..5a3f4313b5 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.h +++ b/xfa/fgas/layout/cfx_rtfbreak.h @@ -10,9 +10,9 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_unicode.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_renderdevice.h" #include "xfa/fgas/layout/cfx_break.h" #include "xfa/fxfa/cxfa_textuserdata.h" @@ -33,7 +33,7 @@ struct FX_RTFTEXTOBJ { WideString pStr; std::vector pWidths; - CFX_RetainPtr pFont; + RetainPtr pFont; const CFX_RectF* pRect; wchar_t wLineBreakChar; float fFontSize; @@ -51,7 +51,7 @@ class CFX_RTFBreak : public CFX_Break { void SetLineStartPos(float fLinePos); void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; } - void SetUserData(const CFX_RetainPtr& pUserData); + void SetUserData(const RetainPtr& pUserData); void AddPositionedTab(float fTabPos); @@ -92,7 +92,7 @@ class CFX_RTFBreak : public CFX_Break { bool m_bPagination; std::vector m_PositionedTabs; CFX_RTFLineAlignment m_iAlignment; - CFX_RetainPtr m_pUserData; + RetainPtr m_pUserData; }; #endif // XFA_FGAS_LAYOUT_CFX_RTFBREAK_H_ diff --git a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp index bda52fc76a..5f24631315 100644 --- a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp @@ -30,7 +30,7 @@ class CFX_RTFBreakTest : public testing::Test { } private: - CFX_RetainPtr font_; + RetainPtr font_; }; // As soon as you get one of the control characters the break is complete diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp index 9fe5a432f6..403b7e6c11 100644 --- a/xfa/fgas/layout/cfx_txtbreak.cpp +++ b/xfa/fgas/layout/cfx_txtbreak.cpp @@ -651,7 +651,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, const wchar_t* pStr = pTxtRun->wsStr.c_str(); int32_t* pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength - 1; - CFX_RetainPtr pFont = pTxtRun->pFont; + RetainPtr pFont = pTxtRun->pFont; uint32_t dwStyles = pTxtRun->dwStyles; CFX_RectF rtText(*pTxtRun->pRect); bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; @@ -909,7 +909,7 @@ std::vector CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, float fFontSize = pTxtRun->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); float fScale = fFontSize / 1000.0f; - CFX_RetainPtr pFont = pTxtRun->pFont; + RetainPtr pFont = pTxtRun->pFont; if (!pFont) bCharBBox = false; diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h index 959cd8eb48..e6f8da03d2 100644 --- a/xfa/fgas/layout/cfx_txtbreak.h +++ b/xfa/fgas/layout/cfx_txtbreak.h @@ -44,7 +44,7 @@ struct FX_TXTRUN { WideString wsStr; int32_t* pWidths; int32_t iLength; - CFX_RetainPtr pFont; + RetainPtr pFont; float fFontSize; uint32_t dwStyles; int32_t iHorizontalScale; diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp index 1f2a978171..f5d6ea98b2 100644 --- a/xfa/fwl/cfwl_barcode.cpp +++ b/xfa/fwl/cfwl_barcode.cpp @@ -167,7 +167,7 @@ void CFWL_Barcode::GenerateBarcodeImageCache() { if (pTheme) { CFWL_ThemePart part; part.m_pWidget = this; - if (CFX_RetainPtr pFont = pTheme->GetFont(&part)) { + if (RetainPtr pFont = pTheme->GetFont(&part)) { if (CFX_Font* pCXFont = pFont->GetDevFont()) m_pBarcodeEngine->SetFont(pCXFont); } diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index d1f0c99a39..fa5ee63b77 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -538,7 +538,7 @@ void CFWL_Edit::RenderText(CFX_RenderDevice* pRenderDev, const CFX_Matrix& mt) { ASSERT(pRenderDev); - CFX_RetainPtr font = m_EdtEngine.GetFont(); + RetainPtr font = m_EdtEngine.GetFont(); if (!font) return; @@ -635,7 +635,7 @@ void CFWL_Edit::UpdateEditParams() { } m_fFontSize = theme->GetFontSize(&part); - CFX_RetainPtr pFont = theme->GetFont(&part); + RetainPtr pFont = theme->GetFont(&part); if (!pFont) return; diff --git a/xfa/fwl/cfwl_themebackground.h b/xfa/fwl/cfwl_themebackground.h index 0141754c1e..65c29ebd7a 100644 --- a/xfa/fwl/cfwl_themebackground.h +++ b/xfa/fwl/cfwl_themebackground.h @@ -21,7 +21,7 @@ class CFWL_ThemeBackground : public CFWL_ThemePart { CXFA_Graphics* m_pGraphics; CXFA_Path* m_pPath; - CFX_RetainPtr m_pImage; + RetainPtr m_pImage; }; inline CFWL_ThemeBackground::CFWL_ThemeBackground() diff --git a/xfa/fwl/cfx_barcode_unittest.cpp b/xfa/fwl/cfx_barcode_unittest.cpp index b66d90495e..fe8aee4709 100644 --- a/xfa/fwl/cfx_barcode_unittest.cpp +++ b/xfa/fwl/cfx_barcode_unittest.cpp @@ -64,7 +64,7 @@ class BarcodeTest : public testing::Test { CFX_Matrix matrix_; std::unique_ptr barcode_; std::unique_ptr device_; - CFX_RetainPtr bitmap_; + RetainPtr bitmap_; }; TEST_F(BarcodeTest, Code39) { diff --git a/xfa/fwl/ifwl_themeprovider.h b/xfa/fwl/ifwl_themeprovider.h index 03767cfc06..32dc901377 100644 --- a/xfa/fwl/ifwl_themeprovider.h +++ b/xfa/fwl/ifwl_themeprovider.h @@ -7,8 +7,8 @@ #ifndef XFA_FWL_IFWL_THEMEPROVIDER_H_ #define XFA_FWL_IFWL_THEMEPROVIDER_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_gefont.h" class CFWL_ThemeBackground; @@ -27,8 +27,7 @@ class IFWL_ThemeProvider { virtual float GetCYBorderSize() const = 0; virtual CFX_RectF GetUIMargin(CFWL_ThemePart* pThemePart) const = 0; virtual float GetFontSize(CFWL_ThemePart* pThemePart) const = 0; - virtual CFX_RetainPtr GetFont( - CFWL_ThemePart* pThemePart) const = 0; + virtual RetainPtr GetFont(CFWL_ThemePart* pThemePart) const = 0; virtual float GetLineHeight(CFWL_ThemePart* pThemePart) const = 0; virtual float GetScrollBarWidth() const = 0; virtual FX_COLORREF GetTextColor(CFWL_ThemePart* pThemePart) const = 0; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 1eade9c70b..630da7793d 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -303,7 +303,7 @@ CFWL_FontManager::CFWL_FontManager() {} CFWL_FontManager::~CFWL_FontManager() {} -CFX_RetainPtr CFWL_FontManager::FindFont( +RetainPtr CFWL_FontManager::FindFont( const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index dd36778704..eb1423e602 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -10,9 +10,9 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fwl/theme/cfwl_utils.h" #include "xfa/fxgraphics/cxfa_graphics.h" @@ -39,7 +39,7 @@ class CFWL_WidgetTP { virtual void DrawBackground(CFWL_ThemeBackground* pParams); virtual void DrawText(CFWL_ThemeText* pParams); - const CFX_RetainPtr& GetFont() const { return m_pFDEFont; } + const RetainPtr& GetFont() const { return m_pFDEFont; } protected: struct CColorData { @@ -95,7 +95,7 @@ class CFWL_WidgetTP { uint32_t m_dwRefCount; std::unique_ptr m_pTextOut; - CFX_RetainPtr m_pFDEFont; + RetainPtr m_pFDEFont; std::unique_ptr m_pColorData; }; @@ -112,7 +112,7 @@ class CFWL_FontData { bool LoadFont(const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); - CFX_RetainPtr GetFont() const { return m_pFont; } + RetainPtr GetFont() const { return m_pFont; } protected: WideString m_wsFamily; @@ -122,7 +122,7 @@ class CFWL_FontData { std::unique_ptr m_pFontSource; #endif std::unique_ptr m_pFontMgr; - CFX_RetainPtr m_pFont; + RetainPtr m_pFont; }; class CFWL_FontManager { @@ -130,9 +130,9 @@ class CFWL_FontManager { static CFWL_FontManager* GetInstance(); static void DestroyInstance(); - CFX_RetainPtr FindFont(const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t dwCodePage); + RetainPtr FindFont(const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + uint16_t dwCodePage); protected: CFWL_FontManager(); diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h index 6ee9e45a13..857e9c03bb 100644 --- a/xfa/fxfa/cxfa_ffapp.h +++ b/xfa/fxfa/cxfa_ffapp.h @@ -12,8 +12,8 @@ #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fwl/cfwl_app.h" #include "xfa/fxfa/fxfa.h" diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 316987fcc3..ee31a46f50 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -334,7 +334,7 @@ void CXFA_FFDoc::CloseDoc() { m_pApp->ClearEventTargets(); } -CFX_RetainPtr CXFA_FFDoc::GetPDFNamedImage( +RetainPtr CXFA_FFDoc::GetPDFNamedImage( const WideStringView& wsName, int32_t& iImageXDpi, int32_t& iImageYDpi) { @@ -381,18 +381,18 @@ CFX_RetainPtr CXFA_FFDoc::GetPDFNamedImage( auto pAcc = pdfium::MakeRetain(pStream); pAcc->LoadAllData(); - CFX_RetainPtr pImageFileRead = + RetainPtr pImageFileRead = pdfium::MakeRetain( const_cast(pAcc->GetData()), pAcc->GetSize(), false); - CFX_RetainPtr pDibSource = XFA_LoadImageFromBuffer( + RetainPtr pDibSource = XFA_LoadImageFromBuffer( pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi); m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi}; return pDibSource; } bool CXFA_FFDoc::SavePackage(XFA_HashCode code, - const CFX_RetainPtr& pFile, + const RetainPtr& pFile, CFX_ChecksumContext* pCSContext) { CXFA_Document* doc = m_pDocumentParser->GetDocument(); auto pExport = pdfium::MakeUnique(doc); @@ -409,7 +409,7 @@ bool CXFA_FFDoc::SavePackage(XFA_HashCode code, pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); } -bool CXFA_FFDoc::ImportData(const CFX_RetainPtr& pStream, +bool CXFA_FFDoc::ImportData(const RetainPtr& pStream, bool bXDP) { auto importer = pdfium::MakeUnique(m_pDocumentParser->GetDocument()); diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h index 1d35c669da..ceec91f7db 100644 --- a/xfa/fxfa/cxfa_ffdoc.h +++ b/xfa/fxfa/cxfa_ffdoc.h @@ -24,12 +24,12 @@ class CXFA_FFDocView; struct FX_IMAGEDIB_AND_DPI { FX_IMAGEDIB_AND_DPI(); FX_IMAGEDIB_AND_DPI(const FX_IMAGEDIB_AND_DPI& that); - FX_IMAGEDIB_AND_DPI(const CFX_RetainPtr& pDib, + FX_IMAGEDIB_AND_DPI(const RetainPtr& pDib, int32_t xDpi, int32_t yDpi); ~FX_IMAGEDIB_AND_DPI(); - CFX_RetainPtr pDibSource; + RetainPtr pDibSource; int32_t iImageXDpi; int32_t iImageYDpi; }; @@ -39,7 +39,7 @@ inline FX_IMAGEDIB_AND_DPI::FX_IMAGEDIB_AND_DPI( const FX_IMAGEDIB_AND_DPI& that) = default; inline FX_IMAGEDIB_AND_DPI::FX_IMAGEDIB_AND_DPI( - const CFX_RetainPtr& pDib, + const RetainPtr& pDib, int32_t xDpi, int32_t yDpi) : pDibSource(pDib), iImageXDpi(xDpi), iImageYDpi(yDpi) {} @@ -70,21 +70,21 @@ class CXFA_FFDoc { CPDF_Document* GetPDFDoc() const { return m_pPDFDoc.Get(); } CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout); CXFA_FFDocView* GetDocView(); - CFX_RetainPtr GetPDFNamedImage(const WideStringView& wsName, - int32_t& iImageXDpi, - int32_t& iImageYDpi); + RetainPtr GetPDFNamedImage(const WideStringView& wsName, + int32_t& iImageXDpi, + int32_t& iImageYDpi); CFGAS_PDFFontMgr* GetPDFFontMgr() const { return m_pPDFFontMgr.get(); } bool SavePackage(XFA_HashCode code, - const CFX_RetainPtr& pFile, + const RetainPtr& pFile, CFX_ChecksumContext* pCSContext); - bool ImportData(const CFX_RetainPtr& pStream, + bool ImportData(const RetainPtr& pStream, bool bXDP = true); private: CFX_UnownedPtr const m_pDocEnvironment; std::unique_ptr m_pDocumentParser; - CFX_RetainPtr m_pStream; + RetainPtr m_pStream; CFX_UnownedPtr m_pApp; std::unique_ptr m_pNotify; CFX_UnownedPtr m_pPDFDoc; diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index ec6a29cd28..757867f076 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -45,7 +45,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus); - CFX_RetainPtr pDIBitmap = GetDataAcc()->GetImageImage(); + RetainPtr pDIBitmap = GetDataAcc()->GetImageImage(); if (!pDIBitmap) return; diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 1c9e014256..2189877afb 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -64,7 +64,7 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); DrawBorder(pGS, borderUI, m_rtUI, mtRotate); RenderCaption(pGS, &mtRotate); - CFX_RetainPtr pDIBitmap = m_pDataAcc->GetImageEditImage(); + RetainPtr pDIBitmap = m_pDataAcc->GetImageEditImage(); if (!pDIBitmap) return; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 0935f56b90..7763a19972 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -1414,7 +1414,7 @@ class CXFA_ImageRenderer { ~CXFA_ImageRenderer(); bool Start(CFX_RenderDevice* pDevice, - const CFX_RetainPtr& pDIBSource, + const RetainPtr& pDIBSource, FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, @@ -1424,7 +1424,7 @@ class CXFA_ImageRenderer { protected: bool StartDIBSource(); - void CompositeDIBitmap(const CFX_RetainPtr& pDIBitmap, + void CompositeDIBitmap(const RetainPtr& pDIBitmap, int left, int top, FX_ARGB mask_argb, @@ -1435,8 +1435,8 @@ class CXFA_ImageRenderer { CFX_RenderDevice* m_pDevice; int m_Status; CFX_Matrix m_ImageMatrix; - CFX_RetainPtr m_pDIBSource; - CFX_RetainPtr m_pCloneConvert; + RetainPtr m_pDIBSource; + RetainPtr m_pCloneConvert; int m_BitmapAlpha; FX_ARGB m_FillArgb; uint32_t m_Flags; @@ -1461,7 +1461,7 @@ CXFA_ImageRenderer::CXFA_ImageRenderer() CXFA_ImageRenderer::~CXFA_ImageRenderer() {} bool CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice, - const CFX_RetainPtr& pDIBSource, + const RetainPtr& pDIBSource, FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, @@ -1497,7 +1497,7 @@ bool CXFA_ImageRenderer::StartDIBSource() { m_Result = false; return false; } - CFX_RetainPtr pDib = m_pDIBSource; + RetainPtr pDib = m_pDIBSource; if (m_pDIBSource->HasAlpha() && !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE) && !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { @@ -1549,7 +1549,7 @@ bool CXFA_ImageRenderer::StartDIBSource() { FX_RECT dest_clip( dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); - CFX_RetainPtr pStretched = + RetainPtr pStretched = m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip); if (pStretched) { CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, m_FillArgb, @@ -1563,7 +1563,7 @@ bool CXFA_ImageRenderer::Continue() { if (m_pTransformer->Continue(nullptr)) return true; - CFX_RetainPtr pBitmap = m_pTransformer->DetachBitmap(); + RetainPtr pBitmap = m_pTransformer->DetachBitmap(); if (!pBitmap) return false; @@ -1589,7 +1589,7 @@ bool CXFA_ImageRenderer::Continue() { } void CXFA_ImageRenderer::CompositeDIBitmap( - const CFX_RetainPtr& pDIBitmap, + const RetainPtr& pDIBitmap, int left, int top, FX_ARGB mask_argb, @@ -1635,10 +1635,10 @@ void CXFA_ImageRenderer::CompositeDIBitmap( FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); rect.Intersect(m_pDevice->GetClipBox()); - CFX_RetainPtr pClone; + RetainPtr pClone; if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { pClone = m_pDevice->GetBackDrop()->Clone(&rect); - CFX_RetainPtr pForeBitmap = m_pDevice->GetBitmap(); + RetainPtr pForeBitmap = m_pDevice->GetBitmap(); pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), pForeBitmap, rect.left, rect.top); left = left >= 0 ? 0 : left; @@ -1667,8 +1667,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap( (m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) { return; } - CFX_RetainPtr pCloneConvert = - pDIBitmap->CloneConvert(FXDIB_Rgb); + RetainPtr pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb); if (!pCloneConvert) return; @@ -1684,7 +1683,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap( void XFA_DrawImage(CXFA_Graphics* pGS, const CFX_RectF& rtImage, const CFX_Matrix& matrix, - const CFX_RetainPtr& pDIBitmap, + const RetainPtr& pDIBitmap, int32_t iAspect, int32_t iImageXDpi, int32_t iImageYDpi, @@ -1885,11 +1884,11 @@ FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) { return FXCODEC_IMAGE_UNKNOWN; } -CFX_RetainPtr XFA_LoadImageData(CXFA_FFDoc* pDoc, - CXFA_Image* pImage, - bool& bNameImage, - int32_t& iImageXDpi, - int32_t& iImageYDpi) { +RetainPtr XFA_LoadImageData(CXFA_FFDoc* pDoc, + CXFA_Image* pImage, + bool& bNameImage, + int32_t& iImageXDpi, + int32_t& iImageYDpi) { WideString wsHref; WideString wsImage; pImage->GetHref(wsHref); @@ -1902,7 +1901,7 @@ CFX_RetainPtr XFA_LoadImageData(CXFA_FFDoc* pDoc, FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); ByteString bsContent; uint8_t* pImageBuffer = nullptr; - CFX_RetainPtr pImageFileRead; + RetainPtr pImageFileRead; if (wsImage.GetLength() > 0) { XFA_ATTRIBUTEENUM iEncoding = (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); @@ -1924,7 +1923,7 @@ CFX_RetainPtr XFA_LoadImageData(CXFA_FFDoc* pDoc, } else { WideString wsURL = wsHref; if (wsURL.Left(7) != L"http://" && wsURL.Left(6) != L"ftp://") { - CFX_RetainPtr pBitmap = + RetainPtr pBitmap = pDoc->GetPDFNamedImage(wsURL.AsStringView(), iImageXDpi, iImageYDpi); if (pBitmap) { bNameImage = true; @@ -1938,7 +1937,7 @@ CFX_RetainPtr XFA_LoadImageData(CXFA_FFDoc* pDoc, return nullptr; } bNameImage = false; - CFX_RetainPtr pBitmap = + RetainPtr pBitmap = XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi); FX_Free(pImageBuffer); return pBitmap; @@ -1964,8 +1963,8 @@ static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type, return dibFormat; } -CFX_RetainPtr XFA_LoadImageFromBuffer( - const CFX_RetainPtr& pImageFileRead, +RetainPtr XFA_LoadImageFromBuffer( + const RetainPtr& pImageFileRead, FXCODEC_IMAGE_TYPE type, int32_t& iImageXDpi, int32_t& iImageYDpi) { @@ -1998,7 +1997,7 @@ CFX_RetainPtr XFA_LoadImageFromBuffer( int32_t iComponents = pProgressiveDecoder->GetNumComponents(); int32_t iBpc = pProgressiveDecoder->GetBPC(); FXDIB_Format dibFormat = XFA_GetDIBFormat(type, iComponents, iBpc); - CFX_RetainPtr pBitmap = pdfium::MakeRetain(); + RetainPtr pBitmap = pdfium::MakeRetain(); pBitmap->Create(pProgressiveDecoder->GetWidth(), pProgressiveDecoder->GetHeight(), dibFormat); pBitmap->Clear(0xffffffff); diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 41bb94164b..c743742890 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -42,21 +42,21 @@ CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap); void XFA_DrawImage(CXFA_Graphics* pGS, const CFX_RectF& rtImage, const CFX_Matrix& matrix, - const CFX_RetainPtr& pDIBitmap, + const RetainPtr& pDIBitmap, int32_t iAspect, int32_t iImageXDpi, int32_t iImageYDpi, int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left, int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top); -CFX_RetainPtr XFA_LoadImageData(CXFA_FFDoc* pDoc, - CXFA_Image* pImage, - bool& bNameImage, - int32_t& iImageXDpi, - int32_t& iImageYDpi); +RetainPtr XFA_LoadImageData(CXFA_FFDoc* pDoc, + CXFA_Image* pImage, + bool& bNameImage, + int32_t& iImageXDpi, + int32_t& iImageYDpi); -CFX_RetainPtr XFA_LoadImageFromBuffer( - const CFX_RetainPtr& pImageFileRead, +RetainPtr XFA_LoadImageFromBuffer( + const RetainPtr& pImageFileRead, FXCODEC_IMAGE_TYPE type, int32_t& iImageXDpi, int32_t& iImageYDpi); diff --git a/xfa/fxfa/cxfa_fileread.h b/xfa/fxfa/cxfa_fileread.h index 2dba4d23df..62fa4c67bb 100644 --- a/xfa/fxfa/cxfa_fileread.h +++ b/xfa/fxfa/cxfa_fileread.h @@ -9,8 +9,8 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_stream.h" +#include "core/fxcrt/retain_ptr.h" class CPDF_Stream; class CPDF_StreamAcc; @@ -30,7 +30,7 @@ class CXFA_FileRead : public IFX_SeekableStream { bool WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) override; private: - std::vector> m_Data; + std::vector> m_Data; }; #endif // XFA_FXFA_CXFA_FILEREAD_H_ diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp index 5a11dd5dc0..ddf8ffada4 100644 --- a/xfa/fxfa/cxfa_fontmgr.cpp +++ b/xfa/fxfa/cxfa_fontmgr.cpp @@ -23,7 +23,7 @@ CXFA_FontMgr::CXFA_FontMgr() {} CXFA_FontMgr::~CXFA_FontMgr() {} -CFX_RetainPtr CXFA_FontMgr::GetFont( +RetainPtr CXFA_FontMgr::GetFont( CXFA_FFDoc* hDoc, const WideStringView& wsFontFamily, uint32_t dwFontStyles, @@ -39,7 +39,7 @@ CFX_RetainPtr CXFA_FontMgr::GetFont( CFGAS_PDFFontMgr* pMgr = hDoc->GetPDFFontMgr(); CPDF_Font* pPDFFont = nullptr; - CFX_RetainPtr pFont; + RetainPtr pFont; if (pMgr) { pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, &pPDFFont, true); diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h index b7d1f51ff2..55ee6bbc4d 100644 --- a/xfa/fxfa/cxfa_fontmgr.h +++ b/xfa/fxfa/cxfa_fontmgr.h @@ -11,9 +11,9 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_defaultfontmanager.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fgas/font/cfgas_pdffontmgr.h" @@ -26,15 +26,15 @@ class CXFA_FontMgr { CXFA_FontMgr(); ~CXFA_FontMgr(); - CFX_RetainPtr GetFont(CXFA_FFDoc* hDoc, - const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); + RetainPtr GetFont(CXFA_FFDoc* hDoc, + const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); void SetDefFontMgr(std::unique_ptr pFontMgr); private: std::unique_ptr m_pDefFontMgr; - std::map> m_FontMap; + std::map> m_FontMap; }; #endif // XFA_FXFA_CXFA_FONTMGR_H_ diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp index 35456eff16..f27b5ddef5 100644 --- a/xfa/fxfa/cxfa_fwltheme.cpp +++ b/xfa/fxfa/cxfa_fwltheme.cpp @@ -185,7 +185,7 @@ float CXFA_FWLTheme::GetFontSize(CFWL_ThemePart* pThemePart) const { return FWLTHEME_CAPACITY_FontSize; } -CFX_RetainPtr CXFA_FWLTheme::GetFont( +RetainPtr CXFA_FWLTheme::GetFont( CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) return pWidget->GetDataAcc()->GetFDEFont(); diff --git a/xfa/fxfa/cxfa_fwltheme.h b/xfa/fxfa/cxfa_fwltheme.h index 48fb744cb2..7813545447 100644 --- a/xfa/fxfa/cxfa_fwltheme.h +++ b/xfa/fxfa/cxfa_fwltheme.h @@ -37,8 +37,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { float GetCYBorderSize() const override; CFX_RectF GetUIMargin(CFWL_ThemePart* pThemePart) const override; float GetFontSize(CFWL_ThemePart* pThemePart) const override; - CFX_RetainPtr GetFont( - CFWL_ThemePart* pThemePart) const override; + RetainPtr GetFont(CFWL_ThemePart* pThemePart) const override; float GetLineHeight(CFWL_ThemePart* pThemePart) const override; float GetScrollBarWidth() const override; FX_COLORREF GetTextColor(CFWL_ThemePart* pThemePart) const override; @@ -59,7 +58,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { std::unique_ptr m_pCaretTP; std::unique_ptr m_pBarcodeTP; std::unique_ptr m_pTextOut; - CFX_RetainPtr m_pCalendarFont; + RetainPtr m_pCalendarFont; WideString m_wsResource; CFX_UnownedPtr const m_pApp; CFX_RectF m_Rect; diff --git a/xfa/fxfa/cxfa_linkuserdata.h b/xfa/fxfa/cxfa_linkuserdata.h index 7a9648c9b5..3d0f95e91c 100644 --- a/xfa/fxfa/cxfa_linkuserdata.h +++ b/xfa/fxfa/cxfa_linkuserdata.h @@ -7,14 +7,14 @@ #ifndef XFA_FXFA_CXFA_LINKUSERDATA_H_ #define XFA_FXFA_CXFA_LINKUSERDATA_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" -class CXFA_LinkUserData : public CFX_Retainable { +class CXFA_LinkUserData : public Retainable { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); const wchar_t* GetLinkURL() const { return m_wsURLContent.c_str(); } diff --git a/xfa/fxfa/cxfa_loadercontext.h b/xfa/fxfa/cxfa_loadercontext.h index 64ab50696b..06e3f117d8 100644 --- a/xfa/fxfa/cxfa_loadercontext.h +++ b/xfa/fxfa/cxfa_loadercontext.h @@ -31,7 +31,7 @@ class CXFA_LoaderContext { uint32_t m_dwFlags; CFX_XMLNode* m_pXMLNode; CXFA_Node* m_pNode; - CFX_RetainPtr m_pParentStyle; + RetainPtr m_pParentStyle; std::vector m_lineHeights; std::vector m_BlocksHeight; }; diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index bbc61d40f2..038f451ad9 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -689,9 +689,9 @@ bool CXFA_TextLayout::LoadRichText( CFX_XMLNode* pXMLNode, const CFX_SizeF& szText, float& fLinePos, - const CFX_RetainPtr& pParentStyle, + const RetainPtr& pParentStyle, bool bSavePieces, - CFX_RetainPtr pLinkData, + RetainPtr pLinkData, bool bEndBreak, bool bIsOl, int32_t iLiCount) { @@ -703,7 +703,7 @@ bool CXFA_TextLayout::LoadRichText( CFX_CSSDisplay eDisplay = CFX_CSSDisplay::None; bool bContentNode = false; float fSpaceBelow = 0; - CFX_RetainPtr pStyle; + RetainPtr pStyle; WideString wsName; if (bEndBreak) { bool bCurOl = false; @@ -1008,7 +1008,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, if (iPieces < 1) return; - CFX_RetainPtr pStyle; + RetainPtr pStyle; if (bSavePieces) { auto pNew = pdfium::MakeUnique(); CXFA_PieceLine* pPieceLine = pNew.get(); diff --git a/xfa/fxfa/cxfa_textlayout.h b/xfa/fxfa/cxfa_textlayout.h index 50ee83fd75..5856826166 100644 --- a/xfa/fxfa/cxfa_textlayout.h +++ b/xfa/fxfa/cxfa_textlayout.h @@ -79,9 +79,9 @@ class CXFA_TextLayout { bool LoadRichText(CFX_XMLNode* pXMLNode, const CFX_SizeF& szText, float& fLinePos, - const CFX_RetainPtr& pParentStyle, + const RetainPtr& pParentStyle, bool bSavePieces, - CFX_RetainPtr pLinkData, + RetainPtr pLinkData, bool bEndBreak = true, bool bIsOl = false, int32_t iLiCount = 0); diff --git a/xfa/fxfa/cxfa_textparsecontext.h b/xfa/fxfa/cxfa_textparsecontext.h index 3cd5710728..20d914bc59 100644 --- a/xfa/fxfa/cxfa_textparsecontext.h +++ b/xfa/fxfa/cxfa_textparsecontext.h @@ -29,7 +29,7 @@ class CXFA_TextParseContext { } const std::vector& GetDecls() { return decls_; } - CFX_RetainPtr m_pParentStyle; + RetainPtr m_pParentStyle; private: std::vector decls_; diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp index 3c78a8686d..9cbb72aa19 100644 --- a/xfa/fxfa/cxfa_textparser.cpp +++ b/xfa/fxfa/cxfa_textparser.cpp @@ -88,7 +88,7 @@ std::unique_ptr CXFA_TextParser::LoadDefaultSheetStyle() { : nullptr; } -CFX_RetainPtr CXFA_TextParser::CreateRootStyle( +RetainPtr CXFA_TextParser::CreateRootStyle( CXFA_TextProvider* pTextProvider) { CXFA_Font font = pTextProvider->GetFontNode(); CXFA_Para para = pTextProvider->GetParaNode(); @@ -150,7 +150,7 @@ CFX_RetainPtr CXFA_TextParser::CreateRootStyle( return pStyle; } -CFX_RetainPtr CXFA_TextParser::CreateStyle( +RetainPtr CXFA_TextParser::CreateStyle( CFX_CSSComputedStyle* pParentStyle) { auto pNewStyle = m_pSelector->CreateComputedStyle(pParentStyle); ASSERT(pNewStyle); @@ -171,7 +171,7 @@ CFX_RetainPtr CXFA_TextParser::CreateStyle( return pNewStyle; } -CFX_RetainPtr CXFA_TextParser::ComputeStyle( +RetainPtr CXFA_TextParser::ComputeStyle( CFX_XMLNode* pXMLNode, CFX_CSSComputedStyle* pParentStyle) { auto it = m_mapXMLNodeToParseContext.find(pXMLNode); @@ -215,7 +215,7 @@ void CXFA_TextParser::ParseRichText(CFX_XMLNode* pXMLNode, if (!tagProvider->m_bTagAvailable) return; - CFX_RetainPtr pNewStyle; + RetainPtr pNewStyle; if ((tagProvider->GetTagName() != L"body") || (tagProvider->GetTagName() != L"html")) { auto pTextContext = pdfium::MakeUnique(); @@ -315,7 +315,7 @@ bool CXFA_TextParser::IsSpaceRun(CFX_CSSComputedStyle* pStyle) const { return false; } -CFX_RetainPtr CXFA_TextParser::GetFont( +RetainPtr CXFA_TextParser::GetFont( CXFA_TextProvider* pTextProvider, CFX_CSSComputedStyle* pStyle) const { WideStringView wsFamily = L"Courier"; diff --git a/xfa/fxfa/cxfa_textparser.h b/xfa/fxfa/cxfa_textparser.h index ee5c38d2af..9a2232efa1 100644 --- a/xfa/fxfa/cxfa_textparser.h +++ b/xfa/fxfa/cxfa_textparser.h @@ -10,9 +10,9 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/fx_dib.h" #include "xfa/fgas/font/cfgas_gefont.h" @@ -32,9 +32,9 @@ class CXFA_TextParser { void Reset(); void DoParse(CFX_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); - CFX_RetainPtr CreateRootStyle( + RetainPtr CreateRootStyle( CXFA_TextProvider* pTextProvider); - CFX_RetainPtr ComputeStyle( + RetainPtr ComputeStyle( CFX_XMLNode* pXMLNode, CFX_CSSComputedStyle* pParentStyle); @@ -49,8 +49,8 @@ class CXFA_TextParser { bool GetTabstops(CFX_CSSComputedStyle* pStyle, CXFA_TextTabstopsContext* pTabstopContext); - CFX_RetainPtr GetFont(CXFA_TextProvider* pTextProvider, - CFX_CSSComputedStyle* pStyle) const; + RetainPtr GetFont(CXFA_TextProvider* pTextProvider, + CFX_CSSComputedStyle* pStyle) const; float GetFontSize(CXFA_TextProvider* pTextProvider, CFX_CSSComputedStyle* pStyle) const; @@ -113,7 +113,7 @@ class CXFA_TextParser { void ParseRichText(CFX_XMLNode* pXMLNode, CFX_CSSComputedStyle* pParentStyle); std::unique_ptr ParseTagInfo(CFX_XMLNode* pXMLNode); std::unique_ptr LoadDefaultSheetStyle(); - CFX_RetainPtr CreateStyle( + RetainPtr CreateStyle( CFX_CSSComputedStyle* pParentStyle); bool m_bParsed; diff --git a/xfa/fxfa/cxfa_textpiece.h b/xfa/fxfa/cxfa_textpiece.h index 4ea5a4158c..b5025d2970 100644 --- a/xfa/fxfa/cxfa_textpiece.h +++ b/xfa/fxfa/cxfa_textpiece.h @@ -33,8 +33,8 @@ class CXFA_TextPiece { FX_ARGB dwColor; float fFontSize; CFX_RectF rtPiece; - CFX_RetainPtr pFont; - CFX_RetainPtr pLinkData; + RetainPtr pFont; + RetainPtr pLinkData; }; #endif // XFA_FXFA_CXFA_TEXTPIECE_H_ diff --git a/xfa/fxfa/cxfa_textuserdata.cpp b/xfa/fxfa/cxfa_textuserdata.cpp index 51a2f43194..6c46978609 100644 --- a/xfa/fxfa/cxfa_textuserdata.cpp +++ b/xfa/fxfa/cxfa_textuserdata.cpp @@ -12,12 +12,12 @@ #include "xfa/fxfa/cxfa_linkuserdata.h" CXFA_TextUserData::CXFA_TextUserData( - const CFX_RetainPtr& pStyle) + const RetainPtr& pStyle) : m_pStyle(pStyle) {} CXFA_TextUserData::CXFA_TextUserData( - const CFX_RetainPtr& pStyle, - const CFX_RetainPtr& pLinkData) + const RetainPtr& pStyle, + const RetainPtr& pLinkData) : m_pStyle(pStyle), m_pLinkData(pLinkData) {} CXFA_TextUserData::~CXFA_TextUserData() {} diff --git a/xfa/fxfa/cxfa_textuserdata.h b/xfa/fxfa/cxfa_textuserdata.h index 442e6318c0..c1af217bf1 100644 --- a/xfa/fxfa/cxfa_textuserdata.h +++ b/xfa/fxfa/cxfa_textuserdata.h @@ -7,23 +7,23 @@ #ifndef XFA_FXFA_CXFA_TEXTUSERDATA_H_ #define XFA_FXFA_CXFA_TEXTUSERDATA_H_ -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" class CFX_CSSComputedStyle; class CXFA_LinkUserData; -class CXFA_TextUserData : public CFX_Retainable { +class CXFA_TextUserData : public Retainable { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); - CFX_RetainPtr m_pStyle; - CFX_RetainPtr m_pLinkData; + RetainPtr m_pStyle; + RetainPtr m_pLinkData; private: - explicit CXFA_TextUserData(const CFX_RetainPtr& pStyle); - CXFA_TextUserData(const CFX_RetainPtr& pStyle, - const CFX_RetainPtr& pLinkData); + explicit CXFA_TextUserData(const RetainPtr& pStyle); + CXFA_TextUserData(const RetainPtr& pStyle, + const RetainPtr& pLinkData); ~CXFA_TextUserData() override; }; diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 791b814d9e..260581e73b 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -91,7 +91,7 @@ class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData { return !!m_pDIBitmap; } - CFX_RetainPtr m_pDIBitmap; + RetainPtr m_pDIBitmap; bool m_bNamedImage; int32_t m_iImageXDpi; int32_t m_iImageYDpi; @@ -147,7 +147,7 @@ class CXFA_ImageEditData : public CXFA_FieldLayoutData { return !!m_pDIBitmap; } - CFX_RetainPtr m_pDIBitmap; + RetainPtr m_pDIBitmap; bool m_bNamedImage; int32_t m_iImageXDpi; int32_t m_iImageYDpi; @@ -919,7 +919,7 @@ bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) { LoadImageImage(); size.clear(); - CFX_RetainPtr pBitmap = GetImageImage(); + RetainPtr pBitmap = GetImageImage(); if (pBitmap) { int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; @@ -949,7 +949,7 @@ bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) { LoadImageEditImage(); size.clear(); - CFX_RetainPtr pBitmap = GetImageEditImage(); + RetainPtr pBitmap = GetImageEditImage(); if (pBitmap) { int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; @@ -1459,22 +1459,21 @@ CXFA_TextLayout* CXFA_WidgetAcc::GetTextLayout() { : nullptr; } -CFX_RetainPtr CXFA_WidgetAcc::GetImageImage() { +RetainPtr CXFA_WidgetAcc::GetImageImage() { return m_pLayoutData ? static_cast(m_pLayoutData.get()) ->m_pDIBitmap : nullptr; } -CFX_RetainPtr CXFA_WidgetAcc::GetImageEditImage() { +RetainPtr CXFA_WidgetAcc::GetImageEditImage() { return m_pLayoutData ? static_cast(m_pLayoutData.get()) ->m_pDIBitmap : nullptr; } -void CXFA_WidgetAcc::SetImageImage( - const CFX_RetainPtr& newImage) { +void CXFA_WidgetAcc::SetImageImage(const RetainPtr& newImage) { CXFA_ImageLayoutData* pData = static_cast(m_pLayoutData.get()); if (pData->m_pDIBitmap != newImage) @@ -1482,7 +1481,7 @@ void CXFA_WidgetAcc::SetImageImage( } void CXFA_WidgetAcc::SetImageEditImage( - const CFX_RetainPtr& newImage) { + const RetainPtr& newImage) { CXFA_ImageEditData* pData = static_cast(m_pLayoutData.get()); if (pData->m_pDIBitmap != newImage) @@ -1493,7 +1492,7 @@ CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() { return m_pLayoutData.get(); } -CFX_RetainPtr CXFA_WidgetAcc::GetFDEFont() { +RetainPtr CXFA_WidgetAcc::GetFDEFont() { WideStringView wsFontName = L"Courier"; uint32_t dwFontStyle = 0; if (CXFA_Font font = GetFont(false)) { diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 54fd36077d..be26b94806 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -9,8 +9,8 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/fx_dib.h" #include "xfa/fxfa/parser/cxfa_box.h" @@ -70,14 +70,14 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { void GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi); CXFA_TextLayout* GetCaptionTextLayout(); CXFA_TextLayout* GetTextLayout(); - CFX_RetainPtr GetImageImage(); - CFX_RetainPtr GetImageEditImage(); - void SetImageImage(const CFX_RetainPtr& newImage); - void SetImageEditImage(const CFX_RetainPtr& newImage); + RetainPtr GetImageImage(); + RetainPtr GetImageEditImage(); + void SetImageImage(const RetainPtr& newImage); + void SetImageEditImage(const RetainPtr& newImage); void UpdateUIDisplay(CXFA_FFWidget* pExcept = nullptr); CXFA_Node* GetDatasets(); - CFX_RetainPtr GetFDEFont(); + RetainPtr GetFDEFont(); float GetFontSize(); FX_ARGB GetTextColor(); float GetLineHeight(); diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp index 6af7bb7445..0b38fd1fab 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp @@ -4591,7 +4591,7 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, std::unique_ptr argOne = GetSimpleValue(pThis, args, 0); ByteString urlString = ValueToUTF8String(argOne.get()); - CFX_RetainPtr pFile = + RetainPtr pFile = pAppProvider->DownloadURL(WideString::FromUTF8(urlString.AsStringView())); if (!pFile) return; diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h index b8595d41dd..929594ff38 100644 --- a/xfa/fxfa/fxfa.h +++ b/xfa/fxfa/fxfa.h @@ -9,7 +9,7 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fxfa/cxfa_widgetacc.h" #include "xfa/fxfa/fxfa_basic.h" @@ -170,7 +170,7 @@ class IXFA_AppProvider { * @param[in] wsURL - http, ftp, such as * "http://www.w3.org/TR/REC-xml-names/". */ - virtual CFX_RetainPtr DownloadURL( + virtual RetainPtr DownloadURL( const WideString& wsURL) = 0; /** @@ -259,7 +259,7 @@ class IXFA_DocEnvironment { virtual bool SetGlobalProperty(CXFA_FFDoc* hDoc, const ByteStringView& szPropName, CFXJSE_Value* pValue) = 0; - virtual CFX_RetainPtr OpenLinkedFile( + virtual RetainPtr OpenLinkedFile( CXFA_FFDoc* hDoc, const WideString& wsLink) = 0; }; diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index edc7b23b6b..b0de057e2a 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -328,7 +328,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, void RegenerateFormFile_Container( CXFA_Node* pNode, - const CFX_RetainPtr& pStream, + const RetainPtr& pStream, bool bSaveXML) { XFA_Element eType = pNode->GetElementType(); if (eType == XFA_Element::Field || eType == XFA_Element::Draw || @@ -385,7 +385,7 @@ void RegenerateFormFile_Container( void XFA_DataExporter_RegenerateFormFile( CXFA_Node* pNode, - const CFX_RetainPtr& pStream, + const RetainPtr& pStream, const char* pChecksum, bool bSaveXML) { if (pNode->IsModelNode()) { @@ -460,12 +460,11 @@ CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) CXFA_DataExporter::~CXFA_DataExporter() {} -bool CXFA_DataExporter::Export( - const CFX_RetainPtr& pWrite) { +bool CXFA_DataExporter::Export(const RetainPtr& pWrite) { return Export(pWrite, m_pDocument->GetRoot(), 0, nullptr); } -bool CXFA_DataExporter::Export(const CFX_RetainPtr& pWrite, +bool CXFA_DataExporter::Export(const RetainPtr& pWrite, CXFA_Node* pNode, uint32_t dwFlag, const char* pChecksum) { @@ -479,7 +478,7 @@ bool CXFA_DataExporter::Export(const CFX_RetainPtr& pWrite, } bool CXFA_DataExporter::Export( - const CFX_RetainPtr& pStream, + const RetainPtr& pStream, CXFA_Node* pNode, uint32_t dwFlag, const char* pChecksum) { diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h index 4c0d90af9e..0820560c87 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.h +++ b/xfa/fxfa/parser/cxfa_dataexporter.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_PARSER_CXFA_DATAEXPORTER_H_ #define XFA_FXFA_PARSER_CXFA_DATAEXPORTER_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/retain_ptr.h" class CXFA_Document; class CXFA_Node; @@ -20,14 +20,14 @@ class CXFA_DataExporter { explicit CXFA_DataExporter(CXFA_Document* pDocument); ~CXFA_DataExporter(); - bool Export(const CFX_RetainPtr& pWrite); - bool Export(const CFX_RetainPtr& pWrite, + bool Export(const RetainPtr& pWrite); + bool Export(const RetainPtr& pWrite, CXFA_Node* pNode, uint32_t dwFlag, const char* pChecksum); private: - bool Export(const CFX_RetainPtr& pStream, + bool Export(const RetainPtr& pStream, CXFA_Node* pNode, uint32_t dwFlag, const char* pChecksum); diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index e4ae3d0796..ab18f6182d 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -25,7 +25,7 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) CXFA_DataImporter::~CXFA_DataImporter() {} bool CXFA_DataImporter::ImportData( - const CFX_RetainPtr& pDataDocument) { + const RetainPtr& pDataDocument) { auto pDataDocumentParser = pdfium::MakeUnique(m_pDocument.Get(), false); if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != diff --git a/xfa/fxfa/parser/cxfa_dataimporter.h b/xfa/fxfa/parser/cxfa_dataimporter.h index d3af1de517..dc7764ccad 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.h +++ b/xfa/fxfa/parser/cxfa_dataimporter.h @@ -7,9 +7,9 @@ #ifndef XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_ #define XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CXFA_Document; class IFX_SeekableStream; @@ -19,7 +19,7 @@ class CXFA_DataImporter { explicit CXFA_DataImporter(CXFA_Document* pDocument); ~CXFA_DataImporter(); - bool ImportData(const CFX_RetainPtr& pDataDocument); + bool ImportData(const RetainPtr& pDataDocument); private: CFX_UnownedPtr const m_pDocument; diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 99b36749d1..b8ff8f860c 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -18,7 +18,7 @@ CXFA_DocumentParser::~CXFA_DocumentParser() { } int32_t CXFA_DocumentParser::StartParse( - const CFX_RetainPtr& pStream, + const RetainPtr& pStream, XFA_XDPPACKET ePacketID) { m_pDocument.reset(); m_nodeParser.CloseParser(); diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h index ad3f17f8e8..e788480751 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.h +++ b/xfa/fxfa/parser/cxfa_document_parser.h @@ -22,7 +22,7 @@ class CXFA_DocumentParser { explicit CXFA_DocumentParser(CXFA_FFNotify* pNotify); ~CXFA_DocumentParser(); - int32_t StartParse(const CFX_RetainPtr& pStream, + int32_t StartParse(const RetainPtr& pStream, XFA_XDPPACKET ePacketID); int32_t DoParse(); diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 5b58761712..4574ae48d7 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -273,7 +273,7 @@ void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { } int32_t CXFA_SimpleParser::StartParse( - const CFX_RetainPtr& pStream, + const RetainPtr& pStream, XFA_XDPPACKET ePacketID) { CloseParser(); m_pFileRead = pStream; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index 91bfb054b5..00250e7257 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -25,7 +25,7 @@ class CXFA_SimpleParser { CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser); ~CXFA_SimpleParser(); - int32_t StartParse(const CFX_RetainPtr& pStream, + int32_t StartParse(const RetainPtr& pStream, XFA_XDPPACKET ePacketID); int32_t DoParse(); CFX_XMLNode* ParseXMLData(const ByteString& wsXML); @@ -77,8 +77,8 @@ class CXFA_SimpleParser { CFX_XMLParser* m_pXMLParser; std::unique_ptr m_pXMLDoc; - CFX_RetainPtr m_pStream; - CFX_RetainPtr m_pFileRead; + RetainPtr m_pStream; + RetainPtr m_pFileRead; CXFA_Document* m_pFactory; CXFA_Node* m_pRootNode; XFA_XDPPACKET m_ePacketID; diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index 404586bd56..b6839ef708 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -155,7 +155,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); void XFA_DataExporter_RegenerateFormFile( CXFA_Node* pNode, - const CFX_RetainPtr& pStream, + const RetainPtr& pStream, const char* pChecksum = nullptr, bool bSaveXML = false); diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp index a94e99e200..7cb83e10aa 100644 --- a/xfa/fxgraphics/cxfa_graphics.cpp +++ b/xfa/fxgraphics/cxfa_graphics.cpp @@ -194,7 +194,7 @@ void CXFA_Graphics::FillPath(CXFA_Path* path, RenderDeviceFillPath(path, fillMode, matrix); } -void CXFA_Graphics::StretchImage(const CFX_RetainPtr& source, +void CXFA_Graphics::StretchImage(const RetainPtr& source, const CFX_RectF& rect, const CFX_Matrix& matrix) { if (!source) @@ -305,14 +305,14 @@ void CXFA_Graphics::RenderDeviceFillPath(const CXFA_Path* path, } void CXFA_Graphics::RenderDeviceStretchImage( - const CFX_RetainPtr& source, + const RetainPtr& source, const CFX_RectF& rect, const CFX_Matrix& matrix) { CFX_Matrix m1(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, m_info.CTM.f); m1.Concat(matrix); - CFX_RetainPtr bmp1 = + RetainPtr bmp1 = source->StretchTo(static_cast(rect.Width()), static_cast(rect.Height()), 0, nullptr); CFX_Matrix m2(rect.Width(), 0.0, 0.0, rect.Height(), rect.left, rect.top); @@ -320,10 +320,10 @@ void CXFA_Graphics::RenderDeviceStretchImage( int32_t left; int32_t top; - CFX_RetainPtr bmp2 = bmp1->FlipImage(false, true); - CFX_RetainPtr bmp3 = bmp2->TransformTo(&m2, &left, &top); + RetainPtr bmp2 = bmp1->FlipImage(false, true); + RetainPtr bmp3 = bmp2->TransformTo(&m2, &left, &top); CFX_RectF r = GetClipRect(); - CFX_RetainPtr bitmap = m_renderDevice->GetBitmap(); + RetainPtr bitmap = m_renderDevice->GetBitmap(); bitmap->CompositeBitmap(FXSYS_round(r.left), FXSYS_round(r.top), FXSYS_round(r.Width()), FXSYS_round(r.Height()), bmp3, FXSYS_round(r.left - left), FXSYS_round(r.top - top)); @@ -333,7 +333,7 @@ void CXFA_Graphics::FillPathWithPattern(const CXFA_Path* path, FX_FillMode fillMode, const CFX_Matrix& matrix) { CXFA_Pattern* pattern = m_info.fillColor.GetPattern(); - CFX_RetainPtr bitmap = m_renderDevice->GetBitmap(); + RetainPtr bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); int32_t height = bitmap->GetHeight(); auto bmp = pdfium::MakeRetain(); @@ -366,7 +366,7 @@ void CXFA_Graphics::FillPathWithPattern(const CXFA_Path* path, void CXFA_Graphics::FillPathWithShading(const CXFA_Path* path, FX_FillMode fillMode, const CFX_Matrix& matrix) { - CFX_RetainPtr bitmap = m_renderDevice->GetBitmap(); + RetainPtr bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); int32_t height = bitmap->GetHeight(); float start_x = m_info.fillColor.GetShading()->m_beginPoint.x; @@ -481,9 +481,8 @@ void CXFA_Graphics::FillPathWithShading(const CXFA_Path* path, } } -void CXFA_Graphics::SetDIBitsWithMatrix( - const CFX_RetainPtr& source, - const CFX_Matrix& matrix) { +void CXFA_Graphics::SetDIBitsWithMatrix(const RetainPtr& source, + const CFX_Matrix& matrix) { if (matrix.IsIdentity()) { m_renderDevice->SetDIBits(source, 0, 0); } else { @@ -492,8 +491,8 @@ void CXFA_Graphics::SetDIBitsWithMatrix( m.Concat(matrix); int32_t left; int32_t top; - CFX_RetainPtr bmp1 = source->FlipImage(false, true); - CFX_RetainPtr bmp2 = bmp1->TransformTo(&m, &left, &top); + RetainPtr bmp1 = source->FlipImage(false, true); + RetainPtr bmp2 = bmp1->TransformTo(&m, &left, &top); m_renderDevice->SetDIBits(bmp2, left, top); } } diff --git a/xfa/fxgraphics/cxfa_graphics.h b/xfa/fxgraphics/cxfa_graphics.h index 99f86870c3..6b9dcb9a86 100644 --- a/xfa/fxgraphics/cxfa_graphics.h +++ b/xfa/fxgraphics/cxfa_graphics.h @@ -65,7 +65,7 @@ class CXFA_Graphics { void FillPath(CXFA_Path* path, FX_FillMode fillMode, const CFX_Matrix* matrix); - void StretchImage(const CFX_RetainPtr& source, + void StretchImage(const RetainPtr& source, const CFX_RectF& rect, const CFX_Matrix& matrix); void ConcatMatrix(const CFX_Matrix* matrix); @@ -91,7 +91,7 @@ class CXFA_Graphics { void RenderDeviceFillPath(const CXFA_Path* path, FX_FillMode fillMode, const CFX_Matrix* matrix); - void RenderDeviceStretchImage(const CFX_RetainPtr& source, + void RenderDeviceStretchImage(const RetainPtr& source, const CFX_RectF& rect, const CFX_Matrix& matrix); @@ -102,7 +102,7 @@ class CXFA_Graphics { FX_FillMode fillMode, const CFX_Matrix& matrix); - void SetDIBitsWithMatrix(const CFX_RetainPtr& source, + void SetDIBitsWithMatrix(const RetainPtr& source, const CFX_Matrix& matrix); CFX_RenderDevice* const m_renderDevice; // Not owned. -- cgit v1.2.3