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/cpdf_colorstate.h" | 7 #include "core/fpdfapi/fpdf_page/cpdf_colorstate.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" | 9 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" |
10 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" | 10 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 void CPDF_ColorState::SetColor(CPDF_Color& color, | 27 void CPDF_ColorState::SetColor(CPDF_Color& color, |
28 uint32_t& rgb, | 28 uint32_t& rgb, |
29 CPDF_ColorSpace* pCS, | 29 CPDF_ColorSpace* pCS, |
30 FX_FLOAT* pValue, | 30 FX_FLOAT* pValue, |
31 uint32_t nValues) { | 31 uint32_t nValues) { |
32 if (pCS) { | 32 if (pCS) { |
33 color.SetColorSpace(pCS); | 33 color.SetColorSpace(pCS); |
34 } else if (color.IsNull()) { | 34 } else if (color.IsNull()) { |
35 color.SetColorSpace(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY)); | 35 color.SetColorSpace(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY)); |
36 } | 36 } |
37 if (color.m_pCS->CountComponents() > nValues) { | 37 if (color.GetColorSpace()->CountComponents() > nValues) |
38 return; | 38 return; |
39 } | 39 |
40 color.SetValue(pValue); | 40 color.SetValue(pValue); |
41 int R, G, B; | 41 int R, G, B; |
42 rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1; | 42 rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1; |
43 } | 43 } |
44 | 44 |
45 void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, | 45 void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, |
46 FX_FLOAT* pValue, | 46 FX_FLOAT* pValue, |
47 uint32_t nValues) { | 47 uint32_t nValues) { |
48 CPDF_ColorStateData* pData = GetModify(); | 48 CPDF_ColorStateData* pData = GetModify(); |
49 pData->m_FillColor.SetValue(pPattern, pValue, nValues); | 49 pData->m_FillColor.SetValue(pPattern, pValue, nValues); |
(...skipping 17 matching lines...) Expand all Loading... |
67 FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B); | 67 FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B); |
68 if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) { | 68 if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) { |
69 if (!ret && pTilingPattern->colored()) { | 69 if (!ret && pTilingPattern->colored()) { |
70 pData->m_StrokeRGB = 0x00BFBFBF; | 70 pData->m_StrokeRGB = 0x00BFBFBF; |
71 return; | 71 return; |
72 } | 72 } |
73 } | 73 } |
74 pData->m_StrokeRGB = | 74 pData->m_StrokeRGB = |
75 pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1; | 75 pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1; |
76 } | 76 } |
OLD | NEW |