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 "render_int.h" | 7 #include "render_int.h" |
8 | 8 |
| 9 #include <algorithm> |
9 #include <memory> | 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "core/include/fpdfapi/fpdf_module.h" | 13 #include "core/include/fpdfapi/fpdf_module.h" |
13 #include "core/include/fpdfapi/fpdf_pageobj.h" | 14 #include "core/include/fpdfapi/fpdf_pageobj.h" |
14 #include "core/include/fpdfapi/fpdf_render.h" | 15 #include "core/include/fpdfapi/fpdf_render.h" |
15 #include "core/include/fxcodec/fx_codec.h" | 16 #include "core/include/fxcodec/fx_codec.h" |
16 #include "core/include/fxcrt/fx_safe_types.h" | 17 #include "core/include/fxcrt/fx_safe_types.h" |
17 #include "core/include/fxge/fx_ge.h" | 18 #include "core/include/fxge/fx_ge.h" |
18 #include "core/src/fpdfapi/fpdf_page/pageint.h" | 19 #include "core/src/fpdfapi/fpdf_page/pageint.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 if (!m_pDict->KeyExist("SMask")) { | 567 if (!m_pDict->KeyExist("SMask")) { |
567 CPDF_Object* pMask = m_pDict->GetElementValue("Mask"); | 568 CPDF_Object* pMask = m_pDict->GetElementValue("Mask"); |
568 if (!pMask) { | 569 if (!pMask) { |
569 return pCompData; | 570 return pCompData; |
570 } | 571 } |
571 if (CPDF_Array* pArray = pMask->AsArray()) { | 572 if (CPDF_Array* pArray = pMask->AsArray()) { |
572 if (pArray->GetCount() >= m_nComponents * 2) { | 573 if (pArray->GetCount() >= m_nComponents * 2) { |
573 for (FX_DWORD i = 0; i < m_nComponents; i++) { | 574 for (FX_DWORD i = 0; i < m_nComponents; i++) { |
574 int min_num = pArray->GetInteger(i * 2); | 575 int min_num = pArray->GetInteger(i * 2); |
575 int max_num = pArray->GetInteger(i * 2 + 1); | 576 int max_num = pArray->GetInteger(i * 2 + 1); |
576 pCompData[i].m_ColorKeyMin = FX_MAX(min_num, 0); | 577 pCompData[i].m_ColorKeyMin = std::max(min_num, 0); |
577 pCompData[i].m_ColorKeyMax = FX_MIN(max_num, max_data); | 578 pCompData[i].m_ColorKeyMax = std::min(max_num, max_data); |
578 } | 579 } |
579 } | 580 } |
580 bColorKey = TRUE; | 581 bColorKey = TRUE; |
581 } | 582 } |
582 } | 583 } |
583 return pCompData; | 584 return pCompData; |
584 } | 585 } |
585 ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder( | 586 ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder( |
586 const uint8_t* src_buf, | 587 const uint8_t* src_buf, |
587 FX_DWORD src_size, | 588 FX_DWORD src_size, |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 FX_BOOL CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle, | 1621 FX_BOOL CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle, |
1621 IFX_Pause* pPause) { | 1622 IFX_Pause* pPause) { |
1622 return LoadHandle->Continue(pPause); | 1623 return LoadHandle->Continue(pPause); |
1623 } | 1624 } |
1624 CPDF_ImageLoader::~CPDF_ImageLoader() { | 1625 CPDF_ImageLoader::~CPDF_ImageLoader() { |
1625 if (!m_bCached) { | 1626 if (!m_bCached) { |
1626 delete m_pBitmap; | 1627 delete m_pBitmap; |
1627 delete m_pMask; | 1628 delete m_pMask; |
1628 } | 1629 } |
1629 } | 1630 } |
OLD | NEW |