Delete useless CFX_GlyphCache::RenderGlyph_Nativetext() This method just returns nullptr. Delete it and delete the calling code that handles when RenderGlyph_Nativetext() returns a non-null value. Rename some variables in the calling code along the way. Change-Id: I6ba91d23263d05eacdb36f9b406955ec181a4116 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/139450 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/apple/fx_apple_impl.cpp b/core/fxge/apple/fx_apple_impl.cpp index 0cb5226..65868eb 100644 --- a/core/fxge/apple/fx_apple_impl.cpp +++ b/core/fxge/apple/fx_apple_impl.cpp
@@ -177,15 +177,6 @@ } // namespace pdfium -std::unique_ptr<CFX_GlyphBitmap> CFX_GlyphCache::RenderGlyph_Nativetext( - const CFX_Font* font, - uint32_t glyph_index, - const CFX_Matrix& matrix, - int dest_width, - FontAntiAliasingMode anti_alias) { - return nullptr; -} - void CFX_Font::ReleasePlatformResource() { if (platform_font_) { CQuartz2D& quartz2d =
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp index 0dafc22..01fddab 100644 --- a/core/fxge/cfx_glyphcache.cpp +++ b/core/fxge/cfx_glyphcache.cpp
@@ -186,33 +186,12 @@ #if BUILDFLAG(IS_APPLE) DCHECK(!CFX_DefaultRenderDevice::UseSkiaRenderer()); - std::unique_ptr<CFX_GlyphBitmap> pGlyphBitmap; auto it = size_map_.find(FaceGlyphsKey); if (it != size_map_.end()) { - SizeGlyphCache* pSizeCache = &(it->second); - auto it2 = pSizeCache->find(glyph_index); - if (it2 != pSizeCache->end()) { - return it2->second.get(); - } - - pGlyphBitmap = RenderGlyph_Nativetext(font, glyph_index, matrix, dest_width, - anti_alias); - if (pGlyphBitmap) { - CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); - (*pSizeCache)[glyph_index] = std::move(pGlyphBitmap); - return pResult; - } - } else { - pGlyphBitmap = RenderGlyph_Nativetext(font, glyph_index, matrix, dest_width, - anti_alias); - if (pGlyphBitmap) { - CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); - - SizeGlyphCache cache; - cache[glyph_index] = std::move(pGlyphBitmap); - - size_map_[FaceGlyphsKey] = std::move(cache); - return pResult; + SizeGlyphCache& size_glyph_cache = it->second; + auto size_glyph_it = size_glyph_cache.find(glyph_index); + if (size_glyph_it != size_glyph_cache.end()) { + return size_glyph_it->second.get(); } } UniqueKeyGen keygen2(font, matrix, dest_width, anti_alias,
diff --git a/core/fxge/cfx_glyphcache.h b/core/fxge/cfx_glyphcache.h index d319379..118e4b0 100644 --- a/core/fxge/cfx_glyphcache.h +++ b/core/fxge/cfx_glyphcache.h
@@ -70,12 +70,6 @@ const CFX_Matrix& matrix, int dest_width, FontAntiAliasingMode anti_alias); - std::unique_ptr<CFX_GlyphBitmap> RenderGlyph_Nativetext( - const CFX_Font* font, - uint32_t glyph_index, - const CFX_Matrix& matrix, - int dest_width, - FontAntiAliasingMode anti_alias); CFX_GlyphBitmap* LookUpGlyphBitmap(const CFX_Font* font, const CFX_Matrix& matrix, const ByteString& FaceGlyphsKey,