diff options
Diffstat (limited to 'fpdfsdk/fpdf_progressive.cpp')
-rw-r--r-- | fpdfsdk/fpdf_progressive.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp index d42d954bb9..90e8402bf8 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>()); } |