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

Unified Diff: core/fpdfapi/fpdf_render/fpdf_render.cpp

Issue 2294133002: Make CPDF_ColorState have a CFX_ColorStateData rather than inheriting (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, nits. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_render/fpdf_render.cpp
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index c36d7f4cd31de79652d6eb51983edf0d88a482a2..23443b15c56440834ca31a9fb67afaba5385fdf1 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -194,21 +194,17 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
if (pInitialStates && !m_pType3Char) {
m_InitialStates.CopyStates(*pInitialStates);
if (pParentState) {
- const CPDF_ColorStateData* pColorData =
- m_InitialStates.m_ColorState.GetObject();
- const CPDF_ColorStateData* pParentData =
- pParentState->m_InitialStates.m_ColorState.GetObject();
- if (!pColorData || pColorData->m_FillColor.IsNull()) {
- CPDF_ColorStateData* pData =
- m_InitialStates.m_ColorState.GetPrivateCopy();
- pData->m_FillRGB = pParentData->m_FillRGB;
- pData->m_FillColor.Copy(&pParentData->m_FillColor);
+ if (!m_InitialStates.m_ColorState.HasFillColor()) {
+ m_InitialStates.m_ColorState.SetFillRGB(
+ pParentState->m_InitialStates.m_ColorState.GetFillRGB());
+ m_InitialStates.m_ColorState.GetMutableFillColor()->Copy(
+ pParentState->m_InitialStates.m_ColorState.GetFillColor());
}
- if (!pColorData || pColorData->m_StrokeColor.IsNull()) {
- CPDF_ColorStateData* pData =
- m_InitialStates.m_ColorState.GetPrivateCopy();
- pData->m_StrokeRGB = pParentData->m_FillRGB;
- pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor);
+ if (!m_InitialStates.m_ColorState.HasStrokeColor()) {
+ m_InitialStates.m_ColorState.SetStrokeRGB(
+ pParentState->m_InitialStates.m_ColorState.GetFillRGB());
+ m_InitialStates.m_ColorState.GetMutableStrokeColor()->Copy(
+ pParentState->m_InitialStates.m_ColorState.GetStrokeColor());
}
}
} else {
@@ -912,20 +908,19 @@ void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer,
CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(
const CPDF_GraphicStates* pSrcStates,
FX_BOOL bStroke) {
- if (!pSrcStates) {
+ if (!pSrcStates)
return nullptr;
- }
+
CPDF_GraphicStates* pStates = new CPDF_GraphicStates;
pStates->CopyStates(*pSrcStates);
const CPDF_Color* pObjColor = bStroke
? pSrcStates->m_ColorState.GetStrokeColor()
: pSrcStates->m_ColorState.GetFillColor();
if (!pObjColor->IsNull()) {
- CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetPrivateCopy();
- pColorData->m_FillRGB =
- bStroke ? pSrcStates->m_ColorState.GetObject()->m_StrokeRGB
- : pSrcStates->m_ColorState.GetObject()->m_FillRGB;
- pColorData->m_StrokeRGB = pColorData->m_FillRGB;
+ pStates->m_ColorState.SetFillRGB(
+ bStroke ? pSrcStates->m_ColorState.GetStrokeRGB()
+ : pSrcStates->m_ColorState.GetFillRGB());
+ pStates->m_ColorState.SetStrokeRGB(pStates->m_ColorState.GetFillRGB());
}
return pStates;
}
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698