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

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

Issue 2291833002: Revert "Replace wrapper methods in CPDF_Path with -> operator." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 3 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/fpdfapi/fpdf_page/pageint.h" 7 #include "core/fpdfapi/fpdf_page/pageint.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 1137
1138 void CPDF_StreamContentParser::Handle_SetFont() { 1138 void CPDF_StreamContentParser::Handle_SetFont() {
1139 FX_FLOAT fs = GetNumber(0); 1139 FX_FLOAT fs = GetNumber(0);
1140 if (fs == 0) 1140 if (fs == 0)
1141 fs = m_DefFontSize; 1141 fs = m_DefFontSize;
1142 1142
1143 m_pCurStates->m_TextState.MakePrivateCopy(); 1143 m_pCurStates->m_TextState.MakePrivateCopy();
1144 m_pCurStates->m_TextState->m_FontSize = fs; 1144 m_pCurStates->m_TextState->m_FontSize = fs;
1145 CPDF_Font* pFont = FindFont(GetString(1)); 1145 CPDF_Font* pFont = FindFont(GetString(1));
1146 if (pFont) 1146 if (pFont)
1147 m_pCurStates->m_TextState->SetFont(pFont); 1147 m_pCurStates->m_TextState.SetFont(pFont);
1148 } 1148 }
1149 1149
1150 CPDF_Object* CPDF_StreamContentParser::FindResourceObj( 1150 CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
1151 const CFX_ByteString& type, 1151 const CFX_ByteString& type,
1152 const CFX_ByteString& name) { 1152 const CFX_ByteString& name) {
1153 if (!m_pResources) 1153 if (!m_pResources)
1154 return nullptr; 1154 return nullptr;
1155 CPDF_Dictionary* pDict = m_pResources->GetDictBy(type); 1155 CPDF_Dictionary* pDict = m_pResources->GetDictBy(type);
1156 if (pDict) 1156 if (pDict)
1157 return pDict->GetDirectObjectBy(name); 1157 return pDict->GetDirectObjectBy(name);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 1224
1225 void CPDF_StreamContentParser::ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y) { 1225 void CPDF_StreamContentParser::ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y) {
1226 m_pCurStates->m_CTM.Transform(x, y, x, y); 1226 m_pCurStates->m_CTM.Transform(x, y, x, y);
1227 m_mtContentToUser.Transform(x, y, x, y); 1227 m_mtContentToUser.Transform(x, y, x, y);
1228 } 1228 }
1229 1229
1230 void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, 1230 void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
1231 FX_FLOAT fInitKerning, 1231 FX_FLOAT fInitKerning,
1232 FX_FLOAT* pKerning, 1232 FX_FLOAT* pKerning,
1233 int nsegs) { 1233 int nsegs) {
1234 CPDF_Font* pFont = m_pCurStates->m_TextState->GetFont(); 1234 CPDF_Font* pFont = m_pCurStates->m_TextState.GetFont();
1235 if (!pFont) { 1235 if (!pFont) {
1236 return; 1236 return;
1237 } 1237 }
1238 if (fInitKerning != 0) { 1238 if (fInitKerning != 0) {
1239 if (!pFont->IsVertWriting()) { 1239 if (!pFont->IsVertWriting()) {
1240 m_pCurStates->m_TextX -= 1240 m_pCurStates->m_TextX -=
1241 (fInitKerning * m_pCurStates->m_TextState->GetFontSize()) / 1000; 1241 (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
1242 } else { 1242 } else {
1243 m_pCurStates->m_TextY -= 1243 m_pCurStates->m_TextY -=
1244 (fInitKerning * m_pCurStates->m_TextState->GetFontSize()) / 1000; 1244 (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
1245 } 1245 }
1246 } 1246 }
1247 if (nsegs == 0) { 1247 if (nsegs == 0) {
1248 return; 1248 return;
1249 } 1249 }
1250 const TextRenderingMode text_mode = 1250 const TextRenderingMode text_mode =
1251 pFont->IsType3Font() ? TextRenderingMode::MODE_FILL 1251 pFont->IsType3Font() ? TextRenderingMode::MODE_FILL
1252 : m_pCurStates->m_TextState->m_TextMode; 1252 : m_pCurStates->m_TextState->m_TextMode;
1253 { 1253 {
1254 std::unique_ptr<CPDF_TextObject> pText(new CPDF_TextObject); 1254 std::unique_ptr<CPDF_TextObject> pText(new CPDF_TextObject);
(...skipping 19 matching lines...) Expand all
1274 m_pCurStates->m_TextY += y_advance; 1274 m_pCurStates->m_TextY += y_advance;
1275 if (TextRenderingModeIsClipMode(text_mode)) { 1275 if (TextRenderingModeIsClipMode(text_mode)) {
1276 m_ClipTextList.push_back( 1276 m_ClipTextList.push_back(
1277 std::unique_ptr<CPDF_TextObject>(pText->Clone())); 1277 std::unique_ptr<CPDF_TextObject>(pText->Clone()));
1278 } 1278 }
1279 m_pObjectHolder->GetPageObjectList()->push_back(std::move(pText)); 1279 m_pObjectHolder->GetPageObjectList()->push_back(std::move(pText));
1280 } 1280 }
1281 if (pKerning && pKerning[nsegs - 1] != 0) { 1281 if (pKerning && pKerning[nsegs - 1] != 0) {
1282 if (!pFont->IsVertWriting()) { 1282 if (!pFont->IsVertWriting()) {
1283 m_pCurStates->m_TextX -= 1283 m_pCurStates->m_TextX -=
1284 (pKerning[nsegs - 1] * m_pCurStates->m_TextState->GetFontSize()) / 1284 (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) /
1285 1000; 1285 1000;
1286 } else { 1286 } else {
1287 m_pCurStates->m_TextY -= 1287 m_pCurStates->m_TextY -=
1288 (pKerning[nsegs - 1] * m_pCurStates->m_TextState->GetFontSize()) / 1288 (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) /
1289 1000; 1289 1000;
1290 } 1290 }
1291 } 1291 }
1292 } 1292 }
1293 1293
1294 void CPDF_StreamContentParser::Handle_ShowText() { 1294 void CPDF_StreamContentParser::Handle_ShowText() {
1295 CFX_ByteString str = GetString(0); 1295 CFX_ByteString str = GetString(0);
1296 if (str.IsEmpty()) { 1296 if (str.IsEmpty()) {
1297 return; 1297 return;
1298 } 1298 }
1299 AddTextObject(&str, 0, nullptr, 1); 1299 AddTextObject(&str, 0, nullptr, 1);
1300 } 1300 }
1301 1301
1302 void CPDF_StreamContentParser::Handle_ShowText_Positioning() { 1302 void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
1303 CPDF_Array* pArray = ToArray(GetObject(0)); 1303 CPDF_Array* pArray = ToArray(GetObject(0));
1304 if (!pArray) 1304 if (!pArray)
1305 return; 1305 return;
1306 1306
1307 size_t n = pArray->GetCount(); 1307 size_t n = pArray->GetCount();
1308 size_t nsegs = 0; 1308 size_t nsegs = 0;
1309 for (size_t i = 0; i < n; i++) { 1309 for (size_t i = 0; i < n; i++) {
1310 if (pArray->GetDirectObjectAt(i)->IsString()) 1310 if (pArray->GetDirectObjectAt(i)->IsString())
1311 nsegs++; 1311 nsegs++;
1312 } 1312 }
1313 if (nsegs == 0) { 1313 if (nsegs == 0) {
1314 for (size_t i = 0; i < n; i++) { 1314 for (size_t i = 0; i < n; i++) {
1315 m_pCurStates->m_TextX -= 1315 m_pCurStates->m_TextX -=
1316 (pArray->GetNumberAt(i) * m_pCurStates->m_TextState->GetFontSize()) / 1316 (pArray->GetNumberAt(i) * m_pCurStates->m_TextState.GetFontSize()) /
1317 1000; 1317 1000;
1318 } 1318 }
1319 return; 1319 return;
1320 } 1320 }
1321 CFX_ByteString* pStrs = new CFX_ByteString[nsegs]; 1321 CFX_ByteString* pStrs = new CFX_ByteString[nsegs];
1322 FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs); 1322 FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs);
1323 size_t iSegment = 0; 1323 size_t iSegment = 0;
1324 FX_FLOAT fInitKerning = 0; 1324 FX_FLOAT fInitKerning = 0;
1325 for (size_t i = 0; i < n; i++) { 1325 for (size_t i = 0; i < n; i++) {
1326 CPDF_Object* pObj = pArray->GetDirectObjectAt(i); 1326 CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 } else { 1695 } else {
1696 PDF_ReplaceAbbr(pElement); 1696 PDF_ReplaceAbbr(pElement);
1697 } 1697 }
1698 } 1698 }
1699 break; 1699 break;
1700 } 1700 }
1701 default: 1701 default:
1702 break; 1702 break;
1703 } 1703 }
1704 } 1704 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698