summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_page/cpdf_colorstate.cpp')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorstate.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
index 580b58a06a..88e9f561c3 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
@@ -49,10 +49,11 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
pData->m_FillColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
FX_BOOL ret = pData->m_FillColor.GetRGB(R, G, B);
- if (pPattern->m_PatternType == 1 &&
- ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
- pData->m_FillRGB = 0x00BFBFBF;
- return;
+ if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
+ if (!ret && pTilingPattern->colored()) {
+ pData->m_FillRGB = 0x00BFBFBF;
+ return;
+ }
}
pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
}
@@ -64,10 +65,11 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
pData->m_StrokeColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B);
- if (pPattern->m_PatternType == 1 &&
- ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
- pData->m_StrokeRGB = 0x00BFBFBF;
- return;
+ if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
+ if (!ret && pTilingPattern->colored()) {
+ pData->m_StrokeRGB = 0x00BFBFBF;
+ return;
+ }
}
pData->m_StrokeRGB =
pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1;