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/fpdfapi/fpdf_page/pageint.h" | 7 #include "core/fpdfapi/fpdf_page/pageint.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
15 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
16 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" | 16 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
17 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" | 17 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" |
18 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" | 18 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" |
19 #include "core/fpdfapi/include/cpdf_modulemgr.h" | 19 #include "core/fpdfapi/include/cpdf_modulemgr.h" |
20 #include "core/include/fxcodec/fx_codec.h" | 20 #include "core/include/fxcodec/fx_codec.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 FX_DWORD ComponentsForFamily(int family) { | 24 uint32_t ComponentsForFamily(int family) { |
25 if (family == PDFCS_DEVICERGB) | 25 if (family == PDFCS_DEVICERGB) |
26 return 3; | 26 return 3; |
27 if (family == PDFCS_DEVICEGRAY) | 27 if (family == PDFCS_DEVICEGRAY) |
28 return 1; | 28 return 1; |
29 return 4; | 29 return 4; |
30 } | 30 } |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 void sRGB_to_AdobeCMYK(FX_FLOAT R, | 34 void sRGB_to_AdobeCMYK(FX_FLOAT R, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 pDestBuf[2] = 255 - std::min(255, pSrcBuf[0] + k); | 209 pDestBuf[2] = 255 - std::min(255, pSrcBuf[0] + k); |
210 pDestBuf[1] = 255 - std::min(255, pSrcBuf[1] + k); | 210 pDestBuf[1] = 255 - std::min(255, pSrcBuf[1] + k); |
211 pDestBuf[0] = 255 - std::min(255, pSrcBuf[2] + k); | 211 pDestBuf[0] = 255 - std::min(255, pSrcBuf[2] + k); |
212 } | 212 } |
213 pSrcBuf += 4; | 213 pSrcBuf += 4; |
214 pDestBuf += 3; | 214 pDestBuf += 3; |
215 } | 215 } |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize) | 219 CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize) |
220 : m_bsRGB(FALSE), m_pTransform(NULL), m_nSrcComponents(0) { | 220 : m_bsRGB(FALSE), m_pTransform(NULL), m_nSrcComponents(0) { |
221 if (dwSize == 3144 && | 221 if (dwSize == 3144 && |
222 FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) { | 222 FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) { |
223 m_bsRGB = TRUE; | 223 m_bsRGB = TRUE; |
224 m_nSrcComponents = 3; | 224 m_nSrcComponents = 3; |
225 } else if (CPDF_ModuleMgr::Get()->GetIccModule()) { | 225 } else if (CPDF_ModuleMgr::Get()->GetIccModule()) { |
226 m_pTransform = CPDF_ModuleMgr::Get()->GetIccModule()->CreateTransform_sRGB( | 226 m_pTransform = CPDF_ModuleMgr::Get()->GetIccModule()->CreateTransform_sRGB( |
227 pData, dwSize, m_nSrcComponents); | 227 pData, dwSize, m_nSrcComponents); |
228 } | 228 } |
229 } | 229 } |
230 CPDF_IccProfile::~CPDF_IccProfile() { | 230 CPDF_IccProfile::~CPDF_IccProfile() { |
231 if (m_pTransform) { | 231 if (m_pTransform) { |
232 CPDF_ModuleMgr::Get()->GetIccModule()->DestroyTransform(m_pTransform); | 232 CPDF_ModuleMgr::Get()->GetIccModule()->DestroyTransform(m_pTransform); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
OLD | NEW |