summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-04-26 11:46:02 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-26 11:46:02 -0700
commit5cc24654fb345189140acb4711ff981e1c720951 (patch)
tree1e9e11a9136363e2b330ffbbce6fdf9e3827b5b1 /core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
parent76c53794b6202ec37f6dcace5f2ae86870e953b6 (diff)
downloadpdfium-5cc24654fb345189140acb4711ff981e1c720951.tar.xz
Clean up CPDF_Page.
- Merge CPDF_Page::Load() into ctor. - Remove always nullptr param for CPDF_Page::ParseContent(). - Remove unneeded indirection in IPDF_RenderModule. - Delete CPDF_ParseOptions. - Fix up CPDF_Pattern. Review URL: https://codereview.chromium.org/1918113002
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;