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 <algorithm> |
| 8 |
7 #include "core/include/fpdfdoc/fpdf_doc.h" | 9 #include "core/include/fpdfdoc/fpdf_doc.h" |
8 | 10 |
9 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, | 11 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, |
10 CPDF_Dictionary* pWidgetDict) { | 12 CPDF_Dictionary* pWidgetDict) { |
11 m_pField = pField; | 13 m_pField = pField; |
12 m_pWidgetDict = pWidgetDict; | 14 m_pWidgetDict = pWidgetDict; |
13 m_pForm = m_pField->m_pForm; | 15 m_pForm = m_pField->m_pForm; |
14 } | 16 } |
15 CFX_FloatRect CPDF_FormControl::GetRect() const { | 17 CFX_FloatRect CPDF_FormControl::GetRect() const { |
16 return m_pWidgetDict->GetRect("Rect"); | 18 return m_pWidgetDict->GetRect("Rect"); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 FX_FLOAT r = pEntry->GetNumber(0) * 255; | 348 FX_FLOAT r = pEntry->GetNumber(0) * 255; |
347 FX_FLOAT g = pEntry->GetNumber(1) * 255; | 349 FX_FLOAT g = pEntry->GetNumber(1) * 255; |
348 FX_FLOAT b = pEntry->GetNumber(2) * 255; | 350 FX_FLOAT b = pEntry->GetNumber(2) * 255; |
349 color = ArgbEncode(255, (int)r, (int)g, (int)b); | 351 color = ArgbEncode(255, (int)r, (int)g, (int)b); |
350 } else if (dwCount == 4) { | 352 } else if (dwCount == 4) { |
351 iColorType = COLORTYPE_CMYK; | 353 iColorType = COLORTYPE_CMYK; |
352 FX_FLOAT c = pEntry->GetNumber(0); | 354 FX_FLOAT c = pEntry->GetNumber(0); |
353 FX_FLOAT m = pEntry->GetNumber(1); | 355 FX_FLOAT m = pEntry->GetNumber(1); |
354 FX_FLOAT y = pEntry->GetNumber(2); | 356 FX_FLOAT y = pEntry->GetNumber(2); |
355 FX_FLOAT k = pEntry->GetNumber(3); | 357 FX_FLOAT k = pEntry->GetNumber(3); |
356 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); | 358 FX_FLOAT r = 1.0f - std::min(1.0f, c + k); |
357 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); | 359 FX_FLOAT g = 1.0f - std::min(1.0f, m + k); |
358 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); | 360 FX_FLOAT b = 1.0f - std::min(1.0f, y + k); |
359 color = ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255)); | 361 color = ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255)); |
360 } | 362 } |
361 return color; | 363 return color; |
362 } | 364 } |
363 | 365 |
364 FX_FLOAT CPDF_ApSettings::GetOriginalColor( | 366 FX_FLOAT CPDF_ApSettings::GetOriginalColor( |
365 int index, | 367 int index, |
366 const CFX_ByteStringC& csEntry) const { | 368 const CFX_ByteStringC& csEntry) const { |
367 if (!m_pDict) | 369 if (!m_pDict) |
368 return 0; | 370 return 0; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return m_pDict ? m_pDict->GetStream(csEntry) : nullptr; | 414 return m_pDict ? m_pDict->GetStream(csEntry) : nullptr; |
413 } | 415 } |
414 | 416 |
415 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { | 417 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { |
416 return m_pDict ? m_pDict->GetDict("IF") : nullptr; | 418 return m_pDict ? m_pDict->GetDict("IF") : nullptr; |
417 } | 419 } |
418 | 420 |
419 int CPDF_ApSettings::GetTextPosition() const { | 421 int CPDF_ApSettings::GetTextPosition() const { |
420 return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION; | 422 return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION; |
421 } | 423 } |
OLD | NEW |