summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp71
1 files changed, 30 insertions, 41 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index a894e846ee..12f60632fc 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -1013,48 +1013,38 @@ void CPDF_RenderContext::DrawObjectList(CFX_RenderDevice* pDevice, CPDF_PageObje
AppendObjectList(pObjs, pObject2Device);
Render(pDevice, pOptions);
}
-CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer()
+
+CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer(
+ CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ const CPDF_RenderOptions* pOptions) :
+ m_Status(Ready),
+ m_pContext(pContext),
+ m_pDevice(pDevice),
+ m_pOptions(pOptions),
+ m_LayerIndex(0),
+ m_ObjectIndex(0),
+ m_ObjectPos(nullptr),
+ m_PrevLastPos(nullptr)
{
- m_pRenderer = NULL;
- m_pContext = NULL;
- m_pDevice = NULL;
- m_Status = Ready;
}
+
CPDF_ProgressiveRenderer::~CPDF_ProgressiveRenderer()
{
- Clear();
-}
-void CPDF_ProgressiveRenderer::Clear()
-{
- if (m_pRenderer) {
- delete m_pRenderer;
+ if (m_pRenderStatus)
m_pDevice->RestoreState();
- m_pRenderer = NULL;
- }
- m_Status = Ready;
}
-void CPDF_ProgressiveRenderer::Start(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice,
- const CPDF_RenderOptions* pOptions, IFX_Pause* pPause, FX_BOOL bDropObjects)
+
+void CPDF_ProgressiveRenderer::Start(IFX_Pause* pPause)
{
- if (m_Status != Ready) {
- m_Status = Failed;
- return;
- }
- m_pContext = pContext;
- m_pDevice = pDevice;
- m_pOptions = pOptions;
- m_bDropObjects = bDropObjects;
- if (pContext == NULL || pDevice == NULL) {
+ if (!m_pContext || !m_pDevice || m_Status != Ready) {
m_Status = Failed;
return;
}
m_Status = ToBeContinued;
- m_ObjectPos = NULL;
- m_LayerIndex = 0;
- m_ObjectIndex = 0;
- m_PrevLastPos = NULL;
Continue(pPause);
}
+
#define RENDER_STEP_LIMIT 100
void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause)
{
@@ -1076,9 +1066,8 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause)
}
}
if (LastPos == m_PrevLastPos) {
- if (m_pRenderer) {
- delete m_pRenderer;
- m_pRenderer = NULL;
+ if (m_pRenderStatus) {
+ m_pRenderStatus.reset();
m_pDevice->RestoreState();
m_ObjectPos = NULL;
m_PrevLastPos = NULL;
@@ -1093,12 +1082,13 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause)
}
m_PrevLastPos = LastPos;
}
- if (m_pRenderer == NULL) {
+ if (!m_pRenderStatus) {
m_ObjectPos = pItem->m_pObjectList->GetFirstObjectPosition();
m_ObjectIndex = 0;
- m_pRenderer = new CPDF_RenderStatus();
- m_pRenderer->Initialize(m_pContext, m_pDevice, NULL, NULL, NULL, NULL,
- m_pOptions, pItem->m_pObjectList->m_Transparency, m_bDropObjects, NULL);
+ m_pRenderStatus.reset(new CPDF_RenderStatus());
+ m_pRenderStatus->Initialize(
+ m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions,
+ pItem->m_pObjectList->m_Transparency, FALSE, NULL);
m_pDevice->SaveState();
m_ClipRect = m_pDevice->GetClipBox();
CFX_AffineMatrix device2object;
@@ -1110,11 +1100,11 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause)
CPDF_PageObject* pCurObj = pItem->m_pObjectList->GetObjectAt(m_ObjectPos);
if (pCurObj && pCurObj->m_Left <= m_ClipRect.right && pCurObj->m_Right >= m_ClipRect.left &&
pCurObj->m_Bottom <= m_ClipRect.top && pCurObj->m_Top >= m_ClipRect.bottom) {
- if (m_pRenderer->ContinueSingleObject(pCurObj, &pItem->m_Matrix, pPause)) {
+ if (m_pRenderStatus->ContinueSingleObject(pCurObj, &pItem->m_Matrix, pPause)) {
return;
}
- if (pCurObj->m_Type == PDFPAGE_IMAGE && m_pRenderer->m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
- m_pContext->GetPageCache()->CacheOptimization(m_pRenderer->m_Options.m_dwLimitCacheSize);
+ if (pCurObj->m_Type == PDFPAGE_IMAGE && m_pRenderStatus->m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
+ m_pContext->GetPageCache()->CacheOptimization(m_pRenderStatus->m_Options.m_dwLimitCacheSize);
}
if (pCurObj->m_Type == PDFPAGE_FORM || pCurObj->m_Type == PDFPAGE_SHADING) {
objs_to_go = 0;
@@ -1134,8 +1124,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause)
if (!pItem->m_pObjectList->IsParsed()) {
return;
}
- delete m_pRenderer;
- m_pRenderer = NULL;
+ m_pRenderStatus.reset();
m_pDevice->RestoreState();
m_ObjectPos = NULL;
m_PrevLastPos = NULL;