| OLD | NEW |
| 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 Loading... |
| 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 |
| 366 static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) { | 376 static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) { |
| 367 CPDF_Array* pLimits = pNode->GetArrayBy("Limits"); | 377 CPDF_Array* pLimits = pNode->GetArrayBy("Limits"); |
| 368 if (pLimits && | 378 if (pLimits && |
| 369 (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) { | 379 (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) { |
| 370 return NULL; | 380 return NULL; |
| 371 } | 381 } |
| 372 CPDF_Array* pNumbers = pNode->GetArrayBy("Nums"); | 382 CPDF_Array* pNumbers = pNode->GetArrayBy("Nums"); |
| 373 if (pNumbers) { | 383 if (pNumbers) { |
| 374 FX_DWORD dwCount = pNumbers->GetCount() / 2; | 384 FX_DWORD dwCount = pNumbers->GetCount() / 2; |
| 375 for (FX_DWORD i = 0; i < dwCount; i++) { | 385 for (FX_DWORD i = 0; i < dwCount; i++) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 396 if (pFound) { | 406 if (pFound) { |
| 397 return pFound; | 407 return pFound; |
| 398 } | 408 } |
| 399 } | 409 } |
| 400 return NULL; | 410 return NULL; |
| 401 } | 411 } |
| 402 | 412 |
| 403 CPDF_Object* CPDF_NumberTree::LookupValue(int num) { | 413 CPDF_Object* CPDF_NumberTree::LookupValue(int num) { |
| 404 return SearchNumberNode(m_pRoot, num); | 414 return SearchNumberNode(m_pRoot, num); |
| 405 } | 415 } |
| OLD | NEW |