From 95ec3976ab6cdb22cc6d63c6eeaec9536ae61284 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 25 Sep 2017 15:16:40 -0400 Subject: Hide CFX_UniqueKeyGen The CFX_UniqueKeyGen struct is only used in cfx_facecache.cpp. This CL moves the struct to the anonymous namespace of that file. Change-Id: I1ec85126070e2e0446abc5639cea8465cb490f1a Reviewed-on: https://pdfium-review.googlesource.com/14770 Commit-Queue: dsinclair Reviewed-by: Henrique Nakashima --- core/fxge/cfx_facecache.cpp | 24 +++++++++++++++++++++--- core/fxge/fx_ge_text.cpp | 11 ----------- core/fxge/fx_text_int.h | 7 ------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp index 74b38ef61d..7075c1f9f5 100644 --- a/core/fxge/cfx_facecache.cpp +++ b/core/fxge/cfx_facecache.cpp @@ -77,6 +77,24 @@ void ContrastAdjust(uint8_t* pDataIn, } } +struct UniqueKeyGen { + void Generate(int count, ...); + + char key_[128]; + int key_len_; +}; + +void UniqueKeyGen::Generate(int count, ...) { + va_list argList; + va_start(argList, count); + for (int i = 0; i < count; i++) { + int p = va_arg(argList, int); + reinterpret_cast(key_)[i] = p; + } + va_end(argList); + key_len_ = count * sizeof(uint32_t); +} + } // namespace CFX_FaceCache::CFX_FaceCache(FXFT_Face face) @@ -262,7 +280,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, if (glyph_index == kInvalidGlyphIndex) return nullptr; - CFX_UniqueKeyGen keygen; + UniqueKeyGen keygen; int nMatrixA = static_cast(pMatrix->a * 10000); int nMatrixB = static_cast(pMatrix->b * 10000); int nMatrixC = static_cast(pMatrix->c * 10000); @@ -299,7 +317,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, } } #endif - ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); + ByteString FaceGlyphsKey(keygen.key_, keygen.key_len_); #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ || defined _SKIA_SUPPORT_ || \ defined _SKIA_SUPPORT_PATHS_ return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, @@ -344,7 +362,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, keygen.Generate(6, nMatrixA, nMatrixB, nMatrixC, nMatrixD, dest_width, anti_alias); } - ByteString FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen); + ByteString FaceGlyphsKey2(keygen.key_, keygen.key_len_); text_flags |= FXTEXT_NO_NATIVETEXT; return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, bFontStyle, dest_width, anti_alias); diff --git a/core/fxge/fx_ge_text.cpp b/core/fxge/fx_ge_text.cpp index 39c82b2751..a04e43f75d 100644 --- a/core/fxge/fx_ge_text.cpp +++ b/core/fxge/fx_ge_text.cpp @@ -107,14 +107,3 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector& glyphs, CFX_SizeGlyphCache::CFX_SizeGlyphCache() {} CFX_SizeGlyphCache::~CFX_SizeGlyphCache() {} - -void CFX_UniqueKeyGen::Generate(int count, ...) { - va_list argList; - va_start(argList, count); - for (int i = 0; i < count; i++) { - int p = va_arg(argList, int); - ((uint32_t*)m_Key)[i] = p; - } - va_end(argList); - m_KeyLen = count * sizeof(uint32_t); -} diff --git a/core/fxge/fx_text_int.h b/core/fxge/fx_text_int.h index 6af8eb9165..da594443cc 100644 --- a/core/fxge/fx_text_int.h +++ b/core/fxge/fx_text_int.h @@ -13,13 +13,6 @@ #include "core/fxge/fx_font.h" #include "core/fxge/fx_freetype.h" -struct CFX_UniqueKeyGen { - void Generate(int count, ...); - - char m_Key[128]; - int m_KeyLen; -}; - class CFX_SizeGlyphCache { public: CFX_SizeGlyphCache(); -- cgit v1.2.3