diff options
Diffstat (limited to 'core/fpdfapi/font/ttgsubtable.cpp')
-rw-r--r-- | core/fpdfapi/font/ttgsubtable.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/core/fpdfapi/font/ttgsubtable.cpp b/core/fpdfapi/font/ttgsubtable.cpp index 5b3d4cd4b9..b8d6946657 100644 --- a/core/fpdfapi/font/ttgsubtable.cpp +++ b/core/fpdfapi/font/ttgsubtable.cpp @@ -12,55 +12,6 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -CFX_GlyphMap::CFX_GlyphMap() {} - -CFX_GlyphMap::~CFX_GlyphMap() {} - -extern "C" { -static int _CompareInt(const void* p1, const void* p2) { - return (*(uint32_t*)p1) - (*(uint32_t*)p2); -} -}; - -struct _IntPair { - int32_t key; - int32_t value; -}; - -void CFX_GlyphMap::SetAt(int key, int value) { - uint32_t count = m_Buffer.GetSize() / sizeof(_IntPair); - _IntPair* buf = (_IntPair*)m_Buffer.GetBuffer(); - _IntPair pair = {key, value}; - if (count == 0 || key > buf[count - 1].key) { - m_Buffer.AppendBlock(&pair, sizeof(_IntPair)); - return; - } - int low = 0, high = count - 1; - while (low <= high) { - int mid = (low + high) / 2; - if (buf[mid].key < key) { - low = mid + 1; - } else if (buf[mid].key > key) { - high = mid - 1; - } else { - buf[mid].value = value; - return; - } - } - m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); -} - -bool CFX_GlyphMap::Lookup(int key, int& value) { - void* pResult = - bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair), - sizeof(_IntPair), _CompareInt); - if (!pResult) { - return false; - } - value = ((uint32_t*)pResult)[1]; - return true; -} - CFX_CTTGSUBTable::CFX_CTTGSUBTable() : m_bFeautureMapLoad(false), loaded(false) {} |