Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: core/src/fpdfapi/fpdf_font/fpdf_font.cpp

Issue 1729613003: Remove FXSYS_Mul. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/src/fpdfapi/fpdf_font/font_int.h" 7 #include "core/src/fpdfapi/fpdf_font/font_int.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_page.h" 10 #include "core/include/fpdfapi/fpdf_page.h"
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 m_pFontResources = m_pFontDict->GetDictBy("Resources"); 1562 m_pFontResources = m_pFontDict->GetDictBy("Resources");
1563 CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix"); 1563 CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix");
1564 FX_FLOAT xscale = 1.0f, yscale = 1.0f; 1564 FX_FLOAT xscale = 1.0f, yscale = 1.0f;
1565 if (pMatrix) { 1565 if (pMatrix) {
1566 m_FontMatrix = pMatrix->GetMatrix(); 1566 m_FontMatrix = pMatrix->GetMatrix();
1567 xscale = m_FontMatrix.a; 1567 xscale = m_FontMatrix.a;
1568 yscale = m_FontMatrix.d; 1568 yscale = m_FontMatrix.d;
1569 } 1569 }
1570 CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox"); 1570 CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox");
1571 if (pBBox) { 1571 if (pBBox) {
1572 m_FontBBox.left = 1572 m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000);
1573 (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(0), xscale) * 1000); 1573 m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000);
1574 m_FontBBox.bottom = 1574 m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000);
1575 (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(1), yscale) * 1000); 1575 m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000);
1576 m_FontBBox.right =
1577 (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(2), xscale) * 1000);
1578 m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(3), yscale) * 1000);
1579 } 1576 }
1580 int StartChar = m_pFontDict->GetIntegerBy("FirstChar"); 1577 int StartChar = m_pFontDict->GetIntegerBy("FirstChar");
1581 CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); 1578 CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
1582 if (pWidthArray && (StartChar >= 0 && StartChar < 256)) { 1579 if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
1583 FX_DWORD count = pWidthArray->GetCount(); 1580 FX_DWORD count = pWidthArray->GetCount();
1584 if (count > 256) { 1581 if (count > 256) {
1585 count = 256; 1582 count = 256;
1586 } 1583 }
1587 if (StartChar + count > 256) { 1584 if (StartChar + count > 256) {
1588 count = 256 - StartChar; 1585 count = 256 - StartChar;
1589 } 1586 }
1590 for (FX_DWORD i = 0; i < count; i++) { 1587 for (FX_DWORD i = 0; i < count; i++) {
1591 m_CharWidthL[StartChar + i] = 1588 m_CharWidthL[StartChar + i] =
1592 FXSYS_round(FXSYS_Mul(pWidthArray->GetNumberAt(i), xscale) * 1000); 1589 FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
1593 } 1590 }
1594 } 1591 }
1595 m_pCharProcs = m_pFontDict->GetDictBy("CharProcs"); 1592 m_pCharProcs = m_pFontDict->GetDictBy("CharProcs");
1596 CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); 1593 CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding");
1597 if (pEncoding) { 1594 if (pEncoding) {
1598 LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE); 1595 LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE);
1599 if (m_pCharNames) { 1596 if (m_pCharNames) {
1600 for (int i = 0; i < 256; i++) { 1597 for (int i = 0; i < 256; i++) {
1601 m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]); 1598 m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]);
1602 if (m_Encoding.m_Unicodes[i] == 0) { 1599 if (m_Encoding.m_Unicodes[i] == 0) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 rect = pChar->m_BBox; 1687 rect = pChar->m_BBox;
1691 } 1688 }
1692 1689
1693 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) 1690 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm)
1694 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {} 1691 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {}
1695 1692
1696 CPDF_Type3Char::~CPDF_Type3Char() { 1693 CPDF_Type3Char::~CPDF_Type3Char() {
1697 delete m_pForm; 1694 delete m_pForm;
1698 delete m_pBitmap; 1695 delete m_pBitmap;
1699 } 1696 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698