Skip to content

Instantly share code, notes, and snippets.

@bgrainger
Created June 3, 2019 17:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgrainger/ae266e4b305b83503a852343869a2a68 to your computer and use it in GitHub Desktop.
Save bgrainger/ae266e4b305b83503a852343869a2a68 to your computer and use it in GitHub Desktop.
Improving WPF Text Display Performance
HRESULT FontFileStream::ReadFileFragment(const void ** fragmentStart, UINT64 fileOffset, UINT64 fragmentSize, void ** fragmentContext)
{
if (fragmentStart != nullptr)
*fragmentStart = nullptr;
if (fragmentContext != nullptr)
*fragmentContext = nullptr;
if (fragmentStart == nullptr || fragmentContext == nullptr)
return E_POINTER;
if (fileOffset >= m_length || fileOffset + fragmentSize > m_length)
return E_INVALIDARG;
// return a pointer into the memory-mapped font bundle
*fragmentStart = static_cast<const void *>(m_data + fileOffset);
return S_OK;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment