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

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

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 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 "../../../include/fpdfapi/fpdf_module.h" 7 #include "../../../include/fpdfapi/fpdf_module.h"
8 #include "../../../include/fpdfapi/fpdf_page.h" 8 #include "../../../include/fpdfapi/fpdf_page.h"
9 #include "../../../include/fpdfapi/fpdf_resource.h" 9 #include "../../../include/fpdfapi/fpdf_resource.h"
10 #include "../../../include/fxge/fx_freetype.h" 10 #include "../../../include/fxge/fx_freetype.h"
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 } 1660 }
1661 void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, 1661 void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
1662 CFX_DWordArray& result, 1662 CFX_DWordArray& result,
1663 int nElements) { 1663 int nElements) {
1664 int width_status = 0; 1664 int width_status = 0;
1665 int iCurElement = 0; 1665 int iCurElement = 0;
1666 int first_code = 0, last_code; 1666 int first_code = 0, last_code;
1667 FX_DWORD count = pArray->GetCount(); 1667 FX_DWORD count = pArray->GetCount();
1668 for (FX_DWORD i = 0; i < count; i++) { 1668 for (FX_DWORD i = 0; i < count; i++) {
1669 CPDF_Object* pObj = pArray->GetElementValue(i); 1669 CPDF_Object* pObj = pArray->GetElementValue(i);
1670 if (pObj == NULL) { 1670 if (!pObj)
1671 continue; 1671 continue;
1672 } 1672
1673 if (pObj->GetType() == PDFOBJ_ARRAY) { 1673 if (CPDF_Array* pArray = pObj->AsArray()) {
1674 if (width_status != 1) { 1674 if (width_status != 1)
1675 return; 1675 return;
1676 } 1676
1677 CPDF_Array* pArray = (CPDF_Array*)pObj;
1678 FX_DWORD count = pArray->GetCount(); 1677 FX_DWORD count = pArray->GetCount();
1679 for (FX_DWORD j = 0; j < count; j += nElements) { 1678 for (FX_DWORD j = 0; j < count; j += nElements) {
1680 result.Add(first_code); 1679 result.Add(first_code);
1681 result.Add(first_code); 1680 result.Add(first_code);
1682 for (int k = 0; k < nElements; k++) { 1681 for (int k = 0; k < nElements; k++) {
1683 result.Add(pArray->GetInteger(j + k)); 1682 result.Add(pArray->GetInteger(j + k));
1684 } 1683 }
1685 first_code++; 1684 first_code++;
1686 } 1685 }
1687 width_status = 0; 1686 width_status = 0;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 1745
1747 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { 1746 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const {
1748 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 1747 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
1749 return nullptr; 1748 return nullptr;
1750 1749
1751 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( 1750 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch(
1752 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), 1751 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs),
1753 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); 1752 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform);
1754 return found ? &found->a : nullptr; 1753 return found ? &found->a : nullptr;
1755 } 1754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698