From 42059a389449665cdd4056648f9551103bb9c72e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 15 Mar 2017 12:22:48 -0400 Subject: Cleanup nits from prior CLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie69dfc32e7b526eca2ac6ae621eed879ad98476e Reviewed-on: https://pdfium-review.googlesource.com/3054 Commit-Queue: dsinclair Commit-Queue: Nicolás Peña Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez --- core/fpdfapi/font/cpdf_type3font.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'core/fpdfapi') diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp index 10a116ab46..b9a05a0588 100644 --- a/core/fpdfapi/font/cpdf_type3font.cpp +++ b/core/fpdfapi/font/cpdf_type3font.cpp @@ -44,22 +44,29 @@ CPDF_Type3Font* CPDF_Type3Font::AsType3Font() { bool CPDF_Type3Font::Load() { m_pFontResources = m_pFontDict->GetDictFor("Resources"); CPDF_Array* pMatrix = m_pFontDict->GetArrayFor("FontMatrix"); - float xscale = 1.0f, yscale = 1.0f; + float xscale = 1.0f; + float yscale = 1.0f; if (pMatrix) { m_FontMatrix = pMatrix->GetMatrix(); xscale = m_FontMatrix.a; yscale = m_FontMatrix.d; } + CPDF_Array* pBBox = m_pFontDict->GetArrayFor("FontBBox"); if (pBBox) { - m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000); - m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000); - m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000); - m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000); + m_FontBBox.left = + static_cast(pBBox->GetNumberAt(0) * xscale * 1000); + m_FontBBox.bottom = + static_cast(pBBox->GetNumberAt(1) * yscale * 1000); + m_FontBBox.right = + static_cast(pBBox->GetNumberAt(2) * xscale * 1000); + m_FontBBox.top = + static_cast(pBBox->GetNumberAt(3) * yscale * 1000); } + int StartChar = m_pFontDict->GetIntegerFor("FirstChar"); CPDF_Array* pWidthArray = m_pFontDict->GetArrayFor("Widths"); - if (pWidthArray && (StartChar >= 0 && StartChar < 256)) { + if (pWidthArray && StartChar >= 0 && StartChar < 256) { size_t count = pWidthArray->GetCount(); if (count > 256) count = 256; @@ -113,11 +120,12 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { return it->second.get(); float scale = m_FontMatrix.GetXUnit(); - pNewChar->m_Width = (int32_t)(pNewChar->m_Width * scale + 0.5f); + pNewChar->m_Width = static_cast(pNewChar->m_Width * scale + 0.5f); FX_RECT& rcBBox = pNewChar->m_BBox; - CFX_FloatRect char_rect( - (float)rcBBox.left / 1000.0f, (float)rcBBox.bottom / 1000.0f, - (float)rcBBox.right / 1000.0f, (float)rcBBox.top / 1000.0f); + CFX_FloatRect char_rect(static_cast(rcBBox.left) / 1000.0f, + static_cast(rcBBox.bottom) / 1000.0f, + static_cast(rcBBox.right) / 1000.0f, + static_cast(rcBBox.top) / 1000.0f); if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) char_rect = pNewChar->m_pForm->CalcBoundingBox(); -- cgit v1.2.3