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

Side by Side 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, 3 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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_render/render_int.h" 7 #include "core/fpdfapi/fpdf_render/render_int.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 m_bStdCS = bStdCS; 187 m_bStdCS = bStdCS;
188 m_T3FillColor = fill_color; 188 m_T3FillColor = fill_color;
189 m_pType3Char = pType3Char; 189 m_pType3Char = pType3Char;
190 m_GroupFamily = GroupFamily; 190 m_GroupFamily = GroupFamily;
191 m_bLoadMask = bLoadMask; 191 m_bLoadMask = bLoadMask;
192 m_pFormResource = pFormResource; 192 m_pFormResource = pFormResource;
193 m_pPageResource = m_pContext->GetPageResources(); 193 m_pPageResource = m_pContext->GetPageResources();
194 if (pInitialStates && !m_pType3Char) { 194 if (pInitialStates && !m_pType3Char) {
195 m_InitialStates.CopyStates(*pInitialStates); 195 m_InitialStates.CopyStates(*pInitialStates);
196 if (pParentState) { 196 if (pParentState) {
197 const CPDF_ColorStateData* pColorData = 197 if (!m_InitialStates.m_ColorState.HasFillColor()) {
198 m_InitialStates.m_ColorState.GetObject(); 198 m_InitialStates.m_ColorState.SetFillRGB(
199 const CPDF_ColorStateData* pParentData = 199 pParentState->m_InitialStates.m_ColorState.GetFillRGB());
200 pParentState->m_InitialStates.m_ColorState.GetObject(); 200 m_InitialStates.m_ColorState.GetMutableFillColor()->Copy(
201 if (!pColorData || pColorData->m_FillColor.IsNull()) { 201 pParentState->m_InitialStates.m_ColorState.GetFillColor());
202 CPDF_ColorStateData* pData =
203 m_InitialStates.m_ColorState.GetPrivateCopy();
204 pData->m_FillRGB = pParentData->m_FillRGB;
205 pData->m_FillColor.Copy(&pParentData->m_FillColor);
206 } 202 }
207 if (!pColorData || pColorData->m_StrokeColor.IsNull()) { 203 if (!m_InitialStates.m_ColorState.HasStrokeColor()) {
208 CPDF_ColorStateData* pData = 204 m_InitialStates.m_ColorState.SetStrokeRGB(
209 m_InitialStates.m_ColorState.GetPrivateCopy(); 205 pParentState->m_InitialStates.m_ColorState.GetFillRGB());
210 pData->m_StrokeRGB = pParentData->m_FillRGB; 206 m_InitialStates.m_ColorState.GetMutableStrokeColor()->Copy(
211 pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor); 207 pParentState->m_InitialStates.m_ColorState.GetStrokeColor());
212 } 208 }
213 } 209 }
214 } else { 210 } else {
215 m_InitialStates.DefaultStates(); 211 m_InitialStates.DefaultStates();
216 } 212 }
217 m_pImageRenderer.reset(); 213 m_pImageRenderer.reset();
218 m_Transparency = transparency; 214 m_Transparency = transparency;
219 return TRUE; 215 return TRUE;
220 } 216 }
221 void CPDF_RenderStatus::RenderObjectList( 217 void CPDF_RenderStatus::RenderObjectList(
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 CFX_FxgeDevice device; 901 CFX_FxgeDevice device;
906 device.Attach(pBuffer, false, nullptr, false); 902 device.Attach(pBuffer, false, nullptr, false);
907 903
908 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); 904 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight());
909 device.FillRect(&rect, 0xffffffff); 905 device.FillRect(&rect, 0xffffffff);
910 Render(&device, pObj, pOptions, pFinalMatrix); 906 Render(&device, pObj, pOptions, pFinalMatrix);
911 } 907 }
912 CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates( 908 CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(
913 const CPDF_GraphicStates* pSrcStates, 909 const CPDF_GraphicStates* pSrcStates,
914 FX_BOOL bStroke) { 910 FX_BOOL bStroke) {
915 if (!pSrcStates) { 911 if (!pSrcStates)
916 return nullptr; 912 return nullptr;
917 } 913
918 CPDF_GraphicStates* pStates = new CPDF_GraphicStates; 914 CPDF_GraphicStates* pStates = new CPDF_GraphicStates;
919 pStates->CopyStates(*pSrcStates); 915 pStates->CopyStates(*pSrcStates);
920 const CPDF_Color* pObjColor = bStroke 916 const CPDF_Color* pObjColor = bStroke
921 ? pSrcStates->m_ColorState.GetStrokeColor() 917 ? pSrcStates->m_ColorState.GetStrokeColor()
922 : pSrcStates->m_ColorState.GetFillColor(); 918 : pSrcStates->m_ColorState.GetFillColor();
923 if (!pObjColor->IsNull()) { 919 if (!pObjColor->IsNull()) {
924 CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetPrivateCopy(); 920 pStates->m_ColorState.SetFillRGB(
925 pColorData->m_FillRGB = 921 bStroke ? pSrcStates->m_ColorState.GetStrokeRGB()
926 bStroke ? pSrcStates->m_ColorState.GetObject()->m_StrokeRGB 922 : pSrcStates->m_ColorState.GetFillRGB());
927 : pSrcStates->m_ColorState.GetObject()->m_FillRGB; 923 pStates->m_ColorState.SetStrokeRGB(pStates->m_ColorState.GetFillRGB());
928 pColorData->m_StrokeRGB = pColorData->m_FillRGB;
929 } 924 }
930 return pStates; 925 return pStates;
931 } 926 }
932 927
933 CPDF_RenderContext::CPDF_RenderContext(CPDF_Page* pPage) 928 CPDF_RenderContext::CPDF_RenderContext(CPDF_Page* pPage)
934 : m_pDocument(pPage->m_pDocument), 929 : m_pDocument(pPage->m_pDocument),
935 m_pPageResources(pPage->m_pPageResources), 930 m_pPageResources(pPage->m_pPageResources),
936 m_pPageCache(pPage->GetRenderCache()) {} 931 m_pPageCache(pPage->GetRenderCache()) {}
937 932
938 CPDF_RenderContext::CPDF_RenderContext(CPDF_Document* pDoc, 933 CPDF_RenderContext::CPDF_RenderContext(CPDF_Document* pDoc,
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, 1292 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left,
1298 m_Rect.top, m_Rect.Width(), m_Rect.Height()); 1293 m_Rect.top, m_Rect.Width(), m_Rect.Height());
1299 } 1294 }
1300 } 1295 }
1301 1296
1302 #if defined _SKIA_SUPPORT_ 1297 #if defined _SKIA_SUPPORT_
1303 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const { 1298 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const {
1304 m_pDevice->DebugVerifyBitmapIsPreMultiplied(); 1299 m_pDevice->DebugVerifyBitmapIsPreMultiplied();
1305 } 1300 }
1306 #endif 1301 #endif
OLDNEW
« 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