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

Side by Side Diff: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 2001783003: Get rid of CPDF_Object::GetArray(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_array.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fpdfapi/fpdf_page/pageint.h" 7 #include "core/fpdfapi/fpdf_page/pageint.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 void CPDF_StreamContentParser::Handle_SetColorSpace_Stroke() { 690 void CPDF_StreamContentParser::Handle_SetColorSpace_Stroke() {
691 CFX_ByteString csname = GetString(0); 691 CFX_ByteString csname = GetString(0);
692 CPDF_ColorSpace* pCS = FindColorSpace(csname); 692 CPDF_ColorSpace* pCS = FindColorSpace(csname);
693 if (!pCS) { 693 if (!pCS) {
694 return; 694 return;
695 } 695 }
696 m_pCurStates->m_ColorState.GetModify()->m_StrokeColor.SetColorSpace(pCS); 696 m_pCurStates->m_ColorState.GetModify()->m_StrokeColor.SetColorSpace(pCS);
697 } 697 }
698 698
699 void CPDF_StreamContentParser::Handle_SetDash() { 699 void CPDF_StreamContentParser::Handle_SetDash() {
700 CPDF_Array* pArray = GetObject(1) ? GetObject(1)->GetArray() : nullptr; 700 CPDF_Array* pArray = ToArray(GetObject(1));
701 if (!pArray) 701 if (!pArray)
702 return; 702 return;
703 703
704 m_pCurStates->SetLineDash(pArray, GetNumber(0), 1.0f); 704 m_pCurStates->SetLineDash(pArray, GetNumber(0), 1.0f);
705 } 705 }
706 706
707 void CPDF_StreamContentParser::Handle_SetCharWidth() { 707 void CPDF_StreamContentParser::Handle_SetCharWidth() {
708 m_Type3Data[0] = GetNumber(1); 708 m_Type3Data[0] = GetNumber(1);
709 m_Type3Data[1] = GetNumber(0); 709 m_Type3Data[1] = GetNumber(0);
710 m_bColored = TRUE; 710 m_bColored = TRUE;
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 1299
1300 void CPDF_StreamContentParser::Handle_ShowText() { 1300 void CPDF_StreamContentParser::Handle_ShowText() {
1301 CFX_ByteString str = GetString(0); 1301 CFX_ByteString str = GetString(0);
1302 if (str.IsEmpty()) { 1302 if (str.IsEmpty()) {
1303 return; 1303 return;
1304 } 1304 }
1305 AddTextObject(&str, 0, NULL, 1); 1305 AddTextObject(&str, 0, NULL, 1);
1306 } 1306 }
1307 1307
1308 void CPDF_StreamContentParser::Handle_ShowText_Positioning() { 1308 void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
1309 CPDF_Array* pArray = GetObject(0) ? GetObject(0)->GetArray() : NULL; 1309 CPDF_Array* pArray = ToArray(GetObject(0));
1310 if (!pArray) { 1310 if (!pArray)
1311 return; 1311 return;
1312 } 1312
1313 size_t n = pArray->GetCount(); 1313 size_t n = pArray->GetCount();
1314 size_t nsegs = 0; 1314 size_t nsegs = 0;
1315 for (size_t i = 0; i < n; i++) { 1315 for (size_t i = 0; i < n; i++) {
1316 if (pArray->GetDirectObjectAt(i)->IsString()) 1316 if (pArray->GetDirectObjectAt(i)->IsString())
1317 nsegs++; 1317 nsegs++;
1318 } 1318 }
1319 if (nsegs == 0) { 1319 if (nsegs == 0) {
1320 for (size_t i = 0; i < n; i++) { 1320 for (size_t i = 0; i < n; i++) {
1321 m_pCurStates->m_TextX -= 1321 m_pCurStates->m_TextX -=
1322 (pArray->GetNumberAt(i) * m_pCurStates->m_TextState.GetFontSize()) / 1322 (pArray->GetNumberAt(i) * m_pCurStates->m_TextState.GetFontSize()) /
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 } else { 1701 } else {
1702 PDF_ReplaceAbbr(pElement); 1702 PDF_ReplaceAbbr(pElement);
1703 } 1703 }
1704 } 1704 }
1705 break; 1705 break;
1706 } 1706 }
1707 default: 1707 default:
1708 break; 1708 break;
1709 } 1709 }
1710 } 1710 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698