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

Side by Side Diff: core/fpdfapi/render/cpdf_rendercontext.cpp

Issue 2611413002: Remove CFX_ArrayTemplate from fpdfapi (Closed)
Patch Set: comment Created 3 years, 11 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/render/cpdf_rendercontext.h ('k') | core/fpdfapi/render/cpdf_renderstatus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/render/cpdf_rendercontext.h" 7 #include "core/fpdfapi/render/cpdf_rendercontext.h"
8 8
9 #include "core/fpdfapi/page/cpdf_page.h" 9 #include "core/fpdfapi/page/cpdf_page.h"
10 #include "core/fpdfapi/page/cpdf_pageobject.h" 10 #include "core/fpdfapi/page/cpdf_pageobject.h"
(...skipping 26 matching lines...) Expand all
37 CFX_FxgeDevice device; 37 CFX_FxgeDevice device;
38 device.Attach(pBuffer, false, nullptr, false); 38 device.Attach(pBuffer, false, nullptr, false);
39 39
40 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); 40 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight());
41 device.FillRect(&rect, 0xffffffff); 41 device.FillRect(&rect, 0xffffffff);
42 Render(&device, pObj, pOptions, pFinalMatrix); 42 Render(&device, pObj, pOptions, pFinalMatrix);
43 } 43 }
44 44
45 void CPDF_RenderContext::AppendLayer(CPDF_PageObjectHolder* pObjectHolder, 45 void CPDF_RenderContext::AppendLayer(CPDF_PageObjectHolder* pObjectHolder,
46 const CFX_Matrix* pObject2Device) { 46 const CFX_Matrix* pObject2Device) {
47 Layer* pLayer = m_Layers.AddSpace(); 47 m_Layers.emplace_back();
48 pLayer->m_pObjectHolder = pObjectHolder; 48 m_Layers.back().m_pObjectHolder = pObjectHolder;
49 if (pObject2Device) 49 if (pObject2Device)
50 pLayer->m_Matrix = *pObject2Device; 50 m_Layers.back().m_Matrix = *pObject2Device;
51 else 51 else
52 pLayer->m_Matrix.SetIdentity(); 52 m_Layers.back().m_Matrix.SetIdentity();
53 } 53 }
54 54
55 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, 55 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
56 const CPDF_RenderOptions* pOptions, 56 const CPDF_RenderOptions* pOptions,
57 const CFX_Matrix* pLastMatrix) { 57 const CFX_Matrix* pLastMatrix) {
58 Render(pDevice, nullptr, pOptions, pLastMatrix); 58 Render(pDevice, nullptr, pOptions, pLastMatrix);
59 } 59 }
60 60
61 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, 61 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
62 const CPDF_PageObject* pStopObj, 62 const CPDF_PageObject* pStopObj,
63 const CPDF_RenderOptions* pOptions, 63 const CPDF_RenderOptions* pOptions,
64 const CFX_Matrix* pLastMatrix) { 64 const CFX_Matrix* pLastMatrix) {
65 int count = m_Layers.GetSize(); 65 for (auto& layer : m_Layers) {
66 for (int j = 0; j < count; j++) {
67 pDevice->SaveState(); 66 pDevice->SaveState();
68 Layer* pLayer = m_Layers.GetDataPtr(j);
69 if (pLastMatrix) { 67 if (pLastMatrix) {
70 CFX_Matrix FinalMatrix = pLayer->m_Matrix; 68 CFX_Matrix FinalMatrix = layer.m_Matrix;
71 FinalMatrix.Concat(*pLastMatrix); 69 FinalMatrix.Concat(*pLastMatrix);
72 CPDF_RenderStatus status; 70 CPDF_RenderStatus status;
73 status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr, 71 status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr,
74 pOptions, pLayer->m_pObjectHolder->m_Transparency, 72 pOptions, layer.m_pObjectHolder->m_Transparency, false,
75 false, nullptr); 73 nullptr);
76 status.RenderObjectList(pLayer->m_pObjectHolder, &FinalMatrix); 74 status.RenderObjectList(layer.m_pObjectHolder, &FinalMatrix);
77 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) 75 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE)
78 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); 76 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
79 if (status.m_bStopped) { 77 if (status.m_bStopped) {
80 pDevice->RestoreState(false); 78 pDevice->RestoreState(false);
81 break; 79 break;
82 } 80 }
83 } else { 81 } else {
84 CPDF_RenderStatus status; 82 CPDF_RenderStatus status;
85 status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr, 83 status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr,
86 pOptions, pLayer->m_pObjectHolder->m_Transparency, 84 pOptions, layer.m_pObjectHolder->m_Transparency, false,
87 false, nullptr); 85 nullptr);
88 status.RenderObjectList(pLayer->m_pObjectHolder, &pLayer->m_Matrix); 86 status.RenderObjectList(layer.m_pObjectHolder, &layer.m_Matrix);
89 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) 87 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE)
90 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); 88 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
91 if (status.m_bStopped) { 89 if (status.m_bStopped) {
92 pDevice->RestoreState(false); 90 pDevice->RestoreState(false);
93 break; 91 break;
94 } 92 }
95 } 93 }
96 pDevice->RestoreState(false); 94 pDevice->RestoreState(false);
97 } 95 }
98 } 96 }
OLDNEW
« no previous file with comments | « core/fpdfapi/render/cpdf_rendercontext.h ('k') | core/fpdfapi/render/cpdf_renderstatus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698