| 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> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 const CFX_ByteStringC& csEntry) const { | 342 const CFX_ByteStringC& csEntry) const { |
| 343 iColorType = COLORTYPE_TRANSPARENT; | 343 iColorType = COLORTYPE_TRANSPARENT; |
| 344 if (!m_pDict) | 344 if (!m_pDict) |
| 345 return 0; | 345 return 0; |
| 346 | 346 |
| 347 CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); | 347 CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); |
| 348 if (!pEntry) | 348 if (!pEntry) |
| 349 return 0; | 349 return 0; |
| 350 | 350 |
| 351 FX_ARGB color = 0; | 351 FX_ARGB color = 0; |
| 352 FX_DWORD dwCount = pEntry->GetCount(); | 352 uint32_t dwCount = pEntry->GetCount(); |
| 353 if (dwCount == 1) { | 353 if (dwCount == 1) { |
| 354 iColorType = COLORTYPE_GRAY; | 354 iColorType = COLORTYPE_GRAY; |
| 355 FX_FLOAT g = pEntry->GetNumberAt(0) * 255; | 355 FX_FLOAT g = pEntry->GetNumberAt(0) * 255; |
| 356 color = ArgbEncode(255, (int)g, (int)g, (int)g); | 356 color = ArgbEncode(255, (int)g, (int)g, (int)g); |
| 357 } else if (dwCount == 3) { | 357 } else if (dwCount == 3) { |
| 358 iColorType = COLORTYPE_RGB; | 358 iColorType = COLORTYPE_RGB; |
| 359 FX_FLOAT r = pEntry->GetNumberAt(0) * 255; | 359 FX_FLOAT r = pEntry->GetNumberAt(0) * 255; |
| 360 FX_FLOAT g = pEntry->GetNumberAt(1) * 255; | 360 FX_FLOAT g = pEntry->GetNumberAt(1) * 255; |
| 361 FX_FLOAT b = pEntry->GetNumberAt(2) * 255; | 361 FX_FLOAT b = pEntry->GetNumberAt(2) * 255; |
| 362 color = ArgbEncode(255, (int)r, (int)g, (int)b); | 362 color = ArgbEncode(255, (int)r, (int)g, (int)b); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 391 for (int i = 0; i < 4; i++) { | 391 for (int i = 0; i < 4; i++) { |
| 392 fc[i] = 0; | 392 fc[i] = 0; |
| 393 } | 393 } |
| 394 if (!m_pDict) { | 394 if (!m_pDict) { |
| 395 return; | 395 return; |
| 396 } | 396 } |
| 397 CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); | 397 CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); |
| 398 if (!pEntry) { | 398 if (!pEntry) { |
| 399 return; | 399 return; |
| 400 } | 400 } |
| 401 FX_DWORD dwCount = pEntry->GetCount(); | 401 uint32_t dwCount = pEntry->GetCount(); |
| 402 if (dwCount == 1) { | 402 if (dwCount == 1) { |
| 403 iColorType = COLORTYPE_GRAY; | 403 iColorType = COLORTYPE_GRAY; |
| 404 fc[0] = pEntry->GetNumberAt(0); | 404 fc[0] = pEntry->GetNumberAt(0); |
| 405 } else if (dwCount == 3) { | 405 } else if (dwCount == 3) { |
| 406 iColorType = COLORTYPE_RGB; | 406 iColorType = COLORTYPE_RGB; |
| 407 fc[0] = pEntry->GetNumberAt(0); | 407 fc[0] = pEntry->GetNumberAt(0); |
| 408 fc[1] = pEntry->GetNumberAt(1); | 408 fc[1] = pEntry->GetNumberAt(1); |
| 409 fc[2] = pEntry->GetNumberAt(2); | 409 fc[2] = pEntry->GetNumberAt(2); |
| 410 } else if (dwCount == 4) { | 410 } else if (dwCount == 4) { |
| 411 iColorType = COLORTYPE_CMYK; | 411 iColorType = COLORTYPE_CMYK; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 426 } | 426 } |
| 427 | 427 |
| 428 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { | 428 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { |
| 429 return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr); | 429 return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr); |
| 430 } | 430 } |
| 431 | 431 |
| 432 int CPDF_ApSettings::GetTextPosition() const { | 432 int CPDF_ApSettings::GetTextPosition() const { |
| 433 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) | 433 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) |
| 434 : TEXTPOS_CAPTION; | 434 : TEXTPOS_CAPTION; |
| 435 } | 435 } |
| OLD | NEW |