Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 return 1; 33 return 1;
34 return 4; 34 return 4;
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family) 39 CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family)
40 : CPDF_ColorSpace(pDoc, family, ComponentsForFamily(family)) { 40 : CPDF_ColorSpace(pDoc, family, ComponentsForFamily(family)) {
41 } 41 }
42 42
43 FX_BOOL CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT & B) const 43 bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B ) const
44 { 44 {
45 if (m_Family == PDFCS_DEVICERGB) { 45 if (m_Family == PDFCS_DEVICERGB) {
46 R = pBuf[0]; 46 R = pBuf[0];
47 if (R < 0) { 47 if (R < 0) {
48 R = 0; 48 R = 0;
49 } else if (R > 1) { 49 } else if (R > 1) {
50 R = 1; 50 R = 1;
51 } 51 }
52 G = pBuf[1]; 52 G = pBuf[1];
53 if (G < 0) { 53 if (G < 0) {
(...skipping 20 matching lines...) Expand all
74 AdobeCMYK_to_sRGB(pBuf[0], pBuf[1], pBuf[2], pBuf[3], R, G, B); 74 AdobeCMYK_to_sRGB(pBuf[0], pBuf[1], pBuf[2], pBuf[3], R, G, B);
75 } else { 75 } else {
76 FX_FLOAT k = pBuf[3]; 76 FX_FLOAT k = pBuf[3];
77 R = 1.0f - FX_MIN(1.0f, pBuf[0] + k); 77 R = 1.0f - FX_MIN(1.0f, pBuf[0] + k);
78 G = 1.0f - FX_MIN(1.0f, pBuf[1] + k); 78 G = 1.0f - FX_MIN(1.0f, pBuf[1] + k);
79 B = 1.0f - FX_MIN(1.0f, pBuf[2] + k); 79 B = 1.0f - FX_MIN(1.0f, pBuf[2] + k);
80 } 80 }
81 } else { 81 } else {
82 ASSERT(m_Family == PDFCS_PATTERN); 82 ASSERT(m_Family == PDFCS_PATTERN);
83 R = G = B = 0; 83 R = G = B = 0;
84 return FALSE; 84 return false;
85 } 85 }
86 return TRUE; 86 return true;
87 } 87 }
88 FX_BOOL CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FL OAT& y, FX_FLOAT& k) const 88 bool CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT & y, FX_FLOAT& k) const
89 { 89 {
90 if (m_Family != PDFCS_DEVICECMYK) { 90 if (m_Family != PDFCS_DEVICECMYK) {
91 return FALSE; 91 return false;
92 } 92 }
93 c = pBuf[0]; 93 c = pBuf[0];
94 m = pBuf[1]; 94 m = pBuf[1];
95 y = pBuf[2]; 95 y = pBuf[2];
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 bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) c onst
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 } 106 }
107 if (m_Family == PDFCS_DEVICEGRAY) { 107 if (m_Family == PDFCS_DEVICEGRAY) {
108 if (R == G && R == B) { 108 if (R == G && R == B) {
109 *pBuf = R; 109 *pBuf = R;
110 return TRUE; 110 return true;
111 } 111 }
112 return FALSE; 112 return false;
113 } 113 }
114 if (m_Family == PDFCS_DEVICECMYK) { 114 if (m_Family == PDFCS_DEVICECMYK) {
115 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]);
116 return TRUE; 116 return true;
117 } 117 }
118 return FALSE; 118 return false;
119 } 119 }
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 bool CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y , FX_FLOAT k) const
121 { 121 {
122 if (m_Family == PDFCS_DEVICERGB) { 122 if (m_Family == PDFCS_DEVICERGB) {
123 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]);
124 return TRUE; 124 return true;
125 } 125 }
126 if (m_Family == PDFCS_DEVICECMYK) { 126 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 {
137 if (pDestBuf == pSrcBuf) 137 if (pDestBuf == pSrcBuf)
138 for (int i = 0; i < pixels; i ++) { 138 for (int i = 0; i < pixels; i ++) {
139 uint8_t temp = pDestBuf[2]; 139 uint8_t temp = pDestBuf[2];
140 pDestBuf[2] = pDestBuf[0]; 140 pDestBuf[2] = pDestBuf[0];
141 pDestBuf[0] = temp; 141 pDestBuf[0] = temp;
142 pDestBuf += 3; 142 pDestBuf += 3;
143 } 143 }
144 else 144 else
145 for (int i = 0; i < pixels; i ++) { 145 for (int i = 0; i < pixels; i ++) {
146 *pDestBuf ++ = pSrcBuf[2]; 146 *pDestBuf ++ = pSrcBuf[2];
147 *pDestBuf ++ = pSrcBuf[1]; 147 *pDestBuf ++ = pSrcBuf[1];
148 *pDestBuf ++ = pSrcBuf[0]; 148 *pDestBuf ++ = pSrcBuf[0];
149 pSrcBuf += 3; 149 pSrcBuf += 3;
150 } 150 }
151 } 151 }
152 void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf , int pixels, int image_width, int image_height, FX_BOOL bTransMask) const 152 void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf , int pixels, int image_width, int image_height, bool bTransMask) const
153 { 153 {
154 if (bTransMask && m_Family == PDFCS_DEVICECMYK) { 154 if (bTransMask && m_Family == PDFCS_DEVICECMYK) {
155 for (int i = 0; i < pixels; i ++) { 155 for (int i = 0; i < pixels; i ++) {
156 int k = 255 - pSrcBuf[3]; 156 int k = 255 - pSrcBuf[3];
157 pDestBuf[0] = ((255 - pSrcBuf[0]) * k) / 255; 157 pDestBuf[0] = ((255 - pSrcBuf[0]) * k) / 255;
158 pDestBuf[1] = ((255 - pSrcBuf[1]) * k) / 255; 158 pDestBuf[1] = ((255 - pSrcBuf[1]) * k) / 255;
159 pDestBuf[2] = ((255 - pSrcBuf[2]) * k) / 255; 159 pDestBuf[2] = ((255 - pSrcBuf[2]) * k) / 255;
160 pDestBuf += 3; 160 pDestBuf += 3;
161 pSrcBuf += 4; 161 pSrcBuf += 4;
162 } 162 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 R = RGB_Conversion(RGB.a); 267 R = RGB_Conversion(RGB.a);
268 G = RGB_Conversion(RGB.b); 268 G = RGB_Conversion(RGB.b);
269 B = RGB_Conversion(RGB.c); 269 B = RGB_Conversion(RGB.c);
270 } 270 }
271 class CPDF_CalGray : public CPDF_ColorSpace 271 class CPDF_CalGray : public CPDF_ColorSpace
272 { 272 {
273 public: 273 public:
274 explicit CPDF_CalGray(CPDF_Document* pDoc) 274 explicit CPDF_CalGray(CPDF_Document* pDoc)
275 : CPDF_ColorSpace(pDoc, PDFCS_CALGRAY, 1) { 275 : CPDF_ColorSpace(pDoc, PDFCS_CALGRAY, 1) {
276 } 276 }
277 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 277 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
278 FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override; 278 bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const ove rride;
279 FX_BOOL» SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override; 279 bool» SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
280 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width, 280 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width,
281 int image_height, FX_BOOL bTransMask = FALSE) const override; 281 int image_height, bool bTransMask = false) const ove rride;
282 282
283 private: 283 private:
284 FX_FLOAT m_WhitePoint[3]; 284 FX_FLOAT m_WhitePoint[3];
285 FX_FLOAT m_BlackPoint[3]; 285 FX_FLOAT m_BlackPoint[3];
286 FX_FLOAT m_Gamma; 286 FX_FLOAT m_Gamma;
287 }; 287 };
288 288
289 FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 289 bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
290 { 290 {
291 CPDF_Dictionary* pDict = pArray->GetDict(1); 291 CPDF_Dictionary* pDict = pArray->GetDict(1);
292 CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint")); 292 CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
293 int i; 293 int i;
294 for (i = 0; i < 3; i ++) { 294 for (i = 0; i < 3; i ++) {
295 m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0; 295 m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0;
296 } 296 }
297 pParam = pDict->GetArray(FX_BSTRC("BlackPoint")); 297 pParam = pDict->GetArray(FX_BSTRC("BlackPoint"));
298 for (i = 0; i < 3; i ++) { 298 for (i = 0; i < 3; i ++) {
299 m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0; 299 m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0;
300 } 300 }
301 m_Gamma = pDict->GetNumber(FX_BSTRC("Gamma")); 301 m_Gamma = pDict->GetNumber(FX_BSTRC("Gamma"));
302 if (m_Gamma == 0) { 302 if (m_Gamma == 0) {
303 m_Gamma = 1.0f; 303 m_Gamma = 1.0f;
304 } 304 }
305 return TRUE; 305 return true;
306 } 306 }
307 FX_BOOL CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const 307 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 bool CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) co nst
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 } 317 }
318 return FALSE; 318 return false;
319 } 319 }
320 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, bool bTransMask) const
321 { 321 {
322 for (int i = 0; i < pixels; i ++) { 322 for (int i = 0; i < pixels; i ++) {
323 *pDestBuf ++ = pSrcBuf[i]; 323 *pDestBuf ++ = pSrcBuf[i];
324 *pDestBuf ++ = pSrcBuf[i]; 324 *pDestBuf ++ = pSrcBuf[i];
325 *pDestBuf ++ = pSrcBuf[i]; 325 *pDestBuf ++ = pSrcBuf[i];
326 } 326 }
327 } 327 }
328 class CPDF_CalRGB : public CPDF_ColorSpace 328 class CPDF_CalRGB : public CPDF_ColorSpace
329 { 329 {
330 public: 330 public:
331 explicit CPDF_CalRGB(CPDF_Document* pDoc) 331 explicit CPDF_CalRGB(CPDF_Document* pDoc)
332 : CPDF_ColorSpace(pDoc, PDFCS_CALRGB, 3) { 332 : CPDF_ColorSpace(pDoc, PDFCS_CALRGB, 3) {
333 } 333 }
334 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 334 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
335 FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override; 335 bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const ove rride;
336 FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const ove rride; 336 bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const overri de;
337 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width, 337 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width,
338 int image_height, FX_BOOL bTransMask = FALSE) const override; 338 int image_height, bool bTransMask = false) const ove rride;
339 339
340 FX_FLOAT m_WhitePoint[3]; 340 FX_FLOAT m_WhitePoint[3];
341 FX_FLOAT m_BlackPoint[3]; 341 FX_FLOAT m_BlackPoint[3];
342 FX_FLOAT m_Gamma[3]; 342 FX_FLOAT m_Gamma[3];
343 FX_FLOAT m_Matrix[9]; 343 FX_FLOAT m_Matrix[9];
344 FX_BOOL m_bGamma; 344 bool m_bGamma;
345 FX_BOOL m_bMatrix; 345 bool m_bMatrix;
346 }; 346 };
347 FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 347 bool CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
348 { 348 {
349 CPDF_Dictionary* pDict = pArray->GetDict(1); 349 CPDF_Dictionary* pDict = pArray->GetDict(1);
350 if (!pDict) 350 if (!pDict)
351 return FALSE; 351 return false;
352 352
353 CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint")); 353 CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
354 int i; 354 int i;
355 for (i = 0; i < 3; i ++) { 355 for (i = 0; i < 3; i ++) {
356 m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0; 356 m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0;
357 } 357 }
358 pParam = pDict->GetArray(FX_BSTRC("BlackPoint")); 358 pParam = pDict->GetArray(FX_BSTRC("BlackPoint"));
359 for (i = 0; i < 3; i ++) { 359 for (i = 0; i < 3; i ++) {
360 m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0; 360 m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0;
361 } 361 }
362 pParam = pDict->GetArray(FX_BSTRC("Gamma")); 362 pParam = pDict->GetArray(FX_BSTRC("Gamma"));
363 if (pParam) { 363 if (pParam) {
364 m_bGamma = TRUE; 364 m_bGamma = true;
365 for (i = 0; i < 3; i ++) { 365 for (i = 0; i < 3; i ++) {
366 m_Gamma[i] = pParam->GetNumber(i); 366 m_Gamma[i] = pParam->GetNumber(i);
367 } 367 }
368 } else { 368 } else {
369 m_bGamma = FALSE; 369 m_bGamma = false;
370 } 370 }
371 pParam = pDict->GetArray(FX_BSTRC("Matrix")); 371 pParam = pDict->GetArray(FX_BSTRC("Matrix"));
372 if (pParam) { 372 if (pParam) {
373 m_bMatrix = TRUE; 373 m_bMatrix = true;
374 for (i = 0; i < 9; i ++) { 374 for (i = 0; i < 9; i ++) {
375 m_Matrix[i] = pParam->GetNumber(i); 375 m_Matrix[i] = pParam->GetNumber(i);
376 } 376 }
377 } else { 377 } else {
378 m_bMatrix = FALSE; 378 m_bMatrix = false;
379 } 379 }
380 return TRUE; 380 return true;
381 } 381 }
382 FX_BOOL CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const 382 bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
383 { 383 {
384 FX_FLOAT A_ = pBuf[0]; 384 FX_FLOAT A_ = pBuf[0];
385 FX_FLOAT B_ = pBuf[1]; 385 FX_FLOAT B_ = pBuf[1];
386 FX_FLOAT C_ = pBuf[2]; 386 FX_FLOAT C_ = pBuf[2];
387 if (m_bGamma) { 387 if (m_bGamma) {
388 A_ = (FX_FLOAT)FXSYS_pow(A_, m_Gamma[0]); 388 A_ = (FX_FLOAT)FXSYS_pow(A_, m_Gamma[0]);
389 B_ = (FX_FLOAT)FXSYS_pow(B_, m_Gamma[1]); 389 B_ = (FX_FLOAT)FXSYS_pow(B_, m_Gamma[1]);
390 C_ = (FX_FLOAT)FXSYS_pow(C_, m_Gamma[2]); 390 C_ = (FX_FLOAT)FXSYS_pow(C_, m_Gamma[2]);
391 } 391 }
392 FX_FLOAT X, Y, Z; 392 FX_FLOAT X, Y, Z;
393 if (m_bMatrix) { 393 if (m_bMatrix) {
394 X = m_Matrix[0] * A_ + m_Matrix[3] * B_ + m_Matrix[6] * C_; 394 X = m_Matrix[0] * A_ + m_Matrix[3] * B_ + m_Matrix[6] * C_;
395 Y = m_Matrix[1] * A_ + m_Matrix[4] * B_ + m_Matrix[7] * C_; 395 Y = m_Matrix[1] * A_ + m_Matrix[4] * B_ + m_Matrix[7] * C_;
396 Z = m_Matrix[2] * A_ + m_Matrix[5] * B_ + m_Matrix[8] * C_; 396 Z = m_Matrix[2] * A_ + m_Matrix[5] * B_ + m_Matrix[8] * C_;
397 } else { 397 } else {
398 X = A_; 398 X = A_;
399 Y = B_; 399 Y = B_;
400 Z = C_; 400 Z = C_;
401 } 401 }
402 XYZ_to_sRGB_WhitePoint(X, Y, Z, R, G, B, m_WhitePoint[0], m_WhitePoint[1], m _WhitePoint[2]); 402 XYZ_to_sRGB_WhitePoint(X, Y, Z, R, G, B, m_WhitePoint[0], m_WhitePoint[1], m _WhitePoint[2]);
403 return TRUE; 403 return true;
404 } 404 }
405 FX_BOOL CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const 405 bool CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) con st
406 { 406 {
407 pBuf[0] = R; 407 pBuf[0] = R;
408 pBuf[1] = G; 408 pBuf[1] = G;
409 pBuf[2] = B; 409 pBuf[2] = B;
410 return TRUE; 410 return true;
411 } 411 }
412 void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const 412 void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
413 { 413 {
414 if (bTransMask) { 414 if (bTransMask) {
415 FX_FLOAT Cal[3]; 415 FX_FLOAT Cal[3];
416 FX_FLOAT R, G, B; 416 FX_FLOAT R, G, B;
417 for(int i = 0; i < pixels; i ++) { 417 for(int i = 0; i < pixels; i ++) {
418 Cal[0] = ((FX_FLOAT)pSrcBuf[2]) / 255; 418 Cal[0] = ((FX_FLOAT)pSrcBuf[2]) / 255;
419 Cal[1] = ((FX_FLOAT)pSrcBuf[1]) / 255; 419 Cal[1] = ((FX_FLOAT)pSrcBuf[1]) / 255;
420 Cal[2] = ((FX_FLOAT)pSrcBuf[0]) / 255; 420 Cal[2] = ((FX_FLOAT)pSrcBuf[0]) / 255;
421 GetRGB(Cal, R, G, B); 421 GetRGB(Cal, R, G, B);
422 pDestBuf[0] = FXSYS_round(B * 255); 422 pDestBuf[0] = FXSYS_round(B * 255);
423 pDestBuf[1] = FXSYS_round(G * 255); 423 pDestBuf[1] = FXSYS_round(G * 255);
424 pDestBuf[2] = FXSYS_round(R * 255); 424 pDestBuf[2] = FXSYS_round(R * 255);
425 pSrcBuf += 3; 425 pSrcBuf += 3;
426 pDestBuf += 3; 426 pDestBuf += 3;
427 } 427 }
428 } 428 }
429 ReverseRGB(pDestBuf, pSrcBuf, pixels); 429 ReverseRGB(pDestBuf, pSrcBuf, pixels);
430 } 430 }
431 class CPDF_LabCS : public CPDF_ColorSpace 431 class CPDF_LabCS : public CPDF_ColorSpace
432 { 432 {
433 public: 433 public:
434 explicit CPDF_LabCS(CPDF_Document* pDoc) 434 explicit CPDF_LabCS(CPDF_Document* pDoc)
435 : CPDF_ColorSpace(pDoc, PDFCS_LAB, 3) { 435 : CPDF_ColorSpace(pDoc, PDFCS_LAB, 3) {
436 } 436 }
437 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override; 437 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override;
438 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 438 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
439 FX_BOOL» GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) co nst override; 439 bool» GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) co nst override;
440 FX_BOOL» SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override; 440 bool» SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
441 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width, 441 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width,
442 int image_height, FX_BOOL bTransMask = FALSE) const; 442 int image_height, bool bTransMask = false) const;
443 443
444 FX_FLOAT m_WhitePoint[3]; 444 FX_FLOAT m_WhitePoint[3];
445 FX_FLOAT m_BlackPoint[3]; 445 FX_FLOAT m_BlackPoint[3];
446 FX_FLOAT m_Ranges[4]; 446 FX_FLOAT m_Ranges[4];
447 }; 447 };
448 FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 448 bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
449 { 449 {
450 CPDF_Dictionary* pDict = pArray->GetDict(1); 450 CPDF_Dictionary* pDict = pArray->GetDict(1);
451 if (!pDict) { 451 if (!pDict) {
452 return FALSE; 452 return false;
453 } 453 }
454 CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint")); 454 CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
455 int i; 455 int i;
456 for (i = 0; i < 3; i ++) { 456 for (i = 0; i < 3; i ++) {
457 m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0; 457 m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0;
458 } 458 }
459 pParam = pDict->GetArray(FX_BSTRC("BlackPoint")); 459 pParam = pDict->GetArray(FX_BSTRC("BlackPoint"));
460 for (i = 0; i < 3; i ++) { 460 for (i = 0; i < 3; i ++) {
461 m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0; 461 m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0;
462 } 462 }
463 pParam = pDict->GetArray(FX_BSTRC("Range")); 463 pParam = pDict->GetArray(FX_BSTRC("Range"));
464 const FX_FLOAT def_ranges[4] = { -100 * 1.0f, 100 * 1.0f, -100 * 1.0f, 100 * 1.0f}; 464 const FX_FLOAT def_ranges[4] = { -100 * 1.0f, 100 * 1.0f, -100 * 1.0f, 100 * 1.0f};
465 for (i = 0; i < 4; i ++) { 465 for (i = 0; i < 4; i ++) {
466 m_Ranges[i] = pParam ? pParam->GetNumber(i) : def_ranges[i]; 466 m_Ranges[i] = pParam ? pParam->GetNumber(i) : def_ranges[i];
467 } 467 }
468 return TRUE; 468 return true;
469 } 469 }
470 void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const 470 void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const
471 { 471 {
472 assert(iComponent < 3); 472 assert(iComponent < 3);
473 value = 0; 473 value = 0;
474 if (iComponent == 0) { 474 if (iComponent == 0) {
475 min = 0; 475 min = 0;
476 max = 100 * 1.0f; 476 max = 100 * 1.0f;
477 } else { 477 } else {
478 min = m_Ranges[iComponent * 2 - 2]; 478 min = m_Ranges[iComponent * 2 - 2];
479 max = m_Ranges[iComponent * 2 - 1]; 479 max = m_Ranges[iComponent * 2 - 1];
480 if (value < min) { 480 if (value < min) {
481 value = min; 481 value = min;
482 } else if (value > max) { 482 } else if (value > max) {
483 value = max; 483 value = max;
484 } 484 }
485 } 485 }
486 } 486 }
487 FX_BOOL CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B ) const 487 bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) c onst
488 { 488 {
489 FX_FLOAT Lstar = pBuf[0]; 489 FX_FLOAT Lstar = pBuf[0];
490 FX_FLOAT astar = pBuf[1]; 490 FX_FLOAT astar = pBuf[1];
491 FX_FLOAT bstar = pBuf[2]; 491 FX_FLOAT bstar = pBuf[2];
492 FX_FLOAT M = (Lstar + 16.0f) / 116.0f; 492 FX_FLOAT M = (Lstar + 16.0f) / 116.0f;
493 FX_FLOAT L = M + astar / 500.0f; 493 FX_FLOAT L = M + astar / 500.0f;
494 FX_FLOAT N = M - bstar / 200.0f; 494 FX_FLOAT N = M - bstar / 200.0f;
495 FX_FLOAT X, Y, Z; 495 FX_FLOAT X, Y, Z;
496 if (L < 0.2069f) { 496 if (L < 0.2069f) {
497 X = 0.957f * 0.12842f * (L - 0.1379f); 497 X = 0.957f * 0.12842f * (L - 0.1379f);
498 } else { 498 } else {
499 X = 0.957f * L * L * L; 499 X = 0.957f * L * L * L;
500 } 500 }
501 if (M < 0.2069f) { 501 if (M < 0.2069f) {
502 Y = 0.12842f * (M - 0.1379f); 502 Y = 0.12842f * (M - 0.1379f);
503 } else { 503 } else {
504 Y = M * M * M; 504 Y = M * M * M;
505 } 505 }
506 if (N < 0.2069f) { 506 if (N < 0.2069f) {
507 Z = 1.0889f * 0.12842f * (N - 0.1379f); 507 Z = 1.0889f * 0.12842f * (N - 0.1379f);
508 } else { 508 } else {
509 Z = 1.0889f * N * N * N; 509 Z = 1.0889f * N * N * N;
510 } 510 }
511 XYZ_to_sRGB(X, Y, Z, R, G, B); 511 XYZ_to_sRGB(X, Y, Z, R, G, B);
512 return TRUE; 512 return true;
513 } 513 }
514 FX_BOOL CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) c onst 514 bool CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) cons t
515 { 515 {
516 return FALSE; 516 return false;
517 } 517 }
518 void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, i nt pixels, int image_width, int image_height, FX_BOOL bTransMask) const 518 void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, i nt pixels, int image_width, int image_height, bool bTransMask) const
519 { 519 {
520 for (int i = 0; i < pixels; i ++) { 520 for (int i = 0; i < pixels; i ++) {
521 FX_FLOAT lab[3]; 521 FX_FLOAT lab[3];
522 FX_FLOAT R, G, B; 522 FX_FLOAT R, G, B;
523 lab[0] = (pSrcBuf[0] * 100 / 255.0f); 523 lab[0] = (pSrcBuf[0] * 100 / 255.0f);
524 lab[1] = (FX_FLOAT)(pSrcBuf[1] - 128); 524 lab[1] = (FX_FLOAT)(pSrcBuf[1] - 128);
525 lab[2] = (FX_FLOAT)(pSrcBuf[2] - 128); 525 lab[2] = (FX_FLOAT)(pSrcBuf[2] - 128);
526 GetRGB(lab, R, G, B); 526 GetRGB(lab, R, G, B);
527 pDestBuf[0] = (int32_t)(B * 255); 527 pDestBuf[0] = (int32_t)(B * 255);
528 pDestBuf[1] = (int32_t)(G * 255); 528 pDestBuf[1] = (int32_t)(G * 255);
529 pDestBuf[2] = (int32_t)(R * 255); 529 pDestBuf[2] = (int32_t)(R * 255);
530 pDestBuf += 3; 530 pDestBuf += 3;
531 pSrcBuf += 3; 531 pSrcBuf += 3;
532 } 532 }
533 } 533 }
534 CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize): 534 CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize):
535 m_bsRGB(FALSE), 535 m_bsRGB(false),
536 m_pTransform(NULL), 536 m_pTransform(NULL),
537 m_nSrcComponents(0) 537 m_nSrcComponents(0)
538 { 538 {
539 if (dwSize == 3144 && FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) = = 0) { 539 if (dwSize == 3144 && FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) = = 0) {
540 m_bsRGB = TRUE; 540 m_bsRGB = true;
541 m_nSrcComponents = 3; 541 m_nSrcComponents = 3;
542 } 542 }
543 else if (CPDF_ModuleMgr::Get()->GetIccModule()) { 543 else if (CPDF_ModuleMgr::Get()->GetIccModule()) {
544 m_pTransform = CPDF_ModuleMgr::Get()->GetIccModule()->CreateTransform_sR GB(pData, dwSize, m_nSrcComponents); 544 m_pTransform = CPDF_ModuleMgr::Get()->GetIccModule()->CreateTransform_sR GB(pData, dwSize, m_nSrcComponents);
545 } 545 }
546 } 546 }
547 CPDF_IccProfile::~CPDF_IccProfile() 547 CPDF_IccProfile::~CPDF_IccProfile()
548 { 548 {
549 if (m_pTransform) { 549 if (m_pTransform) {
550 CPDF_ModuleMgr::Get()->GetIccModule()->DestroyTransform(m_pTransform); 550 CPDF_ModuleMgr::Get()->GetIccModule()->DestroyTransform(m_pTransform);
551 } 551 }
552 } 552 }
553 class CPDF_ICCBasedCS : public CPDF_ColorSpace 553 class CPDF_ICCBasedCS : public CPDF_ColorSpace
554 { 554 {
555 public: 555 public:
556 explicit CPDF_ICCBasedCS(CPDF_Document* pDoc) 556 explicit CPDF_ICCBasedCS(CPDF_Document* pDoc)
557 : CPDF_ColorSpace(pDoc, PDFCS_ICCBASED, 0), 557 : CPDF_ColorSpace(pDoc, PDFCS_ICCBASED, 0),
558 m_pAlterCS(nullptr), 558 m_pAlterCS(nullptr),
559 m_pProfile(nullptr), 559 m_pProfile(nullptr),
560 m_pCache(nullptr), 560 m_pCache(nullptr),
561 m_pRanges(nullptr), 561 m_pRanges(nullptr),
562 m_bOwn(FALSE) { 562 m_bOwn(false) {
563 } 563 }
564 ~CPDF_ICCBasedCS() override; 564 ~CPDF_ICCBasedCS() override;
565 565
566 FX_BOOL» v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 566 bool» v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
567 FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override; 567 bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const ove rride;
568 FX_BOOL» SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override; 568 bool» SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
569 FX_BOOL» v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const override; 569 bool» v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const override;
570 void EnableStdConversion(FX_BOOL bEnabled) override; 570 void EnableStdConversion(bool bEnabled) override;
571 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width, 571 void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixel s, int image_width,
572 int image_height, FX_BOOL bTransMask = FALSE) const override; 572 int image_height, bool bTransMask = false) const ove rride;
573 573
574 CPDF_ColorSpace* m_pAlterCS; 574 CPDF_ColorSpace* m_pAlterCS;
575 CPDF_IccProfile* m_pProfile; 575 CPDF_IccProfile* m_pProfile;
576 uint8_t* m_pCache; 576 uint8_t* m_pCache;
577 FX_FLOAT* m_pRanges; 577 FX_FLOAT* m_pRanges;
578 FX_BOOL» m_bOwn; 578 bool» m_bOwn;
579 }; 579 };
580 580
581 CPDF_ICCBasedCS::~CPDF_ICCBasedCS() 581 CPDF_ICCBasedCS::~CPDF_ICCBasedCS()
582 { 582 {
583 if (m_pCache) { 583 if (m_pCache) {
584 FX_Free(m_pCache); 584 FX_Free(m_pCache);
585 } 585 }
586 if (m_pRanges) { 586 if (m_pRanges) {
587 FX_Free(m_pRanges); 587 FX_Free(m_pRanges);
588 } 588 }
589 if (m_pAlterCS && m_bOwn) { 589 if (m_pAlterCS && m_bOwn) {
590 m_pAlterCS->ReleaseCS(); 590 m_pAlterCS->ReleaseCS();
591 } 591 }
592 if (m_pProfile && m_pDocument) { 592 if (m_pProfile && m_pDocument) {
593 m_pDocument->GetPageData()->ReleaseIccProfile(m_pProfile); 593 m_pDocument->GetPageData()->ReleaseIccProfile(m_pProfile);
594 } 594 }
595 } 595 }
596 596
597 FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 597 bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
598 { 598 {
599 CPDF_Stream* pStream = pArray->GetStream(1); 599 CPDF_Stream* pStream = pArray->GetStream(1);
600 if (pStream == NULL) { 600 if (pStream == NULL) {
601 return FALSE; 601 return false;
602 } 602 }
603 m_pProfile = pDoc->LoadIccProfile(pStream); 603 m_pProfile = pDoc->LoadIccProfile(pStream);
604 if (!m_pProfile) { 604 if (!m_pProfile) {
605 return FALSE; 605 return false;
606 } 606 }
607 m_nComponents = m_pProfile->GetComponents(); //Try using the nComponents fro m ICC profile 607 m_nComponents = m_pProfile->GetComponents(); //Try using the nComponents fro m ICC profile
608 CPDF_Dictionary* pDict = pStream->GetDict(); 608 CPDF_Dictionary* pDict = pStream->GetDict();
609 if (m_pProfile->m_pTransform == NULL) { // No valid ICC profile or using sRG B 609 if (m_pProfile->m_pTransform == NULL) { // No valid ICC profile or using sRG B
610 CPDF_Object* pAlterCSObj = pDict ? pDict->GetElementValue(FX_BSTRC("Alte rnate")) : NULL; 610 CPDF_Object* pAlterCSObj = pDict ? pDict->GetElementValue(FX_BSTRC("Alte rnate")) : NULL;
611 if (pAlterCSObj) { 611 if (pAlterCSObj) {
612 CPDF_ColorSpace* pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj) ; 612 CPDF_ColorSpace* pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj) ;
613 if (pAlterCS) { 613 if (pAlterCS) {
614 if (m_nComponents == 0) { // NO valid ICC profile 614 if (m_nComponents == 0) { // NO valid ICC profile
615 if (pAlterCS->CountComponents() > 0) { // Use Alternative co lorspace 615 if (pAlterCS->CountComponents() > 0) { // Use Alternative co lorspace
616 m_nComponents = pAlterCS->CountComponents(); 616 m_nComponents = pAlterCS->CountComponents();
617 m_pAlterCS = pAlterCS; 617 m_pAlterCS = pAlterCS;
618 m_bOwn = TRUE; 618 m_bOwn = true;
619 } 619 }
620 else { // No valid alternative colorspace 620 else { // No valid alternative colorspace
621 pAlterCS->ReleaseCS(); 621 pAlterCS->ReleaseCS();
622 int32_t nDictComponents = pDict ? pDict->GetInteger(FX_B STRC("N")) : 0; 622 int32_t nDictComponents = pDict ? pDict->GetInteger(FX_B STRC("N")) : 0;
623 if (nDictComponents != 1 && nDictComponents != 3 && nDic tComponents != 4) { 623 if (nDictComponents != 1 && nDictComponents != 3 && nDic tComponents != 4) {
624 return FALSE; 624 return false;
625 } 625 }
626 m_nComponents = nDictComponents; 626 m_nComponents = nDictComponents;
627 } 627 }
628 628
629 } 629 }
630 else { // Using sRGB 630 else { // Using sRGB
631 if (pAlterCS->CountComponents() != m_nComponents) { 631 if (pAlterCS->CountComponents() != m_nComponents) {
632 pAlterCS->ReleaseCS(); 632 pAlterCS->ReleaseCS();
633 } 633 }
634 else { 634 else {
635 m_pAlterCS = pAlterCS; 635 m_pAlterCS = pAlterCS;
636 m_bOwn = TRUE; 636 m_bOwn = true;
637 } 637 }
638 } 638 }
639 } 639 }
640 } 640 }
641 if (!m_pAlterCS) { 641 if (!m_pAlterCS) {
642 if (m_nComponents == 1) { 642 if (m_nComponents == 1) {
643 m_pAlterCS = GetStockCS(PDFCS_DEVICEGRAY); 643 m_pAlterCS = GetStockCS(PDFCS_DEVICEGRAY);
644 } 644 }
645 else if (m_nComponents == 3) { 645 else if (m_nComponents == 3) {
646 m_pAlterCS = GetStockCS(PDFCS_DEVICERGB); 646 m_pAlterCS = GetStockCS(PDFCS_DEVICERGB);
647 } 647 }
648 else if (m_nComponents == 4) { 648 else if (m_nComponents == 4) {
649 m_pAlterCS = GetStockCS(PDFCS_DEVICECMYK); 649 m_pAlterCS = GetStockCS(PDFCS_DEVICECMYK);
650 } 650 }
651 } 651 }
652 } 652 }
653 CPDF_Array* pRanges = pDict->GetArray(FX_BSTRC("Range")); 653 CPDF_Array* pRanges = pDict->GetArray(FX_BSTRC("Range"));
654 m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2); 654 m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2);
655 for (int i = 0; i < m_nComponents * 2; i ++) { 655 for (int i = 0; i < m_nComponents * 2; i ++) {
656 if (pRanges) { 656 if (pRanges) {
657 m_pRanges[i] = pRanges->GetNumber(i); 657 m_pRanges[i] = pRanges->GetNumber(i);
658 } else if (i % 2) { 658 } else if (i % 2) {
659 m_pRanges[i] = 1.0f; 659 m_pRanges[i] = 1.0f;
660 } else { 660 } else {
661 m_pRanges[i] = 0; 661 m_pRanges[i] = 0;
662 } 662 }
663 } 663 }
664 return TRUE; 664 return true;
665 } 665 }
666 FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLO AT& B) const 666 bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
667 { 667 {
668 if (m_pProfile && m_pProfile->m_bsRGB) { 668 if (m_pProfile && m_pProfile->m_bsRGB) {
669 R = pBuf[0]; 669 R = pBuf[0];
670 G = pBuf[1]; 670 G = pBuf[1];
671 B = pBuf[2]; 671 B = pBuf[2];
672 return TRUE; 672 return true;
673 } 673 }
674 ICodec_IccModule *pIccModule = CPDF_ModuleMgr::Get()->GetIccModule(); 674 ICodec_IccModule *pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
675 if (m_pProfile->m_pTransform == NULL || pIccModule == NULL) { 675 if (m_pProfile->m_pTransform == NULL || pIccModule == NULL) {
676 if (m_pAlterCS) { 676 if (m_pAlterCS) {
677 m_pAlterCS->GetRGB(pBuf, R, G, B); 677 m_pAlterCS->GetRGB(pBuf, R, G, B);
678 } else { 678 } else {
679 R = G = B = 0.0f; 679 R = G = B = 0.0f;
680 } 680 }
681 return TRUE; 681 return true;
682 } 682 }
683 FX_FLOAT rgb[3]; 683 FX_FLOAT rgb[3];
684 pIccModule->SetComponents(m_nComponents); 684 pIccModule->SetComponents(m_nComponents);
685 pIccModule->Translate(m_pProfile->m_pTransform, pBuf, rgb); 685 pIccModule->Translate(m_pProfile->m_pTransform, pBuf, rgb);
686 R = rgb[0]; 686 R = rgb[0];
687 G = rgb[1]; 687 G = rgb[1];
688 B = rgb[2]; 688 B = rgb[2];
689 return TRUE; 689 return true;
690 } 690 }
691 FX_BOOL CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_ FLOAT& y, FX_FLOAT& k) const 691 bool CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLO AT& y, FX_FLOAT& k) const
692 { 692 {
693 if (m_nComponents != 4) { 693 if (m_nComponents != 4) {
694 return FALSE; 694 return false;
695 } 695 }
696 c = pBuf[0]; 696 c = pBuf[0];
697 m = pBuf[1]; 697 m = pBuf[1];
698 y = pBuf[2]; 698 y = pBuf[2];
699 k = pBuf[3]; 699 k = pBuf[3];
700 return TRUE; 700 return true;
701 } 701 }
702 FX_BOOL CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const 702 bool CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
703 { 703 {
704 return FALSE; 704 return false;
705 } 705 }
706 void CPDF_ICCBasedCS::EnableStdConversion(FX_BOOL bEnabled) 706 void CPDF_ICCBasedCS::EnableStdConversion(bool bEnabled)
707 { 707 {
708 CPDF_ColorSpace::EnableStdConversion(bEnabled); 708 CPDF_ColorSpace::EnableStdConversion(bEnabled);
709 if (m_pAlterCS) { 709 if (m_pAlterCS) {
710 m_pAlterCS->EnableStdConversion(bEnabled); 710 m_pAlterCS->EnableStdConversion(bEnabled);
711 } 711 }
712 } 712 }
713 void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcB uf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const 713 void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcB uf, int pixels, int image_width, int image_height, bool bTransMask) const
714 { 714 {
715 if (m_pProfile->m_bsRGB) { 715 if (m_pProfile->m_bsRGB) {
716 ReverseRGB(pDestBuf, pSrcBuf, pixels); 716 ReverseRGB(pDestBuf, pSrcBuf, pixels);
717 } else if (m_pProfile->m_pTransform) { 717 } else if (m_pProfile->m_pTransform) {
718 int nMaxColors = 1; 718 int nMaxColors = 1;
719 for (int i = 0; i < m_nComponents; i ++) { 719 for (int i = 0; i < m_nComponents; i ++) {
720 nMaxColors *= 52; 720 nMaxColors *= 52;
721 } 721 }
722 if (m_nComponents > 3 || image_width * image_height < nMaxColors * 3 / 2 ) { 722 if (m_nComponents > 3 || image_width * image_height < nMaxColors * 3 / 2 ) {
723 CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(m_pProfile- >m_pTransform, pDestBuf, pSrcBuf, pixels); 723 CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(m_pProfile- >m_pTransform, pDestBuf, pSrcBuf, pixels);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 { 758 {
759 public: 759 public:
760 explicit CPDF_IndexedCS(CPDF_Document* pDoc) 760 explicit CPDF_IndexedCS(CPDF_Document* pDoc)
761 : CPDF_ColorSpace(pDoc, PDFCS_INDEXED, 1), 761 : CPDF_ColorSpace(pDoc, PDFCS_INDEXED, 1),
762 m_pBaseCS(nullptr), 762 m_pBaseCS(nullptr),
763 m_pCountedBaseCS(nullptr), 763 m_pCountedBaseCS(nullptr),
764 m_pCompMinMax(nullptr) { 764 m_pCompMinMax(nullptr) {
765 } 765 }
766 ~CPDF_IndexedCS() override; 766 ~CPDF_IndexedCS() override;
767 767
768 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 768 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
769 FX_BOOL» GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) co nst override; 769 bool» GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) co nst override;
770 CPDF_ColorSpace* GetBaseCS() const override; 770 CPDF_ColorSpace* GetBaseCS() const override;
771 void EnableStdConversion(FX_BOOL bEnabled) override; 771 void EnableStdConversion(bool bEnabled) override;
772 772
773 CPDF_ColorSpace* m_pBaseCS; 773 CPDF_ColorSpace* m_pBaseCS;
774 CPDF_CountedColorSpace* m_pCountedBaseCS; 774 CPDF_CountedColorSpace* m_pCountedBaseCS;
775 int m_nBaseComponents; 775 int m_nBaseComponents;
776 int m_MaxIndex; 776 int m_MaxIndex;
777 CFX_ByteString m_Table; 777 CFX_ByteString m_Table;
778 FX_FLOAT* m_pCompMinMax; 778 FX_FLOAT* m_pCompMinMax;
779 }; 779 };
780 CPDF_IndexedCS::~CPDF_IndexedCS() 780 CPDF_IndexedCS::~CPDF_IndexedCS()
781 { 781 {
782 if (m_pCompMinMax) { 782 if (m_pCompMinMax) {
783 FX_Free(m_pCompMinMax); 783 FX_Free(m_pCompMinMax);
784 } 784 }
785 CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL; 785 CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL;
786 if (pCS && m_pDocument) { 786 if (pCS && m_pDocument) {
787 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); 787 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
788 } 788 }
789 } 789 }
790 FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 790 bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
791 { 791 {
792 if (pArray->GetCount() < 4) { 792 if (pArray->GetCount() < 4) {
793 return FALSE; 793 return false;
794 } 794 }
795 CPDF_Object* pBaseObj = pArray->GetElementValue(1); 795 CPDF_Object* pBaseObj = pArray->GetElementValue(1);
796 if (pBaseObj == m_pArray) { 796 if (pBaseObj == m_pArray) {
797 return FALSE; 797 return false;
798 } 798 }
799 CPDF_DocPageData* pDocPageData = pDoc->GetPageData(); 799 CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
800 m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL); 800 m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL);
801 if (m_pBaseCS == NULL) { 801 if (m_pBaseCS == NULL) {
802 return FALSE; 802 return false;
803 } 803 }
804 m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray()); 804 m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
805 m_nBaseComponents = m_pBaseCS->CountComponents(); 805 m_nBaseComponents = m_pBaseCS->CountComponents();
806 m_pCompMinMax = FX_Alloc2D(FX_FLOAT, m_nBaseComponents, 2); 806 m_pCompMinMax = FX_Alloc2D(FX_FLOAT, m_nBaseComponents, 2);
807 FX_FLOAT defvalue; 807 FX_FLOAT defvalue;
808 for (int i = 0; i < m_nBaseComponents; i ++) { 808 for (int i = 0; i < m_nBaseComponents; i ++) {
809 m_pBaseCS->GetDefaultValue(i, defvalue, m_pCompMinMax[i * 2], m_pCompMin Max[i * 2 + 1]); 809 m_pBaseCS->GetDefaultValue(i, defvalue, m_pCompMinMax[i * 2], m_pCompMin Max[i * 2 + 1]);
810 m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2]; 810 m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2];
811 } 811 }
812 m_MaxIndex = pArray->GetInteger(2); 812 m_MaxIndex = pArray->GetInteger(2);
813 CPDF_Object* pTableObj = pArray->GetElementValue(3); 813 CPDF_Object* pTableObj = pArray->GetElementValue(3);
814 if (pTableObj == NULL) { 814 if (pTableObj == NULL) {
815 return FALSE; 815 return false;
816 } 816 }
817 if (pTableObj->GetType() == PDFOBJ_STRING) { 817 if (pTableObj->GetType() == PDFOBJ_STRING) {
818 m_Table = ((CPDF_String*)pTableObj)->GetString(); 818 m_Table = ((CPDF_String*)pTableObj)->GetString();
819 } else if (pTableObj->GetType() == PDFOBJ_STREAM) { 819 } else if (pTableObj->GetType() == PDFOBJ_STREAM) {
820 CPDF_StreamAcc acc; 820 CPDF_StreamAcc acc;
821 acc.LoadAllData((CPDF_Stream*)pTableObj, FALSE); 821 acc.LoadAllData((CPDF_Stream*)pTableObj, false);
822 m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize()); 822 m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize());
823 } 823 }
824 return TRUE; 824 return true;
825 } 825 }
826 826
827 FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA T& B) const 827 bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
828 { 828 {
829 int index = (int32_t)(*pBuf); 829 int index = (int32_t)(*pBuf);
830 if (index < 0 || index > m_MaxIndex) { 830 if (index < 0 || index > m_MaxIndex) {
831 return FALSE; 831 return false;
832 } 832 }
833 if (m_nBaseComponents) { 833 if (m_nBaseComponents) {
834 if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents || 834 if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents ||
835 (index + 1)*m_nBaseComponents > (int)m_Table.GetLength()) { 835 (index + 1)*m_nBaseComponents > (int)m_Table.GetLength()) {
836 R = G = B = 0; 836 R = G = B = 0;
837 return FALSE; 837 return false;
838 } 838 }
839 } 839 }
840 CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents); 840 CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents);
841 FX_FLOAT* comps = Comps; 841 FX_FLOAT* comps = Comps;
842 const uint8_t* pTable = m_Table; 842 const uint8_t* pTable = m_Table;
843 for (int i = 0; i < m_nBaseComponents; i ++) { 843 for (int i = 0; i < m_nBaseComponents; i ++) {
844 comps[i] = m_pCompMinMax[i * 2] + m_pCompMinMax[i * 2 + 1] * pTable[inde x * m_nBaseComponents + i] / 255; 844 comps[i] = m_pCompMinMax[i * 2] + m_pCompMinMax[i * 2 + 1] * pTable[inde x * m_nBaseComponents + i] / 255;
845 } 845 }
846 m_pBaseCS->GetRGB(comps, R, G, B); 846 m_pBaseCS->GetRGB(comps, R, G, B);
847 return TRUE; 847 return true;
848 } 848 }
849 CPDF_ColorSpace*CPDF_IndexedCS::GetBaseCS() const 849 CPDF_ColorSpace*CPDF_IndexedCS::GetBaseCS() const
850 { 850 {
851 return m_pBaseCS; 851 return m_pBaseCS;
852 } 852 }
853 void CPDF_IndexedCS::EnableStdConversion(FX_BOOL bEnabled) 853 void CPDF_IndexedCS::EnableStdConversion(bool bEnabled)
854 { 854 {
855 CPDF_ColorSpace::EnableStdConversion(bEnabled); 855 CPDF_ColorSpace::EnableStdConversion(bEnabled);
856 if (m_pBaseCS) { 856 if (m_pBaseCS) {
857 m_pBaseCS->EnableStdConversion(bEnabled); 857 m_pBaseCS->EnableStdConversion(bEnabled);
858 } 858 }
859 } 859 }
860 #define MAX_PATTERN_COLORCOMPS 16 860 #define MAX_PATTERN_COLORCOMPS 16
861 typedef struct _PatternValue { 861 typedef struct _PatternValue {
862 CPDF_Pattern* m_pPattern; 862 CPDF_Pattern* m_pPattern;
863 CPDF_CountedPattern* m_pCountedPattern; 863 CPDF_CountedPattern* m_pCountedPattern;
864 int m_nComps; 864 int m_nComps;
865 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; 865 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS];
866 } PatternValue; 866 } PatternValue;
867 CPDF_PatternCS::~CPDF_PatternCS() 867 CPDF_PatternCS::~CPDF_PatternCS()
868 { 868 {
869 CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL; 869 CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL;
870 if (pCS && m_pDocument) { 870 if (pCS && m_pDocument) {
871 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); 871 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
872 } 872 }
873 } 873 }
874 FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 874 bool CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
875 { 875 {
876 CPDF_Object* pBaseCS = pArray->GetElementValue(1); 876 CPDF_Object* pBaseCS = pArray->GetElementValue(1);
877 if (pBaseCS == m_pArray) { 877 if (pBaseCS == m_pArray) {
878 return FALSE; 878 return false;
879 } 879 }
880 CPDF_DocPageData* pDocPageData = pDoc->GetPageData(); 880 CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
881 m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, NULL); 881 m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, NULL);
882 if (m_pBaseCS) { 882 if (m_pBaseCS) {
883 if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) { 883 if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) {
884 return FALSE; 884 return false;
885 } 885 }
886 m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray() ); 886 m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray() );
887 m_nComponents = m_pBaseCS->CountComponents() + 1; 887 m_nComponents = m_pBaseCS->CountComponents() + 1;
888 if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) { 888 if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) {
889 return FALSE; 889 return false;
890 } 890 }
891 } else { 891 } else {
892 m_nComponents = 1; 892 m_nComponents = 1;
893 } 893 }
894 return TRUE; 894 return true;
895 } 895 }
896 FX_BOOL CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA T& B) const 896 bool CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
897 { 897 {
898 if (m_pBaseCS) { 898 if (m_pBaseCS) {
899 ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN); 899 ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN);
900 PatternValue* pvalue = (PatternValue*)pBuf; 900 PatternValue* pvalue = (PatternValue*)pBuf;
901 if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B)) { 901 if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B)) {
902 return TRUE; 902 return true;
903 } 903 }
904 } 904 }
905 R = G = B = 0.75f; 905 R = G = B = 0.75f;
906 return FALSE; 906 return false;
907 } 907 }
908 CPDF_ColorSpace* CPDF_PatternCS::GetBaseCS() const 908 CPDF_ColorSpace* CPDF_PatternCS::GetBaseCS() const
909 { 909 {
910 return m_pBaseCS; 910 return m_pBaseCS;
911 } 911 }
912 class CPDF_SeparationCS : public CPDF_ColorSpace 912 class CPDF_SeparationCS : public CPDF_ColorSpace
913 { 913 {
914 public: 914 public:
915 CPDF_SeparationCS(CPDF_Document* pDoc) 915 CPDF_SeparationCS(CPDF_Document* pDoc)
916 : CPDF_ColorSpace(pDoc, PDFCS_SEPARATION, 1), 916 : CPDF_ColorSpace(pDoc, PDFCS_SEPARATION, 1),
917 m_pAltCS(nullptr), 917 m_pAltCS(nullptr),
918 m_pFunc(nullptr) { 918 m_pFunc(nullptr) {
919 } 919 }
920 ~CPDF_SeparationCS() override; 920 ~CPDF_SeparationCS() override;
921 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override; 921 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override;
922 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 922 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
923 FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override; 923 bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const ove rride;
924 void EnableStdConversion(FX_BOOL bEnabled) override; 924 void EnableStdConversion(bool bEnabled) override;
925 925
926 CPDF_ColorSpace* m_pAltCS; 926 CPDF_ColorSpace* m_pAltCS;
927 CPDF_Function* m_pFunc; 927 CPDF_Function* m_pFunc;
928 enum { None, All, Colorant } m_Type; 928 enum { None, All, Colorant } m_Type;
929 }; 929 };
930 CPDF_SeparationCS::~CPDF_SeparationCS() 930 CPDF_SeparationCS::~CPDF_SeparationCS()
931 { 931 {
932 if (m_pAltCS) { 932 if (m_pAltCS) {
933 m_pAltCS->ReleaseCS(); 933 m_pAltCS->ReleaseCS();
934 } 934 }
935 delete m_pFunc; 935 delete m_pFunc;
936 } 936 }
937 void CPDF_SeparationCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOA T& min, FX_FLOAT& max) const 937 void CPDF_SeparationCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOA T& min, FX_FLOAT& max) const
938 { 938 {
939 value = 1.0f; 939 value = 1.0f;
940 min = 0; 940 min = 0;
941 max = 1.0f; 941 max = 1.0f;
942 } 942 }
943 FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 943 bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
944 { 944 {
945 CFX_ByteString name = pArray->GetString(1); 945 CFX_ByteString name = pArray->GetString(1);
946 if (name == FX_BSTRC("None")) { 946 if (name == FX_BSTRC("None")) {
947 m_Type = None; 947 m_Type = None;
948 } else { 948 } else {
949 m_Type = Colorant; 949 m_Type = Colorant;
950 CPDF_Object* pAltCS = pArray->GetElementValue(2); 950 CPDF_Object* pAltCS = pArray->GetElementValue(2);
951 if (pAltCS == m_pArray) { 951 if (pAltCS == m_pArray) {
952 return FALSE; 952 return false;
953 } 953 }
954 m_pAltCS = Load(pDoc, pAltCS); 954 m_pAltCS = Load(pDoc, pAltCS);
955 if (!m_pAltCS) { 955 if (!m_pAltCS) {
956 return FALSE; 956 return false;
957 } 957 }
958 CPDF_Object* pFuncObj = pArray->GetElementValue(3); 958 CPDF_Object* pFuncObj = pArray->GetElementValue(3);
959 if (pFuncObj && pFuncObj->GetType() != PDFOBJ_NAME) { 959 if (pFuncObj && pFuncObj->GetType() != PDFOBJ_NAME) {
960 m_pFunc = CPDF_Function::Load(pFuncObj); 960 m_pFunc = CPDF_Function::Load(pFuncObj);
961 } 961 }
962 if (m_pFunc && m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) { 962 if (m_pFunc && m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
963 delete m_pFunc; 963 delete m_pFunc;
964 m_pFunc = NULL; 964 m_pFunc = NULL;
965 } 965 }
966 } 966 }
967 return TRUE; 967 return true;
968 } 968 }
969 FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_F LOAT& B) const 969 bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA T& B) const
970 { 970 {
971 if (m_Type == None) { 971 if (m_Type == None) {
972 return FALSE; 972 return false;
973 } 973 }
974 if (m_pFunc == NULL) { 974 if (m_pFunc == NULL) {
975 if (m_pAltCS == NULL) { 975 if (m_pAltCS == NULL) {
976 return FALSE; 976 return false;
977 } 977 }
978 int nComps = m_pAltCS->CountComponents(); 978 int nComps = m_pAltCS->CountComponents();
979 CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps); 979 CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps);
980 for (int i = 0; i < nComps; i ++) { 980 for (int i = 0; i < nComps; i ++) {
981 results[i] = *pBuf; 981 results[i] = *pBuf;
982 } 982 }
983 m_pAltCS->GetRGB(results, R, G, B); 983 m_pAltCS->GetRGB(results, R, G, B);
984 return TRUE; 984 return true;
985 } 985 }
986 CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs()); 986 CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
987 int nresults = 0; 987 int nresults = 0;
988 m_pFunc->Call(pBuf, 1, results, nresults); 988 m_pFunc->Call(pBuf, 1, results, nresults);
989 if (nresults == 0) { 989 if (nresults == 0) {
990 return FALSE; 990 return false;
991 } 991 }
992 if (m_pAltCS) { 992 if (m_pAltCS) {
993 m_pAltCS->GetRGB(results, R, G, B); 993 m_pAltCS->GetRGB(results, R, G, B);
994 return TRUE; 994 return true;
995 } 995 }
996 R = G = B = 0; 996 R = G = B = 0;
997 return FALSE; 997 return false;
998 } 998 }
999 void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled) 999 void CPDF_SeparationCS::EnableStdConversion(bool bEnabled)
1000 { 1000 {
1001 CPDF_ColorSpace::EnableStdConversion(bEnabled); 1001 CPDF_ColorSpace::EnableStdConversion(bEnabled);
1002 if (m_pAltCS) { 1002 if (m_pAltCS) {
1003 m_pAltCS->EnableStdConversion(bEnabled); 1003 m_pAltCS->EnableStdConversion(bEnabled);
1004 } 1004 }
1005 } 1005 }
1006 class CPDF_DeviceNCS : public CPDF_ColorSpace 1006 class CPDF_DeviceNCS : public CPDF_ColorSpace
1007 { 1007 {
1008 public: 1008 public:
1009 CPDF_DeviceNCS(CPDF_Document* pDoc) 1009 CPDF_DeviceNCS(CPDF_Document* pDoc)
1010 : CPDF_ColorSpace(pDoc, PDFCS_DEVICEN, 0), 1010 : CPDF_ColorSpace(pDoc, PDFCS_DEVICEN, 0),
1011 m_pAltCS(nullptr), 1011 m_pAltCS(nullptr),
1012 m_pFunc(nullptr) { 1012 m_pFunc(nullptr) {
1013 } 1013 }
1014 ~CPDF_DeviceNCS() override; 1014 ~CPDF_DeviceNCS() override;
1015 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override; 1015 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override;
1016 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 1016 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
1017 FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override; 1017 bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const ove rride;
1018 void EnableStdConversion(FX_BOOL bEnabled) override; 1018 void EnableStdConversion(bool bEnabled) override;
1019 1019
1020 CPDF_ColorSpace* m_pAltCS; 1020 CPDF_ColorSpace* m_pAltCS;
1021 CPDF_Function* m_pFunc; 1021 CPDF_Function* m_pFunc;
1022 }; 1022 };
1023 CPDF_DeviceNCS::~CPDF_DeviceNCS() 1023 CPDF_DeviceNCS::~CPDF_DeviceNCS()
1024 { 1024 {
1025 delete m_pFunc; 1025 delete m_pFunc;
1026 if (m_pAltCS) { 1026 if (m_pAltCS) {
1027 m_pAltCS->ReleaseCS(); 1027 m_pAltCS->ReleaseCS();
1028 } 1028 }
1029 } 1029 }
1030 void CPDF_DeviceNCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const 1030 void CPDF_DeviceNCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const
1031 { 1031 {
1032 value = 1.0f; 1032 value = 1.0f;
1033 min = 0; 1033 min = 0;
1034 max = 1.0f; 1034 max = 1.0f;
1035 } 1035 }
1036 FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 1036 bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
1037 { 1037 {
1038 CPDF_Object* pObj = pArray->GetElementValue(1); 1038 CPDF_Object* pObj = pArray->GetElementValue(1);
1039 if (!pObj) { 1039 if (!pObj) {
1040 return FALSE; 1040 return false;
1041 } 1041 }
1042 if (pObj->GetType() != PDFOBJ_ARRAY) { 1042 if (pObj->GetType() != PDFOBJ_ARRAY) {
1043 return FALSE; 1043 return false;
1044 } 1044 }
1045 m_nComponents = ((CPDF_Array*)pObj)->GetCount(); 1045 m_nComponents = ((CPDF_Array*)pObj)->GetCount();
1046 CPDF_Object* pAltCS = pArray->GetElementValue(2); 1046 CPDF_Object* pAltCS = pArray->GetElementValue(2);
1047 if (!pAltCS || pAltCS == m_pArray) { 1047 if (!pAltCS || pAltCS == m_pArray) {
1048 return FALSE; 1048 return false;
1049 } 1049 }
1050 m_pAltCS = Load(pDoc, pAltCS); 1050 m_pAltCS = Load(pDoc, pAltCS);
1051 m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3)); 1051 m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3));
1052 if (m_pAltCS == NULL || m_pFunc == NULL) { 1052 if (m_pAltCS == NULL || m_pFunc == NULL) {
1053 return FALSE; 1053 return false;
1054 } 1054 }
1055 if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) { 1055 if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
1056 return FALSE; 1056 return false;
1057 } 1057 }
1058 return TRUE; 1058 return true;
1059 } 1059 }
1060 FX_BOOL CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA T& B) const 1060 bool CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
1061 { 1061 {
1062 if (m_pFunc == NULL) { 1062 if (m_pFunc == NULL) {
1063 return FALSE; 1063 return false;
1064 } 1064 }
1065 CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs()); 1065 CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
1066 int nresults = 0; 1066 int nresults = 0;
1067 m_pFunc->Call(pBuf, m_nComponents, results, nresults); 1067 m_pFunc->Call(pBuf, m_nComponents, results, nresults);
1068 if (nresults == 0) { 1068 if (nresults == 0) {
1069 return FALSE; 1069 return false;
1070 } 1070 }
1071 m_pAltCS->GetRGB(results, R, G, B); 1071 m_pAltCS->GetRGB(results, R, G, B);
1072 return TRUE; 1072 return true;
1073 } 1073 }
1074 void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled) 1074 void CPDF_DeviceNCS::EnableStdConversion(bool bEnabled)
1075 { 1075 {
1076 CPDF_ColorSpace::EnableStdConversion(bEnabled); 1076 CPDF_ColorSpace::EnableStdConversion(bEnabled);
1077 if (m_pAltCS) { 1077 if (m_pAltCS) {
1078 m_pAltCS->EnableStdConversion(bEnabled); 1078 m_pAltCS->EnableStdConversion(bEnabled);
1079 } 1079 }
1080 } 1080 }
1081 CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family) 1081 CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family)
1082 { 1082 {
1083 return CPDF_ModuleMgr::Get()->GetPageModule()->GetStockCS(family);; 1083 return CPDF_ModuleMgr::Get()->GetPageModule()->GetStockCS(family);;
1084 } 1084 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 return sizeof(PatternValue); 1190 return sizeof(PatternValue);
1191 } 1191 }
1192 return m_nComponents * sizeof(FX_FLOAT); 1192 return m_nComponents * sizeof(FX_FLOAT);
1193 } 1193 }
1194 FX_FLOAT* CPDF_ColorSpace::CreateBuf() 1194 FX_FLOAT* CPDF_ColorSpace::CreateBuf()
1195 { 1195 {
1196 int size = GetBufSize(); 1196 int size = GetBufSize();
1197 uint8_t* pBuf = FX_Alloc(uint8_t, size); 1197 uint8_t* pBuf = FX_Alloc(uint8_t, size);
1198 return (FX_FLOAT*)pBuf; 1198 return (FX_FLOAT*)pBuf;
1199 } 1199 }
1200 FX_BOOL CPDF_ColorSpace::sRGB() const 1200 bool CPDF_ColorSpace::sRGB() const
1201 { 1201 {
1202 if (m_Family == PDFCS_DEVICERGB) { 1202 if (m_Family == PDFCS_DEVICERGB) {
1203 return TRUE; 1203 return true;
1204 } 1204 }
1205 if (m_Family != PDFCS_ICCBASED) { 1205 if (m_Family != PDFCS_ICCBASED) {
1206 return FALSE; 1206 return false;
1207 } 1207 }
1208 CPDF_ICCBasedCS* pCS = (CPDF_ICCBasedCS*)this; 1208 CPDF_ICCBasedCS* pCS = (CPDF_ICCBasedCS*)this;
1209 return pCS->m_pProfile->m_bsRGB; 1209 return pCS->m_pProfile->m_bsRGB;
1210 } 1210 }
1211 FX_BOOL CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FL OAT& y, FX_FLOAT& k) const 1211 bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT & y, FX_FLOAT& k) const
1212 { 1212 {
1213 if (v_GetCMYK(pBuf, c, m, y, k)) { 1213 if (v_GetCMYK(pBuf, c, m, y, k)) {
1214 return TRUE; 1214 return true;
1215 } 1215 }
1216 FX_FLOAT R, G, B; 1216 FX_FLOAT R, G, B;
1217 if (!GetRGB(pBuf, R, G, B)) { 1217 if (!GetRGB(pBuf, R, G, B)) {
1218 return FALSE; 1218 return false;
1219 } 1219 }
1220 sRGB_to_AdobeCMYK(R, G, B, c, m, y, k); 1220 sRGB_to_AdobeCMYK(R, G, B, c, m, y, k);
1221 return TRUE; 1221 return true;
1222 } 1222 }
1223 FX_BOOL CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOA T y, FX_FLOAT k) const 1223 bool CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y , FX_FLOAT k) const
1224 { 1224 {
1225 if (v_SetCMYK(pBuf, c, m, y, k)) { 1225 if (v_SetCMYK(pBuf, c, m, y, k)) {
1226 return TRUE; 1226 return true;
1227 } 1227 }
1228 FX_FLOAT R, G, B; 1228 FX_FLOAT R, G, B;
1229 AdobeCMYK_to_sRGB(c, m, y, k, R, G, B); 1229 AdobeCMYK_to_sRGB(c, m, y, k, R, G, B);
1230 return SetRGB(pBuf, R, G, B); 1230 return SetRGB(pBuf, R, G, B);
1231 } 1231 }
1232 void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const 1232 void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const
1233 { 1233 {
1234 if (buf == NULL || m_Family == PDFCS_PATTERN) { 1234 if (buf == NULL || m_Family == PDFCS_PATTERN) {
1235 return; 1235 return;
1236 } 1236 }
1237 FX_FLOAT min, max; 1237 FX_FLOAT min, max;
1238 for (int i = 0; i < m_nComponents; i ++) { 1238 for (int i = 0; i < m_nComponents; i ++) {
1239 GetDefaultValue(i, buf[i], min, max); 1239 GetDefaultValue(i, buf[i], min, max);
1240 } 1240 }
1241 } 1241 }
1242 int CPDF_ColorSpace::GetMaxIndex() const 1242 int CPDF_ColorSpace::GetMaxIndex() const
1243 { 1243 {
1244 if (m_Family != PDFCS_INDEXED) { 1244 if (m_Family != PDFCS_INDEXED) {
1245 return 0; 1245 return 0;
1246 } 1246 }
1247 CPDF_IndexedCS* pCS = (CPDF_IndexedCS*)this; 1247 CPDF_IndexedCS* pCS = (CPDF_IndexedCS*)this;
1248 return pCS->m_MaxIndex; 1248 return pCS->m_MaxIndex;
1249 } 1249 }
1250 void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_b uf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const 1250 void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_b uf, int pixels, int image_width, int image_height, bool bTransMask) const
1251 { 1251 {
1252 CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents); 1252 CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents);
1253 FX_FLOAT* src = srcbuf; 1253 FX_FLOAT* src = srcbuf;
1254 FX_FLOAT R, G, B; 1254 FX_FLOAT R, G, B;
1255 for (int i = 0; i < pixels; i ++) { 1255 for (int i = 0; i < pixels; i ++) {
1256 for (int j = 0; j < m_nComponents; j ++) 1256 for (int j = 0; j < m_nComponents; j ++)
1257 if (m_Family == PDFCS_INDEXED) { 1257 if (m_Family == PDFCS_INDEXED) {
1258 src[j] = (FX_FLOAT)(*src_buf ++); 1258 src[j] = (FX_FLOAT)(*src_buf ++);
1259 } else { 1259 } else {
1260 src[j] = (FX_FLOAT)(*src_buf ++) / 255; 1260 src[j] = (FX_FLOAT)(*src_buf ++) / 255;
1261 } 1261 }
1262 GetRGB(src, R, G, B); 1262 GetRGB(src, R, G, B);
1263 *dest_buf ++ = (int32_t)(B * 255); 1263 *dest_buf ++ = (int32_t)(B * 255);
1264 *dest_buf ++ = (int32_t)(G * 255); 1264 *dest_buf ++ = (int32_t)(G * 255);
1265 *dest_buf ++ = (int32_t)(R * 255); 1265 *dest_buf ++ = (int32_t)(R * 255);
1266 } 1266 }
1267 } 1267 }
1268 void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled) 1268 void CPDF_ColorSpace::EnableStdConversion(bool bEnabled)
1269 { 1269 {
1270 if (bEnabled) { 1270 if (bEnabled) {
1271 m_dwStdConversion ++; 1271 m_dwStdConversion ++;
1272 } else if (m_dwStdConversion) { 1272 } else if (m_dwStdConversion) {
1273 m_dwStdConversion --; 1273 m_dwStdConversion --;
1274 } 1274 }
1275 } 1275 }
1276 CPDF_Color::CPDF_Color(int family) 1276 CPDF_Color::CPDF_Color(int family)
1277 { 1277 {
1278 m_pCS = CPDF_ColorSpace::GetStockCS(family); 1278 m_pCS = CPDF_ColorSpace::GetStockCS(family);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 } 1390 }
1391 } 1391 }
1392 if (m_pCS == NULL) { 1392 if (m_pCS == NULL) {
1393 return; 1393 return;
1394 } 1394 }
1395 m_pBuffer = m_pCS->CreateBuf(); 1395 m_pBuffer = m_pCS->CreateBuf();
1396 FXSYS_memcpy(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize()); 1396 FXSYS_memcpy(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize());
1397 if (m_pCS->GetFamily() == PDFCS_PATTERN) { 1397 if (m_pCS->GetFamily() == PDFCS_PATTERN) {
1398 PatternValue* pvalue = (PatternValue*)m_pBuffer; 1398 PatternValue* pvalue = (PatternValue*)m_pBuffer;
1399 if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) { 1399 if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) {
1400 pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()- >GetPattern(pvalue->m_pPattern->m_pPatternObj, FALSE, &pvalue->m_pPattern->m_Par entMatrix); 1400 pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()- >GetPattern(pvalue->m_pPattern->m_pPatternObj, false, &pvalue->m_pPattern->m_Par entMatrix);
1401 } 1401 }
1402 } 1402 }
1403 } 1403 }
1404 FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const 1404 bool CPDF_Color::GetRGB(int& R, int& G, int& B) const
1405 { 1405 {
1406 if (m_pCS == NULL || m_pBuffer == NULL) { 1406 if (m_pCS == NULL || m_pBuffer == NULL) {
1407 return FALSE; 1407 return false;
1408 } 1408 }
1409 FX_FLOAT r=0.0f, g=0.0f, b=0.0f; 1409 FX_FLOAT r=0.0f, g=0.0f, b=0.0f;
1410 if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) { 1410 if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) {
1411 return FALSE; 1411 return false;
1412 } 1412 }
1413 R = (int32_t)(r * 255 + 0.5f); 1413 R = (int32_t)(r * 255 + 0.5f);
1414 G = (int32_t)(g * 255 + 0.5f); 1414 G = (int32_t)(g * 255 + 0.5f);
1415 B = (int32_t)(b * 255 + 0.5f); 1415 B = (int32_t)(b * 255 + 0.5f);
1416 return TRUE; 1416 return true;
1417 } 1417 }
1418 CPDF_Pattern* CPDF_Color::GetPattern() const 1418 CPDF_Pattern* CPDF_Color::GetPattern() const
1419 { 1419 {
1420 if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) { 1420 if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
1421 return NULL; 1421 return NULL;
1422 } 1422 }
1423 PatternValue* pvalue = (PatternValue*)m_pBuffer; 1423 PatternValue* pvalue = (PatternValue*)m_pBuffer;
1424 return pvalue->m_pPattern; 1424 return pvalue->m_pPattern;
1425 } 1425 }
1426 CPDF_ColorSpace* CPDF_Color::GetPatternCS() const 1426 CPDF_ColorSpace* CPDF_Color::GetPatternCS() const
1427 { 1427 {
1428 if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) { 1428 if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
1429 return NULL; 1429 return NULL;
1430 } 1430 }
1431 return m_pCS->GetBaseCS(); 1431 return m_pCS->GetBaseCS();
1432 } 1432 }
1433 FX_FLOAT* CPDF_Color::GetPatternColor() const 1433 FX_FLOAT* CPDF_Color::GetPatternColor() const
1434 { 1434 {
1435 if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) { 1435 if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
1436 return NULL; 1436 return NULL;
1437 } 1437 }
1438 PatternValue* pvalue = (PatternValue*)m_pBuffer; 1438 PatternValue* pvalue = (PatternValue*)m_pBuffer;
1439 return pvalue->m_nComps ? pvalue->m_Comps : NULL; 1439 return pvalue->m_nComps ? pvalue->m_Comps : NULL;
1440 } 1440 }
1441 FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const 1441 bool CPDF_Color::IsEqual(const CPDF_Color& other) const
1442 { 1442 {
1443 if (m_pCS != other.m_pCS || m_pCS == NULL) { 1443 if (m_pCS != other.m_pCS || m_pCS == NULL) {
1444 return FALSE; 1444 return false;
1445 } 1445 }
1446 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;
1447 } 1447 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698