diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-29 20:52:50 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-29 20:52:50 +0000 |
commit | a210ee1eba66e53de374ccae56a89d0b1976509d (patch) | |
tree | 866efd97b7b9c12eaa30fdf36191361b00cd2ec8 /core/fxge/cfx_facecache.cpp | |
parent | 6af5369477ec05554ef9e73ae6762860095f09e9 (diff) | |
download | pdfium-a210ee1eba66e53de374ccae56a89d0b1976509d.tar.xz |
Pass a CFX_Matrix by reference in font code.chromium/3445
The callers always pass in a valid CFX_Matrix, so eliminate the
possibility of a nullptr.
Change-Id: Id7d8b731ed60d5f66517b50c56efeca343e897c4
Reviewed-on: https://pdfium-review.googlesource.com/33152
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxge/cfx_facecache.cpp')
-rw-r--r-- | core/fxge/cfx_facecache.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp index ba316c1451..c2051c30fc 100644 --- a/core/fxge/cfx_facecache.cpp +++ b/core/fxge/cfx_facecache.cpp @@ -72,17 +72,17 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph( const CFX_Font* pFont, uint32_t glyph_index, bool bFontStyle, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t dest_width, int anti_alias) { if (!m_Face) return nullptr; FXFT_Matrix ft_matrix; - ft_matrix.xx = (signed long)(pMatrix->a / 64 * 65536); - ft_matrix.xy = (signed long)(pMatrix->c / 64 * 65536); - ft_matrix.yx = (signed long)(pMatrix->b / 64 * 65536); - ft_matrix.yy = (signed long)(pMatrix->d / 64 * 65536); + ft_matrix.xx = matrix.a / 64 * 65536; + ft_matrix.xy = matrix.c / 64 * 65536; + ft_matrix.yx = matrix.b / 64 * 65536; + ft_matrix.yy = matrix.d / 64 * 65536; bool bUseCJKSubFont = false; const CFX_SubstFont* pSubstFont = pFont->GetSubstFont(); if (pSubstFont) { @@ -215,7 +215,7 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(const CFX_Font* pFont, const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, uint32_t glyph_index, bool bFontStyle, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t dest_width, int anti_alias, int& text_flags) { @@ -223,10 +223,10 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, return nullptr; 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); - int nMatrixD = static_cast<int>(pMatrix->d * 10000); + int nMatrixA = static_cast<int>(matrix.a * 10000); + int nMatrixB = static_cast<int>(matrix.b * 10000); + int nMatrixC = static_cast<int>(matrix.c * 10000); + int nMatrixD = static_cast<int>(matrix.d * 10000); #if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_ if (pFont->GetSubstFont()) { keygen.Generate(9, nMatrixA, nMatrixB, nMatrixC, nMatrixD, dest_width, @@ -262,11 +262,11 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, ByteString FaceGlyphsKey(keygen.key_, keygen.key_len_); #if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_ || defined _SKIA_SUPPORT_ || \ defined _SKIA_SUPPORT_PATHS_ - return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, + return LookUpGlyphBitmap(pFont, matrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias); #else if (text_flags & FXTEXT_NO_NATIVETEXT) { - return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, + return LookUpGlyphBitmap(pFont, matrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias); } std::unique_ptr<CFX_GlyphBitmap> pGlyphBitmap; @@ -277,7 +277,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, if (it2 != pSizeCache->end()) return it2->second.get(); - pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, + pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, matrix, dest_width, anti_alias); if (pGlyphBitmap) { CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); @@ -285,7 +285,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, return pResult; } } else { - pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, + pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, matrix, dest_width, anti_alias); if (pGlyphBitmap) { CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); @@ -307,7 +307,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, } ByteString FaceGlyphsKey2(keygen.key_, keygen.key_len_); text_flags |= FXTEXT_NO_NATIVETEXT; - return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, + return LookUpGlyphBitmap(pFont, matrix, FaceGlyphsKey2, glyph_index, bFontStyle, dest_width, anti_alias); #endif } @@ -335,7 +335,7 @@ void CFX_FaceCache::InitPlatform() {} CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( const CFX_Font* pFont, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, const ByteString& FaceGlyphsKey, uint32_t glyph_index, bool bFontStyle, @@ -355,7 +355,7 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( return it2->second.get(); std::unique_ptr<CFX_GlyphBitmap> pGlyphBitmap = RenderGlyph( - pFont, glyph_index, bFontStyle, pMatrix, dest_width, anti_alias); + pFont, glyph_index, bFontStyle, matrix, dest_width, anti_alias); CFX_GlyphBitmap* pResult = pGlyphBitmap.get(); (*pSizeCache)[glyph_index] = std::move(pGlyphBitmap); return pResult; |