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 | |
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')
-rw-r--r-- | core/fxge/apple/fx_apple_platform.cpp | 2 | ||||
-rw-r--r-- | core/fxge/cfx_facecache.cpp | 34 | ||||
-rw-r--r-- | core/fxge/cfx_facecache.h | 8 | ||||
-rw-r--r-- | core/fxge/cfx_font.cpp | 4 | ||||
-rw-r--r-- | core/fxge/cfx_font.h | 2 | ||||
-rw-r--r-- | core/fxge/cfx_renderdevice.cpp | 4 |
6 files changed, 27 insertions, 27 deletions
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index 1801814e66..bc7d999282 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -168,7 +168,7 @@ void CFX_FaceCache::DestroyPlatform() {} std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph_Nativetext( const CFX_Font* pFont, uint32_t glyph_index, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t dest_width, int anti_alias) { return nullptr; 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; diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h index 4ff4c41b1d..c7b0593d6e 100644 --- a/core/fxge/cfx_facecache.h +++ b/core/fxge/cfx_facecache.h @@ -29,7 +29,7 @@ class CFX_FaceCache { const CFX_GlyphBitmap* 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); @@ -49,17 +49,17 @@ class CFX_FaceCache { std::unique_ptr<CFX_GlyphBitmap> 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); std::unique_ptr<CFX_GlyphBitmap> RenderGlyph_Nativetext( const CFX_Font* pFont, uint32_t glyph_index, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t dest_width, int anti_alias); CFX_GlyphBitmap* LookUpGlyphBitmap(const CFX_Font* pFont, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, const ByteString& FaceGlyphsKey, uint32_t glyph_index, bool bFontStyle, diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp index 98322fdf98..4634b87ac7 100644 --- a/core/fxge/cfx_font.cpp +++ b/core/fxge/cfx_font.cpp @@ -612,11 +612,11 @@ CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index, const CFX_GlyphBitmap* CFX_Font::LoadGlyphBitmap(uint32_t glyph_index, bool bFontStyle, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t dest_width, int anti_alias, int& text_flags) const { - return GetFaceCache()->LoadGlyphBitmap(this, glyph_index, bFontStyle, pMatrix, + return GetFaceCache()->LoadGlyphBitmap(this, glyph_index, bFontStyle, matrix, dest_width, anti_alias, text_flags); } diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h index 1d17714b46..7ef8ed7fa8 100644 --- a/core/fxge/cfx_font.h +++ b/core/fxge/cfx_font.h @@ -51,7 +51,7 @@ class CFX_Font { const CFX_GlyphBitmap* LoadGlyphBitmap(uint32_t glyph_index, bool bFontStyle, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t dest_width, int anti_alias, int& text_flags) const; diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index aed1bff94e..c63f2f5ec3 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -936,11 +936,11 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); new_matrix.Concat(deviceCtm); glyph.m_pGlyph = pFont->LoadGlyphBitmap( - charpos.m_GlyphIndex, charpos.m_bFontStyle, &new_matrix, + charpos.m_GlyphIndex, charpos.m_bFontStyle, new_matrix, charpos.m_FontCharWidth, anti_alias, nativetext_flags); } else { glyph.m_pGlyph = pFont->LoadGlyphBitmap( - charpos.m_GlyphIndex, charpos.m_bFontStyle, &deviceCtm, + charpos.m_GlyphIndex, charpos.m_bFontStyle, deviceCtm, charpos.m_FontCharWidth, anti_alias, nativetext_flags); } } |