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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. 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
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/src/fpdfdoc/doc_annot.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/include/fpdfapi/fpdf_parser.h" 7 #include "core/include/fpdfapi/fpdf_parser.h"
8 8
9 #include "core/include/fxcrt/fx_ext.h" 9 #include "core/include/fxcrt/fx_ext.h"
10 10
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 buf << "\r\nendstream"; 356 buf << "\r\nendstream";
357 break; 357 break;
358 } 358 }
359 default: 359 default:
360 ASSERT(FALSE); 360 ASSERT(FALSE);
361 break; 361 break;
362 } 362 }
363 return buf; 363 return buf;
364 } 364 }
365 365
366 FX_FLOAT PDF_ClipFloat(FX_FLOAT f) {
367 if (f < 0) {
368 return 0;
369 }
370 if (f > 1.0f) {
371 return 1.0f;
372 }
373 return f;
374 }
375
376 static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) { 366 static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) {
377 CPDF_Array* pLimits = pNode->GetArrayBy("Limits"); 367 CPDF_Array* pLimits = pNode->GetArrayBy("Limits");
378 if (pLimits && 368 if (pLimits &&
379 (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) { 369 (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) {
380 return NULL; 370 return NULL;
381 } 371 }
382 CPDF_Array* pNumbers = pNode->GetArrayBy("Nums"); 372 CPDF_Array* pNumbers = pNode->GetArrayBy("Nums");
383 if (pNumbers) { 373 if (pNumbers) {
384 FX_DWORD dwCount = pNumbers->GetCount() / 2; 374 FX_DWORD dwCount = pNumbers->GetCount() / 2;
385 for (FX_DWORD i = 0; i < dwCount; i++) { 375 for (FX_DWORD i = 0; i < dwCount; i++) {
(...skipping 20 matching lines...) Expand all
406 if (pFound) { 396 if (pFound) {
407 return pFound; 397 return pFound;
408 } 398 }
409 } 399 }
410 return NULL; 400 return NULL;
411 } 401 }
412 402
413 CPDF_Object* CPDF_NumberTree::LookupValue(int num) { 403 CPDF_Object* CPDF_NumberTree::LookupValue(int num) {
414 return SearchNumberNode(m_pRoot, num); 404 return SearchNumberNode(m_pRoot, num);
415 } 405 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/src/fpdfdoc/doc_annot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698