summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_facecache.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-25 15:16:40 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-25 19:29:21 +0000
commit95ec3976ab6cdb22cc6d63c6eeaec9536ae61284 (patch)
treedfc3bc56d3d8999a1895bd63f5037d03719e0927 /core/fxge/cfx_facecache.cpp
parent92627618a93720c6153828b8a8d1c6ed17c6e91f (diff)
downloadpdfium-95ec3976ab6cdb22cc6d63c6eeaec9536ae61284.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxge/cfx_facecache.cpp')
-rw-r--r--core/fxge/cfx_facecache.cpp24
1 files changed, 21 insertions, 3 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<uint32_t*>(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<int>(pMatrix->a * 10000);
int nMatrixB = static_cast<int>(pMatrix->b * 10000);
int nMatrixC = static_cast<int>(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);