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/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "pageint.h" | 10 #include "pageint.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 k = pBuf[3]; | 96 k = pBuf[3]; |
97 return TRUE; | 97 return TRUE; |
98 } | 98 } |
99 FX_BOOL CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B
) const | 99 FX_BOOL CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B
) const |
100 { | 100 { |
101 if (m_Family == PDFCS_DEVICERGB) { | 101 if (m_Family == PDFCS_DEVICERGB) { |
102 pBuf[0] = R; | 102 pBuf[0] = R; |
103 pBuf[1] = G; | 103 pBuf[1] = G; |
104 pBuf[2] = B; | 104 pBuf[2] = B; |
105 return TRUE; | 105 return TRUE; |
106 } else if (m_Family == PDFCS_DEVICEGRAY) { | 106 } |
| 107 if (m_Family == PDFCS_DEVICEGRAY) { |
107 if (R == G && R == B) { | 108 if (R == G && R == B) { |
108 *pBuf = R; | 109 *pBuf = R; |
109 return TRUE; | 110 return TRUE; |
110 } else { | |
111 return FALSE; | |
112 } | 111 } |
113 } else if (m_Family == PDFCS_DEVICECMYK) { | 112 return FALSE; |
| 113 } |
| 114 if (m_Family == PDFCS_DEVICECMYK) { |
114 sRGB_to_AdobeCMYK(R, G, B, pBuf[0], pBuf[1], pBuf[2], pBuf[3]); | 115 sRGB_to_AdobeCMYK(R, G, B, pBuf[0], pBuf[1], pBuf[2], pBuf[3]); |
115 return TRUE; | 116 return TRUE; |
116 } | 117 } |
117 return FALSE; | 118 return FALSE; |
118 } | 119 } |
119 FX_BOOL CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOA
T y, FX_FLOAT k) const | 120 FX_BOOL CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOA
T y, FX_FLOAT k) const |
120 { | 121 { |
121 if (m_Family == PDFCS_DEVICERGB) { | 122 if (m_Family == PDFCS_DEVICERGB) { |
122 AdobeCMYK_to_sRGB(c, m, y, k, pBuf[0], pBuf[1], pBuf[2]); | 123 AdobeCMYK_to_sRGB(c, m, y, k, pBuf[0], pBuf[1], pBuf[2]); |
123 return TRUE; | 124 return TRUE; |
124 } else if (m_Family == PDFCS_DEVICEGRAY) { | 125 } |
125 return FALSE; | 126 if (m_Family == PDFCS_DEVICECMYK) { |
126 } else if (m_Family == PDFCS_DEVICECMYK) { | |
127 pBuf[0] = c; | 127 pBuf[0] = c; |
128 pBuf[1] = m; | 128 pBuf[1] = m; |
129 pBuf[2] = y; | 129 pBuf[2] = y; |
130 pBuf[3] = k; | 130 pBuf[3] = k; |
131 return TRUE; | 131 return TRUE; |
132 } | 132 } |
133 return FALSE; | 133 return FALSE; |
134 } | 134 } |
135 static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) | 135 static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) |
136 { | 136 { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 FX_BOOL CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT&
B) const | 307 FX_BOOL CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT&
B) const |
308 { | 308 { |
309 R = G = B = *pBuf; | 309 R = G = B = *pBuf; |
310 return TRUE; | 310 return TRUE; |
311 } | 311 } |
312 FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B)
const | 312 FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B)
const |
313 { | 313 { |
314 if (R == G && R == B) { | 314 if (R == G && R == B) { |
315 *pBuf = R; | 315 *pBuf = R; |
316 return TRUE; | 316 return TRUE; |
317 } else { | |
318 return FALSE; | |
319 } | 317 } |
| 318 return FALSE; |
320 } | 319 } |
321 void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf,
int pixels, int image_width, int image_height, FX_BOOL bTransMask) const | 320 void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf,
int pixels, int image_width, int image_height, FX_BOOL bTransMask) const |
322 { | 321 { |
323 for (int i = 0; i < pixels; i ++) { | 322 for (int i = 0; i < pixels; i ++) { |
324 *pDestBuf ++ = pSrcBuf[i]; | 323 *pDestBuf ++ = pSrcBuf[i]; |
325 *pDestBuf ++ = pSrcBuf[i]; | 324 *pDestBuf ++ = pSrcBuf[i]; |
326 *pDestBuf ++ = pSrcBuf[i]; | 325 *pDestBuf ++ = pSrcBuf[i]; |
327 } | 326 } |
328 } | 327 } |
329 class CPDF_CalRGB : public CPDF_ColorSpace | 328 class CPDF_CalRGB : public CPDF_ColorSpace |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 } | 985 } |
987 CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs()); | 986 CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs()); |
988 int nresults = 0; | 987 int nresults = 0; |
989 m_pFunc->Call(pBuf, 1, results, nresults); | 988 m_pFunc->Call(pBuf, 1, results, nresults); |
990 if (nresults == 0) { | 989 if (nresults == 0) { |
991 return FALSE; | 990 return FALSE; |
992 } | 991 } |
993 if (m_pAltCS) { | 992 if (m_pAltCS) { |
994 m_pAltCS->GetRGB(results, R, G, B); | 993 m_pAltCS->GetRGB(results, R, G, B); |
995 return TRUE; | 994 return TRUE; |
996 } else { | |
997 R = G = B = 0; | |
998 return FALSE; | |
999 } | 995 } |
| 996 R = G = B = 0; |
| 997 return FALSE; |
1000 } | 998 } |
1001 void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled) | 999 void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled) |
1002 { | 1000 { |
1003 CPDF_ColorSpace::EnableStdConversion(bEnabled); | 1001 CPDF_ColorSpace::EnableStdConversion(bEnabled); |
1004 if (m_pAltCS) { | 1002 if (m_pAltCS) { |
1005 m_pAltCS->EnableStdConversion(bEnabled); | 1003 m_pAltCS->EnableStdConversion(bEnabled); |
1006 } | 1004 } |
1007 } | 1005 } |
1008 class CPDF_DeviceNCS : public CPDF_ColorSpace | 1006 class CPDF_DeviceNCS : public CPDF_ColorSpace |
1009 { | 1007 { |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 PatternValue* pvalue = (PatternValue*)m_pBuffer; | 1438 PatternValue* pvalue = (PatternValue*)m_pBuffer; |
1441 return pvalue->m_nComps ? pvalue->m_Comps : NULL; | 1439 return pvalue->m_nComps ? pvalue->m_Comps : NULL; |
1442 } | 1440 } |
1443 FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const | 1441 FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const |
1444 { | 1442 { |
1445 if (m_pCS != other.m_pCS || m_pCS == NULL) { | 1443 if (m_pCS != other.m_pCS || m_pCS == NULL) { |
1446 return FALSE; | 1444 return FALSE; |
1447 } | 1445 } |
1448 return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; | 1446 return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; |
1449 } | 1447 } |
OLD | NEW |