diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-09-26 10:52:53 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-26 15:24:34 +0000 |
commit | 15dffdf6bd8d595193cfb072974a8efeb8052a91 (patch) | |
tree | 6f29c7c7eb78f6d1453a86ed643f2d1e41533f2b /core | |
parent | 1a43b3064dc38a55de4b1d727237806578bb3ef9 (diff) | |
download | pdfium-15dffdf6bd8d595193cfb072974a8efeb8052a91.tar.xz |
Remove fx_text_int.h
The CFX_SizeGlyphCache is only used internally by the CFX_FaceCache.
This CL moves the definition to that file and removes fx_text_int.h
Change-Id: I38f26f437f0eaa72492995ae7442d5c38ed2f229
Reviewed-on: https://pdfium-review.googlesource.com/14771
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fxge/apple/fx_apple_platform.cpp | 1 | ||||
-rw-r--r-- | core/fxge/apple/fx_quartz_device.cpp | 1 | ||||
-rw-r--r-- | core/fxge/cfx_facecache.cpp | 34 | ||||
-rw-r--r-- | core/fxge/cfx_facecache.h | 4 | ||||
-rw-r--r-- | core/fxge/cfx_font.cpp | 1 | ||||
-rw-r--r-- | core/fxge/cfx_gemodule.cpp | 1 | ||||
-rw-r--r-- | core/fxge/fx_font.h | 1 | ||||
-rw-r--r-- | core/fxge/fx_ge_text.cpp | 5 | ||||
-rw-r--r-- | core/fxge/fx_text_int.h | 24 | ||||
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 1 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 1 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_print.cpp | 1 |
12 files changed, 20 insertions, 55 deletions
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index 05ae70a6b7..b82e59cfd1 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -19,7 +19,6 @@ #include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_freetype.h" -#include "core/fxge/fx_text_int.h" #ifndef _SKIA_SUPPORT_ diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index 1e9fddaad8..b24638c465 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -15,7 +15,6 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_freetype.h" -#include "core/fxge/fx_text_int.h" #include "third_party/base/ptr_util.h" #include "core/fxge/apple/apple_int.h" diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp index 7075c1f9f5..217c41119c 100644 --- a/core/fxge/cfx_facecache.cpp +++ b/core/fxge/cfx_facecache.cpp @@ -17,7 +17,6 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_substfont.h" #include "core/fxge/fx_freetype.h" -#include "core/fxge/fx_text_int.h" #include "third_party/base/numerics/safe_math.h" #include "third_party/base/ptr_util.h" @@ -330,27 +329,28 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, std::unique_ptr<CFX_GlyphBitmap> pGlyphBitmap; auto it = m_SizeMap.find(FaceGlyphsKey); if (it != m_SizeMap.end()) { - CFX_SizeGlyphCache* pSizeCache = it->second.get(); - auto it2 = pSizeCache->m_GlyphMap.find(glyph_index); - if (it2 != pSizeCache->m_GlyphMap.end()) + SizeGlyphCache* pSizeCache = &(it->second); + auto it2 = pSizeCache->find(glyph_index); + if (it2 != pSizeCache->end()) return it2->second.get(); pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); if (pGlyphBitmap) { CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); - pSizeCache->m_GlyphMap[glyph_index] = std::move(pGlyphBitmap); + (*pSizeCache)[glyph_index] = std::move(pGlyphBitmap); return pResult; } } else { pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); if (pGlyphBitmap) { - auto pNewCache = pdfium::MakeUnique<CFX_SizeGlyphCache>(); - CFX_SizeGlyphCache* pSizeCache = pNewCache.get(); - m_SizeMap[FaceGlyphsKey] = std::move(pNewCache); CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); - pSizeCache->m_GlyphMap[glyph_index] = std::move(pGlyphBitmap); + + SizeGlyphCache cache; + cache[glyph_index] = std::move(pGlyphBitmap); + + m_SizeMap[FaceGlyphsKey] = std::move(cache); return pResult; } } @@ -398,22 +398,22 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( bool bFontStyle, int dest_width, int anti_alias) { - CFX_SizeGlyphCache* pSizeCache; + SizeGlyphCache* pSizeCache; auto it = m_SizeMap.find(FaceGlyphsKey); if (it == m_SizeMap.end()) { - auto pNewCache = pdfium::MakeUnique<CFX_SizeGlyphCache>(); - pSizeCache = pNewCache.get(); - m_SizeMap[FaceGlyphsKey] = std::move(pNewCache); + m_SizeMap[FaceGlyphsKey] = SizeGlyphCache(); + pSizeCache = &(m_SizeMap[FaceGlyphsKey]); } else { - pSizeCache = it->second.get(); + pSizeCache = &(it->second); } - auto it2 = pSizeCache->m_GlyphMap.find(glyph_index); - if (it2 != pSizeCache->m_GlyphMap.end()) + + auto it2 = pSizeCache->find(glyph_index); + if (it2 != pSizeCache->end()) return it2->second.get(); std::unique_ptr<CFX_GlyphBitmap> pGlyphBitmap = RenderGlyph( pFont, glyph_index, bFontStyle, pMatrix, dest_width, anti_alias); CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); - pSizeCache->m_GlyphMap[glyph_index] = std::move(pGlyphBitmap); + (*pSizeCache)[glyph_index] = std::move(pGlyphBitmap); return pResult; } diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h index 673d0a4cf9..ef5652ed20 100644 --- a/core/fxge/cfx_facecache.h +++ b/core/fxge/cfx_facecache.h @@ -38,6 +38,8 @@ class CFX_FaceCache { #endif private: + using SizeGlyphCache = std::map<uint32_t, std::unique_ptr<CFX_GlyphBitmap>>; + std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(const CFX_Font* pFont, uint32_t glyph_index, bool bFontStyle, @@ -61,7 +63,7 @@ class CFX_FaceCache { void DestroyPlatform(); FXFT_Face const m_Face; - std::map<ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap; + std::map<ByteString, SizeGlyphCache> m_SizeMap; std::map<uint32_t, std::unique_ptr<CFX_PathData>> m_PathMap; #if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ sk_sp<SkTypeface> m_pTypeface; diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp index 9e6a2cf982..6e252fc065 100644 --- a/core/fxge/cfx_font.cpp +++ b/core/fxge/cfx_font.cpp @@ -22,7 +22,6 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_substfont.h" #include "core/fxge/fx_freetype.h" -#include "core/fxge/fx_text_int.h" #include "third_party/base/ptr_util.h" #define EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em) diff --git a/core/fxge/cfx_gemodule.cpp b/core/fxge/cfx_gemodule.cpp index a28a88243a..cbc66c3cac 100644 --- a/core/fxge/cfx_gemodule.cpp +++ b/core/fxge/cfx_gemodule.cpp @@ -9,7 +9,6 @@ #include "core/fxge/cfx_folderfontinfo.h" #include "core/fxge/cfx_fontcache.h" #include "core/fxge/cfx_fontmgr.h" -#include "core/fxge/fx_text_int.h" #include "third_party/base/ptr_util.h" namespace { diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h index 321cc4c80a..e4b085a931 100644 --- a/core/fxge/fx_font.h +++ b/core/fxge/fx_font.h @@ -24,7 +24,6 @@ typedef void* FXFT_Library; class CFX_FaceCache; class CFX_GlyphBitmap; class CFX_PathData; -class CFX_SizeGlyphCache; class IFX_SeekableReadStream; #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ diff --git a/core/fxge/fx_ge_text.cpp b/core/fxge/fx_ge_text.cpp index a04e43f75d..a04e6d0e85 100644 --- a/core/fxge/fx_ge_text.cpp +++ b/core/fxge/fx_ge_text.cpp @@ -11,7 +11,6 @@ #include "core/fxcrt/fx_safe_types.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/fx_freetype.h" -#include "core/fxge/fx_text_int.h" #include "core/fxge/ifx_renderdevicedriver.h" namespace { @@ -103,7 +102,3 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, } return rect; } - -CFX_SizeGlyphCache::CFX_SizeGlyphCache() {} - -CFX_SizeGlyphCache::~CFX_SizeGlyphCache() {} diff --git a/core/fxge/fx_text_int.h b/core/fxge/fx_text_int.h deleted file mode 100644 index da594443cc..0000000000 --- a/core/fxge/fx_text_int.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXGE_FX_TEXT_INT_H_ -#define CORE_FXGE_FX_TEXT_INT_H_ - -#include <map> -#include <memory> - -#include "core/fxge/fx_font.h" -#include "core/fxge/fx_freetype.h" - -class CFX_SizeGlyphCache { - public: - CFX_SizeGlyphCache(); - ~CFX_SizeGlyphCache(); - - std::map<uint32_t, std::unique_ptr<CFX_GlyphBitmap>> m_GlyphMap; -}; - -#endif // CORE_FXGE_FX_TEXT_INT_H_ diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 8a7aac0f8d..9a617da32f 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -22,7 +22,6 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/dib/cfx_dibextractor.h" -#include "core/fxge/fx_text_int.h" #include "core/fxge/win32/cpsoutput.h" #include "third_party/base/ptr_util.h" diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index d87edf7ed1..9957239089 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -22,7 +22,6 @@ #include "core/fxge/dib/cstretchengine.h" #include "core/fxge/fx_font.h" #include "core/fxge/fx_freetype.h" -#include "core/fxge/fx_text_int.h" #include "core/fxge/ifx_systemfontinfo.h" #include "core/fxge/win32/cfx_windowsdib.h" #include "core/fxge/win32/dwrite_int.h" diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index 3c08acddda..2ff9fd07aa 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -16,7 +16,6 @@ #include "core/fxge/dib/cfx_imagerenderer.h" #include "core/fxge/dib/cstretchengine.h" #include "core/fxge/fx_freetype.h" -#include "core/fxge/fx_text_int.h" #include "core/fxge/win32/cpsoutput.h" #include "core/fxge/win32/win32_int.h" #include "third_party/base/ptr_util.h" |