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