| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/include/cpdf_colorspace.h" | 7 #include "core/fpdfapi/fpdf_page/include/cpdf_colorspace.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 FX_FLOAT& value, | 214 FX_FLOAT& value, |
| 215 FX_FLOAT& min, | 215 FX_FLOAT& min, |
| 216 FX_FLOAT& max) const override; | 216 FX_FLOAT& max) const override; |
| 217 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; | 217 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; |
| 218 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 218 FX_BOOL GetRGB(FX_FLOAT* pBuf, |
| 219 FX_FLOAT& R, | 219 FX_FLOAT& R, |
| 220 FX_FLOAT& G, | 220 FX_FLOAT& G, |
| 221 FX_FLOAT& B) const override; | 221 FX_FLOAT& B) const override; |
| 222 void EnableStdConversion(FX_BOOL bEnabled) override; | 222 void EnableStdConversion(FX_BOOL bEnabled) override; |
| 223 | 223 |
| 224 CPDF_ColorSpace* m_pAltCS; | 224 std::unique_ptr<CPDF_ColorSpace> m_pAltCS; |
| 225 std::unique_ptr<CPDF_Function> m_pFunc; | 225 std::unique_ptr<CPDF_Function> m_pFunc; |
| 226 enum { None, All, Colorant } m_Type; | 226 enum { None, All, Colorant } m_Type; |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 class CPDF_DeviceNCS : public CPDF_ColorSpace { | 229 class CPDF_DeviceNCS : public CPDF_ColorSpace { |
| 230 public: | 230 public: |
| 231 explicit CPDF_DeviceNCS(CPDF_Document* pDoc); | 231 explicit CPDF_DeviceNCS(CPDF_Document* pDoc); |
| 232 ~CPDF_DeviceNCS() override; | 232 ~CPDF_DeviceNCS() override; |
| 233 | 233 |
| 234 // CPDF_ColorSpace: | 234 // CPDF_ColorSpace: |
| 235 void GetDefaultValue(int iComponent, | 235 void GetDefaultValue(int iComponent, |
| 236 FX_FLOAT& value, | 236 FX_FLOAT& value, |
| 237 FX_FLOAT& min, | 237 FX_FLOAT& min, |
| 238 FX_FLOAT& max) const override; | 238 FX_FLOAT& max) const override; |
| 239 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; | 239 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; |
| 240 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 240 FX_BOOL GetRGB(FX_FLOAT* pBuf, |
| 241 FX_FLOAT& R, | 241 FX_FLOAT& R, |
| 242 FX_FLOAT& G, | 242 FX_FLOAT& G, |
| 243 FX_FLOAT& B) const override; | 243 FX_FLOAT& B) const override; |
| 244 void EnableStdConversion(FX_BOOL bEnabled) override; | 244 void EnableStdConversion(FX_BOOL bEnabled) override; |
| 245 | 245 |
| 246 CPDF_ColorSpace* m_pAltCS; | 246 std::unique_ptr<CPDF_ColorSpace> m_pAltCS; |
| 247 std::unique_ptr<CPDF_Function> m_pFunc; | 247 std::unique_ptr<CPDF_Function> m_pFunc; |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 FX_FLOAT RGB_Conversion(FX_FLOAT colorComponent) { | 250 FX_FLOAT RGB_Conversion(FX_FLOAT colorComponent) { |
| 251 if (colorComponent > 1) | 251 if (colorComponent > 1) |
| 252 colorComponent = 1; | 252 colorComponent = 1; |
| 253 if (colorComponent < 0) | 253 if (colorComponent < 0) |
| 254 colorComponent = 0; | 254 colorComponent = 0; |
| 255 | 255 |
| 256 int scale = (int)(colorComponent * 1023); | 256 int scale = (int)(colorComponent * 1023); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 R = RGB_Conversion(RGB.a); | 307 R = RGB_Conversion(RGB.a); |
| 308 G = RGB_Conversion(RGB.b); | 308 G = RGB_Conversion(RGB.b); |
| 309 B = RGB_Conversion(RGB.c); | 309 B = RGB_Conversion(RGB.c); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace | 312 } // namespace |
| 313 | 313 |
| 314 CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName( | 314 CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName( |
| 315 const CFX_ByteString& name) { | 315 const CFX_ByteString& name) { |
| 316 if (name == "DeviceRGB" || name == "RGB") { | 316 if (name == "DeviceRGB" || name == "RGB") |
| 317 return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB); | 317 return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB); |
| 318 } | 318 if (name == "DeviceGray" || name == "G") |
| 319 if (name == "DeviceGray" || name == "G") { | |
| 320 return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY); | 319 return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY); |
| 321 } | 320 if (name == "DeviceCMYK" || name == "CMYK") |
| 322 if (name == "DeviceCMYK" || name == "CMYK") { | |
| 323 return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK); | 321 return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK); |
| 324 } | 322 if (name == "Pattern") |
| 325 if (name == "Pattern") { | |
| 326 return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN); | 323 return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN); |
| 327 } | |
| 328 return nullptr; | 324 return nullptr; |
| 329 } | 325 } |
| 330 | 326 |
| 331 CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family) { | 327 CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family) { |
| 332 return CPDF_ModuleMgr::Get()->GetPageModule()->GetStockCS(family); | 328 return CPDF_ModuleMgr::Get()->GetPageModule()->GetStockCS(family); |
| 333 } | 329 } |
| 334 | 330 |
| 335 CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) { | 331 std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(CPDF_Document* pDoc, |
| 332 CPDF_Object* pObj) { |
| 336 if (!pObj) | 333 if (!pObj) |
| 337 return nullptr; | 334 return std::unique_ptr<CPDF_ColorSpace>(); |
| 338 if (pObj->IsName()) | |
| 339 return ColorspaceFromName(pObj->GetString()); | |
| 340 | 335 |
| 336 if (pObj->IsName()) { |
| 337 return std::unique_ptr<CPDF_ColorSpace>( |
| 338 ColorspaceFromName(pObj->GetString())); |
| 339 } |
| 341 if (CPDF_Stream* pStream = pObj->AsStream()) { | 340 if (CPDF_Stream* pStream = pObj->AsStream()) { |
| 342 CPDF_Dictionary* pDict = pStream->GetDict(); | 341 CPDF_Dictionary* pDict = pStream->GetDict(); |
| 343 if (!pDict) | 342 if (!pDict) |
| 344 return nullptr; | 343 return std::unique_ptr<CPDF_ColorSpace>(); |
| 345 | 344 |
| 346 for (const auto& it : *pDict) { | 345 for (const auto& it : *pDict) { |
| 347 CPDF_ColorSpace* pRet = nullptr; | 346 std::unique_ptr<CPDF_ColorSpace> pRet; |
| 348 CPDF_Object* pValue = it.second; | 347 CPDF_Object* pValue = it.second; |
| 349 if (ToName(pValue)) | 348 if (ToName(pValue)) |
| 350 pRet = ColorspaceFromName(pValue->GetString()); | 349 pRet.reset(ColorspaceFromName(pValue->GetString())); |
| 351 if (pRet) | 350 if (pRet) |
| 352 return pRet; | 351 return pRet; |
| 353 } | 352 } |
| 354 return nullptr; | 353 return std::unique_ptr<CPDF_ColorSpace>(); |
| 355 } | 354 } |
| 356 | 355 |
| 357 CPDF_Array* pArray = pObj->AsArray(); | 356 CPDF_Array* pArray = pObj->AsArray(); |
| 358 if (!pArray || pArray->IsEmpty()) | 357 if (!pArray || pArray->IsEmpty()) |
| 359 return nullptr; | 358 return std::unique_ptr<CPDF_ColorSpace>(); |
| 360 | 359 |
| 361 CPDF_Object* pFamilyObj = pArray->GetDirectObjectAt(0); | 360 CPDF_Object* pFamilyObj = pArray->GetDirectObjectAt(0); |
| 362 if (!pFamilyObj) | 361 if (!pFamilyObj) |
| 363 return nullptr; | 362 return std::unique_ptr<CPDF_ColorSpace>(); |
| 364 | 363 |
| 365 CFX_ByteString familyname = pFamilyObj->GetString(); | 364 CFX_ByteString familyname = pFamilyObj->GetString(); |
| 366 if (pArray->GetCount() == 1) | 365 if (pArray->GetCount() == 1) |
| 367 return ColorspaceFromName(familyname); | 366 return std::unique_ptr<CPDF_ColorSpace>(ColorspaceFromName(familyname)); |
| 368 | 367 |
| 369 CPDF_ColorSpace* pCS = nullptr; | 368 std::unique_ptr<CPDF_ColorSpace> pCS; |
| 370 uint32_t id = familyname.GetID(); | 369 uint32_t id = familyname.GetID(); |
| 371 if (id == FXBSTR_ID('C', 'a', 'l', 'G')) { | 370 if (id == FXBSTR_ID('C', 'a', 'l', 'G')) { |
| 372 pCS = new CPDF_CalGray(pDoc); | 371 pCS.reset(new CPDF_CalGray(pDoc)); |
| 373 } else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) { | 372 } else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) { |
| 374 pCS = new CPDF_CalRGB(pDoc); | 373 pCS.reset(new CPDF_CalRGB(pDoc)); |
| 375 } else if (id == FXBSTR_ID('L', 'a', 'b', 0)) { | 374 } else if (id == FXBSTR_ID('L', 'a', 'b', 0)) { |
| 376 pCS = new CPDF_LabCS(pDoc); | 375 pCS.reset(new CPDF_LabCS(pDoc)); |
| 377 } else if (id == FXBSTR_ID('I', 'C', 'C', 'B')) { | 376 } else if (id == FXBSTR_ID('I', 'C', 'C', 'B')) { |
| 378 pCS = new CPDF_ICCBasedCS(pDoc); | 377 pCS.reset(new CPDF_ICCBasedCS(pDoc)); |
| 379 } else if (id == FXBSTR_ID('I', 'n', 'd', 'e') || | 378 } else if (id == FXBSTR_ID('I', 'n', 'd', 'e') || |
| 380 id == FXBSTR_ID('I', 0, 0, 0)) { | 379 id == FXBSTR_ID('I', 0, 0, 0)) { |
| 381 pCS = new CPDF_IndexedCS(pDoc); | 380 pCS.reset(new CPDF_IndexedCS(pDoc)); |
| 382 } else if (id == FXBSTR_ID('S', 'e', 'p', 'a')) { | 381 } else if (id == FXBSTR_ID('S', 'e', 'p', 'a')) { |
| 383 pCS = new CPDF_SeparationCS(pDoc); | 382 pCS.reset(new CPDF_SeparationCS(pDoc)); |
| 384 } else if (id == FXBSTR_ID('D', 'e', 'v', 'i')) { | 383 } else if (id == FXBSTR_ID('D', 'e', 'v', 'i')) { |
| 385 pCS = new CPDF_DeviceNCS(pDoc); | 384 pCS.reset(new CPDF_DeviceNCS(pDoc)); |
| 386 } else if (id == FXBSTR_ID('P', 'a', 't', 't')) { | 385 } else if (id == FXBSTR_ID('P', 'a', 't', 't')) { |
| 387 pCS = new CPDF_PatternCS(pDoc); | 386 pCS.reset(new CPDF_PatternCS(pDoc)); |
| 388 } else { | 387 } else { |
| 389 return nullptr; | 388 return std::unique_ptr<CPDF_ColorSpace>(); |
| 390 } | 389 } |
| 391 pCS->m_pArray = pArray; | 390 pCS->m_pArray = pArray; |
| 392 if (!pCS->v_Load(pDoc, pArray)) { | 391 if (!pCS->v_Load(pDoc, pArray)) |
| 393 pCS->ReleaseCS(); | 392 return std::unique_ptr<CPDF_ColorSpace>(); |
| 394 return nullptr; | 393 |
| 395 } | |
| 396 return pCS; | 394 return pCS; |
| 397 } | 395 } |
| 398 | 396 |
| 399 void CPDF_ColorSpace::ReleaseCS() { | 397 void CPDF_ColorSpace::Release() { |
| 400 if (this == GetStockCS(PDFCS_DEVICERGB)) { | 398 if (this == GetStockCS(PDFCS_DEVICERGB) || |
| 401 return; | 399 this == GetStockCS(PDFCS_DEVICEGRAY) || |
| 402 } | 400 this == GetStockCS(PDFCS_DEVICECMYK) || |
| 403 if (this == GetStockCS(PDFCS_DEVICEGRAY)) { | 401 this == GetStockCS(PDFCS_PATTERN)) { |
| 404 return; | |
| 405 } | |
| 406 if (this == GetStockCS(PDFCS_DEVICECMYK)) { | |
| 407 return; | |
| 408 } | |
| 409 if (this == GetStockCS(PDFCS_PATTERN)) { | |
| 410 return; | 402 return; |
| 411 } | 403 } |
| 412 delete this; | 404 delete this; |
| 413 } | 405 } |
| 414 | 406 |
| 415 int CPDF_ColorSpace::GetBufSize() const { | 407 int CPDF_ColorSpace::GetBufSize() const { |
| 416 if (m_Family == PDFCS_PATTERN) { | 408 if (m_Family == PDFCS_PATTERN) { |
| 417 return sizeof(PatternValue); | 409 return sizeof(PatternValue); |
| 418 } | 410 } |
| 419 return m_nComponents * sizeof(FX_FLOAT); | 411 return m_nComponents * sizeof(FX_FLOAT); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 m_pAlterCS(nullptr), | 817 m_pAlterCS(nullptr), |
| 826 m_pProfile(nullptr), | 818 m_pProfile(nullptr), |
| 827 m_pCache(nullptr), | 819 m_pCache(nullptr), |
| 828 m_pRanges(nullptr), | 820 m_pRanges(nullptr), |
| 829 m_bOwn(FALSE) {} | 821 m_bOwn(FALSE) {} |
| 830 | 822 |
| 831 CPDF_ICCBasedCS::~CPDF_ICCBasedCS() { | 823 CPDF_ICCBasedCS::~CPDF_ICCBasedCS() { |
| 832 FX_Free(m_pCache); | 824 FX_Free(m_pCache); |
| 833 FX_Free(m_pRanges); | 825 FX_Free(m_pRanges); |
| 834 if (m_pAlterCS && m_bOwn) | 826 if (m_pAlterCS && m_bOwn) |
| 835 m_pAlterCS->ReleaseCS(); | 827 m_pAlterCS->Release(); |
| 836 if (m_pProfile && m_pDocument) | 828 if (m_pProfile && m_pDocument) |
| 837 m_pDocument->GetPageData()->ReleaseIccProfile(m_pProfile); | 829 m_pDocument->GetPageData()->ReleaseIccProfile(m_pProfile); |
| 838 } | 830 } |
| 839 | 831 |
| 840 FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { | 832 FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { |
| 841 CPDF_Stream* pStream = pArray->GetStreamAt(1); | 833 CPDF_Stream* pStream = pArray->GetStreamAt(1); |
| 842 if (!pStream) | 834 if (!pStream) |
| 843 return FALSE; | 835 return FALSE; |
| 844 | 836 |
| 845 m_pProfile = pDoc->LoadIccProfile(pStream); | 837 m_pProfile = pDoc->LoadIccProfile(pStream); |
| 846 if (!m_pProfile) | 838 if (!m_pProfile) |
| 847 return FALSE; | 839 return FALSE; |
| 848 | 840 |
| 849 m_nComponents = | 841 m_nComponents = |
| 850 m_pProfile | 842 m_pProfile |
| 851 ->GetComponents(); // Try using the nComponents from ICC profile | 843 ->GetComponents(); // Try using the nComponents from ICC profile |
| 852 CPDF_Dictionary* pDict = pStream->GetDict(); | 844 CPDF_Dictionary* pDict = pStream->GetDict(); |
| 853 if (!m_pProfile->m_pTransform) { // No valid ICC profile or using sRGB | 845 if (!m_pProfile->m_pTransform) { // No valid ICC profile or using sRGB |
| 854 CPDF_Object* pAlterCSObj = | 846 CPDF_Object* pAlterCSObj = |
| 855 pDict ? pDict->GetDirectObjectFor("Alternate") : nullptr; | 847 pDict ? pDict->GetDirectObjectFor("Alternate") : nullptr; |
| 856 if (pAlterCSObj) { | 848 if (pAlterCSObj) { |
| 857 CPDF_ColorSpace* pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj); | 849 std::unique_ptr<CPDF_ColorSpace> pAlterCS = |
| 850 CPDF_ColorSpace::Load(pDoc, pAlterCSObj); |
| 858 if (pAlterCS) { | 851 if (pAlterCS) { |
| 859 if (m_nComponents == 0) { // NO valid ICC profile | 852 if (m_nComponents == 0) { // NO valid ICC profile |
| 860 if (pAlterCS->CountComponents() > 0) { // Use Alternative colorspace | 853 if (pAlterCS->CountComponents() > 0) { // Use Alternative colorspace |
| 861 m_nComponents = pAlterCS->CountComponents(); | 854 m_nComponents = pAlterCS->CountComponents(); |
| 862 m_pAlterCS = pAlterCS; | 855 m_pAlterCS = pAlterCS.release(); |
| 863 m_bOwn = TRUE; | 856 m_bOwn = TRUE; |
| 864 } else { // No valid alternative colorspace | 857 } else { // No valid alternative colorspace |
| 865 pAlterCS->ReleaseCS(); | |
| 866 int32_t nDictComponents = pDict ? pDict->GetIntegerFor("N") : 0; | 858 int32_t nDictComponents = pDict ? pDict->GetIntegerFor("N") : 0; |
| 867 if (nDictComponents != 1 && nDictComponents != 3 && | 859 if (nDictComponents != 1 && nDictComponents != 3 && |
| 868 nDictComponents != 4) { | 860 nDictComponents != 4) { |
| 869 return FALSE; | 861 return FALSE; |
| 870 } | 862 } |
| 871 m_nComponents = nDictComponents; | 863 m_nComponents = nDictComponents; |
| 872 } | 864 } |
| 873 | |
| 874 } else { // Using sRGB | 865 } else { // Using sRGB |
| 875 if (pAlterCS->CountComponents() != m_nComponents) { | 866 if (pAlterCS->CountComponents() == m_nComponents) { |
| 876 pAlterCS->ReleaseCS(); | 867 m_pAlterCS = pAlterCS.release(); |
| 877 } else { | |
| 878 m_pAlterCS = pAlterCS; | |
| 879 m_bOwn = TRUE; | 868 m_bOwn = TRUE; |
| 880 } | 869 } |
| 881 } | 870 } |
| 882 } | 871 } |
| 883 } | 872 } |
| 884 if (!m_pAlterCS) { | 873 if (!m_pAlterCS) { |
| 885 if (m_nComponents == 1) | 874 if (m_nComponents == 1) |
| 886 m_pAlterCS = GetStockCS(PDFCS_DEVICEGRAY); | 875 m_pAlterCS = GetStockCS(PDFCS_DEVICEGRAY); |
| 887 else if (m_nComponents == 3) | 876 else if (m_nComponents == 3) |
| 888 m_pAlterCS = GetStockCS(PDFCS_DEVICERGB); | 877 m_pAlterCS = GetStockCS(PDFCS_DEVICERGB); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 } | 1137 } |
| 1149 R = G = B = 0.75f; | 1138 R = G = B = 0.75f; |
| 1150 return FALSE; | 1139 return FALSE; |
| 1151 } | 1140 } |
| 1152 | 1141 |
| 1153 CPDF_ColorSpace* CPDF_PatternCS::GetBaseCS() const { | 1142 CPDF_ColorSpace* CPDF_PatternCS::GetBaseCS() const { |
| 1154 return m_pBaseCS; | 1143 return m_pBaseCS; |
| 1155 } | 1144 } |
| 1156 | 1145 |
| 1157 CPDF_SeparationCS::CPDF_SeparationCS(CPDF_Document* pDoc) | 1146 CPDF_SeparationCS::CPDF_SeparationCS(CPDF_Document* pDoc) |
| 1158 : CPDF_ColorSpace(pDoc, PDFCS_SEPARATION, 1), m_pAltCS(nullptr) {} | 1147 : CPDF_ColorSpace(pDoc, PDFCS_SEPARATION, 1) {} |
| 1159 | 1148 |
| 1160 CPDF_SeparationCS::~CPDF_SeparationCS() { | 1149 CPDF_SeparationCS::~CPDF_SeparationCS() {} |
| 1161 if (m_pAltCS) | |
| 1162 m_pAltCS->ReleaseCS(); | |
| 1163 } | |
| 1164 | 1150 |
| 1165 void CPDF_SeparationCS::GetDefaultValue(int iComponent, | 1151 void CPDF_SeparationCS::GetDefaultValue(int iComponent, |
| 1166 FX_FLOAT& value, | 1152 FX_FLOAT& value, |
| 1167 FX_FLOAT& min, | 1153 FX_FLOAT& min, |
| 1168 FX_FLOAT& max) const { | 1154 FX_FLOAT& max) const { |
| 1169 value = 1.0f; | 1155 value = 1.0f; |
| 1170 min = 0; | 1156 min = 0; |
| 1171 max = 1.0f; | 1157 max = 1.0f; |
| 1172 } | 1158 } |
| 1173 | 1159 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 return FALSE; | 1215 return FALSE; |
| 1230 } | 1216 } |
| 1231 | 1217 |
| 1232 void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled) { | 1218 void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled) { |
| 1233 CPDF_ColorSpace::EnableStdConversion(bEnabled); | 1219 CPDF_ColorSpace::EnableStdConversion(bEnabled); |
| 1234 if (m_pAltCS) | 1220 if (m_pAltCS) |
| 1235 m_pAltCS->EnableStdConversion(bEnabled); | 1221 m_pAltCS->EnableStdConversion(bEnabled); |
| 1236 } | 1222 } |
| 1237 | 1223 |
| 1238 CPDF_DeviceNCS::CPDF_DeviceNCS(CPDF_Document* pDoc) | 1224 CPDF_DeviceNCS::CPDF_DeviceNCS(CPDF_Document* pDoc) |
| 1239 : CPDF_ColorSpace(pDoc, PDFCS_DEVICEN, 0), m_pAltCS(nullptr) {} | 1225 : CPDF_ColorSpace(pDoc, PDFCS_DEVICEN, 0) {} |
| 1240 | 1226 |
| 1241 CPDF_DeviceNCS::~CPDF_DeviceNCS() { | 1227 CPDF_DeviceNCS::~CPDF_DeviceNCS() {} |
| 1242 if (m_pAltCS) | |
| 1243 m_pAltCS->ReleaseCS(); | |
| 1244 } | |
| 1245 | 1228 |
| 1246 void CPDF_DeviceNCS::GetDefaultValue(int iComponent, | 1229 void CPDF_DeviceNCS::GetDefaultValue(int iComponent, |
| 1247 FX_FLOAT& value, | 1230 FX_FLOAT& value, |
| 1248 FX_FLOAT& min, | 1231 FX_FLOAT& min, |
| 1249 FX_FLOAT& max) const { | 1232 FX_FLOAT& max) const { |
| 1250 value = 1.0f; | 1233 value = 1.0f; |
| 1251 min = 0; | 1234 min = 0; |
| 1252 max = 1.0f; | 1235 max = 1.0f; |
| 1253 } | 1236 } |
| 1254 | 1237 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1285 | 1268 |
| 1286 return m_pAltCS->GetRGB(results, R, G, B); | 1269 return m_pAltCS->GetRGB(results, R, G, B); |
| 1287 } | 1270 } |
| 1288 | 1271 |
| 1289 void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled) { | 1272 void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled) { |
| 1290 CPDF_ColorSpace::EnableStdConversion(bEnabled); | 1273 CPDF_ColorSpace::EnableStdConversion(bEnabled); |
| 1291 if (m_pAltCS) { | 1274 if (m_pAltCS) { |
| 1292 m_pAltCS->EnableStdConversion(bEnabled); | 1275 m_pAltCS->EnableStdConversion(bEnabled); |
| 1293 } | 1276 } |
| 1294 } | 1277 } |
| OLD | NEW |