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

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

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years 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_imagerenderer.cpp ('k') | core/fpdfapi/render/cpdf_renderstatus.cpp » ('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_progressiverenderer.h" 7 #include "core/fpdfapi/render/cpdf_progressiverenderer.h"
8 8
9 #include "core/fpdfapi/page/cpdf_pageobject.h" 9 #include "core/fpdfapi/page/cpdf_pageobject.h"
10 #include "core/fpdfapi/page/cpdf_pageobjectholder.h" 10 #include "core/fpdfapi/page/cpdf_pageobjectholder.h"
11 #include "core/fpdfapi/render/cpdf_pagerendercache.h" 11 #include "core/fpdfapi/render/cpdf_pagerendercache.h"
12 #include "core/fpdfapi/render/cpdf_renderoptions.h" 12 #include "core/fpdfapi/render/cpdf_renderoptions.h"
13 #include "core/fpdfapi/render/cpdf_renderstatus.h" 13 #include "core/fpdfapi/render/cpdf_renderstatus.h"
14 #include "core/fxge/cfx_renderdevice.h" 14 #include "core/fxge/cfx_renderdevice.h"
15 #include "third_party/base/ptr_util.h"
15 16
16 CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer( 17 CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer(
17 CPDF_RenderContext* pContext, 18 CPDF_RenderContext* pContext,
18 CFX_RenderDevice* pDevice, 19 CFX_RenderDevice* pDevice,
19 const CPDF_RenderOptions* pOptions) 20 const CPDF_RenderOptions* pOptions)
20 : m_Status(Ready), 21 : m_Status(Ready),
21 m_pContext(pContext), 22 m_pContext(pContext),
22 m_pDevice(pDevice), 23 m_pDevice(pDevice),
23 m_pOptions(pOptions), 24 m_pOptions(pOptions),
24 m_LayerIndex(0), 25 m_LayerIndex(0),
(...skipping 16 matching lines...) Expand all
41 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { 42 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) {
42 while (m_Status == ToBeContinued) { 43 while (m_Status == ToBeContinued) {
43 if (!m_pCurrentLayer) { 44 if (!m_pCurrentLayer) {
44 if (m_LayerIndex >= m_pContext->CountLayers()) { 45 if (m_LayerIndex >= m_pContext->CountLayers()) {
45 m_Status = Done; 46 m_Status = Done;
46 return; 47 return;
47 } 48 }
48 m_pCurrentLayer = m_pContext->GetLayer(m_LayerIndex); 49 m_pCurrentLayer = m_pContext->GetLayer(m_LayerIndex);
49 m_LastObjectRendered = 50 m_LastObjectRendered =
50 m_pCurrentLayer->m_pObjectHolder->GetPageObjectList()->end(); 51 m_pCurrentLayer->m_pObjectHolder->GetPageObjectList()->end();
51 m_pRenderStatus.reset(new CPDF_RenderStatus()); 52 m_pRenderStatus = pdfium::MakeUnique<CPDF_RenderStatus>();
52 m_pRenderStatus->Initialize( 53 m_pRenderStatus->Initialize(
53 m_pContext, m_pDevice, nullptr, nullptr, nullptr, nullptr, m_pOptions, 54 m_pContext, m_pDevice, nullptr, nullptr, nullptr, nullptr, m_pOptions,
54 m_pCurrentLayer->m_pObjectHolder->m_Transparency, false, nullptr); 55 m_pCurrentLayer->m_pObjectHolder->m_Transparency, false, nullptr);
55 m_pDevice->SaveState(); 56 m_pDevice->SaveState();
56 m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); 57 m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox());
57 CFX_Matrix device2object; 58 CFX_Matrix device2object;
58 device2object.SetReverse(m_pCurrentLayer->m_Matrix); 59 device2object.SetReverse(m_pCurrentLayer->m_Matrix);
59 device2object.TransformRect(m_ClipRect); 60 device2object.TransformRect(m_ClipRect);
60 } 61 }
61 CPDF_PageObjectList::iterator iter; 62 CPDF_PageObjectList::iterator iter;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (pPause && pPause->NeedToPauseNow()) { 105 if (pPause && pPause->NeedToPauseNow()) {
105 return; 106 return;
106 } 107 }
107 } else { 108 } else {
108 m_pCurrentLayer->m_pObjectHolder->ContinueParse(pPause); 109 m_pCurrentLayer->m_pObjectHolder->ContinueParse(pPause);
109 if (!m_pCurrentLayer->m_pObjectHolder->IsParsed()) 110 if (!m_pCurrentLayer->m_pObjectHolder->IsParsed())
110 return; 111 return;
111 } 112 }
112 } 113 }
113 } 114 }
OLDNEW
« no previous file with comments | « core/fpdfapi/render/cpdf_imagerenderer.cpp ('k') | core/fpdfapi/render/cpdf_renderstatus.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698