Index: fpdfsdk/fpdf_progressive.cpp |
diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp |
index d42d954bb9f0c2c6979a4620b7aeccefea113f44..90e8402bf89f08a737f4ad4bdcf593d5ead11a1c 100644 |
--- a/fpdfsdk/fpdf_progressive.cpp |
+++ b/fpdfsdk/fpdf_progressive.cpp |
@@ -40,15 +40,16 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, |
return FPDF_RENDER_FAILED; |
CRenderContext* pContext = new CRenderContext; |
- pPage->SetPrivateData((void*)1, pContext, DropContext); |
+ pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>(pContext)); |
pContext->m_pDevice = new CFX_FxgeDevice; |
- if (flags & FPDF_REVERSE_BYTE_ORDER) |
+ if (flags & FPDF_REVERSE_BYTE_ORDER) { |
((CFX_FxgeDevice*)pContext->m_pDevice) |
->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); |
- else |
+ } else { |
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); |
- IFSDK_PAUSE_Adapter IPauseAdapter(pause); |
+ } |
+ IFSDK_PAUSE_Adapter IPauseAdapter(pause); |
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, |
rotate, flags, FALSE, &IPauseAdapter); |
@@ -68,7 +69,8 @@ DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, |
if (!pPage) |
return FPDF_RENDER_FAILED; |
- CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); |
+ CRenderContext* pContext = |
+ static_cast<CRenderContext*>(pPage->GetRenderContext()); |
if (pContext && pContext->m_pRenderer) { |
IFSDK_PAUSE_Adapter IPauseAdapter(pause); |
pContext->m_pRenderer->Continue(&IPauseAdapter); |
@@ -83,11 +85,11 @@ DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) { |
if (!pPage) |
return; |
- CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); |
+ CRenderContext* pContext = |
+ static_cast<CRenderContext*>(pPage->GetRenderContext()); |
if (!pContext) |
return; |
pContext->m_pDevice->RestoreState(); |
- delete pContext; |
- pPage->RemovePrivateData((void*)1); |
+ pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>()); |
} |