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 "../../../include/fxcodec/fx_codec.h" | 7 #include "../../../include/fxcodec/fx_codec.h" |
8 #include "codec_int.h" | 8 #include "codec_int.h" |
9 #include "../lcms2/include/fx_lcms2.h" | 9 #include "../lcms2/include/fx_lcms2.h" |
10 const FX_DWORD N_COMPONENT_LAB = 3; | 10 const FX_DWORD N_COMPONENT_LAB = 3; |
11 const FX_DWORD N_COMPONENT_GRAY = 1; | 11 const FX_DWORD N_COMPONENT_GRAY = 1; |
12 const FX_DWORD N_COMPONENT_RGB = 3; | 12 const FX_DWORD N_COMPONENT_RGB = 3; |
13 const FX_DWORD N_COMPONENT_CMYK = 4; | 13 const FX_DWORD N_COMPONENT_CMYK = 4; |
14 const FX_DWORD N_COMPONENT_DEFAULT = 3; | 14 const FX_DWORD N_COMPONENT_DEFAULT = 3; |
15 | 15 |
16 FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, FX_BYTE ID[16] ) | 16 FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, FX_BYTE ID[16] ) |
17 { | 17 { |
18 return cmsMD5computeIDExt(buf, dwSize, ID); | 18 return cmsMD5computeIDExt(buf, dwSize, ID); |
19 } | 19 } |
20 struct CLcmsCmm : public CFX_Object { | 20 struct CLcmsCmm { |
21 cmsHTRANSFORM m_hTransform; | 21 cmsHTRANSFORM m_hTransform; |
22 int m_nSrcComponents; | 22 int m_nSrcComponents; |
23 int m_nDstComponents; | 23 int m_nDstComponents; |
24 FX_BOOL m_bLab; | 24 FX_BOOL m_bLab; |
25 }; | 25 }; |
26 extern "C" { | 26 extern "C" { |
27 int ourHandler(int ErrorCode, const char *ErrorText) | 27 int ourHandler(int ErrorCode, const char *ErrorText) |
28 { | 28 { |
29 return TRUE; | 29 return TRUE; |
30 } | 30 } |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 case cmsSigMCHAData: | 335 case cmsSigMCHAData: |
336 return T_DOSWAP(dwFormat) ? TYPE_KYMC10_8 : TYPE_CMYK10_8; | 336 return T_DOSWAP(dwFormat) ? TYPE_KYMC10_8 : TYPE_CMYK10_8; |
337 case cmsSigMCHBData: | 337 case cmsSigMCHBData: |
338 return T_DOSWAP(dwFormat) ? TYPE_KYMC11_8 : TYPE_CMYK11_8; | 338 return T_DOSWAP(dwFormat) ? TYPE_KYMC11_8 : TYPE_CMYK11_8; |
339 case cmsSigMCHCData: | 339 case cmsSigMCHCData: |
340 return T_DOSWAP(dwFormat) ? TYPE_KYMC12_8 : TYPE_CMYK12_8; | 340 return T_DOSWAP(dwFormat) ? TYPE_KYMC12_8 : TYPE_CMYK12_8; |
341 default: | 341 default: |
342 return 0; | 342 return 0; |
343 } | 343 } |
344 } | 344 } |
345 class CFX_IccProfileCache : public CFX_Object | 345 class CFX_IccProfileCache |
346 { | 346 { |
347 public: | 347 public: |
348 CFX_IccProfileCache(); | 348 CFX_IccProfileCache(); |
349 ~CFX_IccProfileCache(); | 349 ~CFX_IccProfileCache(); |
350 FX_LPVOID m_pProfile; | 350 FX_LPVOID m_pProfile; |
351 FX_DWORD m_dwRate; | 351 FX_DWORD m_dwRate; |
352 protected: | 352 protected: |
353 void Purge(); | 353 void Purge(); |
354 }; | 354 }; |
355 CFX_IccProfileCache::CFX_IccProfileCache() | 355 CFX_IccProfileCache::CFX_IccProfileCache() |
356 { | 356 { |
357 m_pProfile = NULL; | 357 m_pProfile = NULL; |
358 m_dwRate = 1; | 358 m_dwRate = 1; |
359 } | 359 } |
360 CFX_IccProfileCache::~CFX_IccProfileCache() | 360 CFX_IccProfileCache::~CFX_IccProfileCache() |
361 { | 361 { |
362 if (m_pProfile) { | 362 if (m_pProfile) { |
363 cmsCloseProfile(m_pProfile); | 363 cmsCloseProfile(m_pProfile); |
364 } | 364 } |
365 } | 365 } |
366 void CFX_IccProfileCache::Purge() | 366 void CFX_IccProfileCache::Purge() |
367 { | 367 { |
368 } | 368 } |
369 class CFX_IccTransformCache : public CFX_Object | 369 class CFX_IccTransformCache |
370 { | 370 { |
371 public: | 371 public: |
372 CFX_IccTransformCache(CLcmsCmm* pCmm = NULL); | 372 CFX_IccTransformCache(CLcmsCmm* pCmm = NULL); |
373 ~CFX_IccTransformCache(); | 373 ~CFX_IccTransformCache(); |
374 FX_LPVOID m_pIccTransform; | 374 FX_LPVOID m_pIccTransform; |
375 FX_DWORD m_dwRate; | 375 FX_DWORD m_dwRate; |
376 CLcmsCmm* m_pCmm; | 376 CLcmsCmm* m_pCmm; |
377 protected: | 377 protected: |
378 void Purge(); | 378 void Purge(); |
379 }; | 379 }; |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 FX_BYTE c1 = FXSYS_round(c * 255); | 1376 FX_BYTE c1 = FXSYS_round(c * 255); |
1377 FX_BYTE m1 = FXSYS_round(m * 255); | 1377 FX_BYTE m1 = FXSYS_round(m * 255); |
1378 FX_BYTE y1 = FXSYS_round(y * 255); | 1378 FX_BYTE y1 = FXSYS_round(y * 255); |
1379 FX_BYTE k1 = FXSYS_round(k * 255); | 1379 FX_BYTE k1 = FXSYS_round(k * 255); |
1380 FX_BYTE r, g, b; | 1380 FX_BYTE r, g, b; |
1381 AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); | 1381 AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); |
1382 R = 1.0f * r / 255; | 1382 R = 1.0f * r / 255; |
1383 G = 1.0f * g / 255; | 1383 G = 1.0f * g / 255; |
1384 B = 1.0f * b / 255; | 1384 B = 1.0f * b / 255; |
1385 } | 1385 } |
OLD | NEW |