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

Unified Diff: fpdfsdk/fpdf_progressive.cpp

Issue 2008553008: Remove CFX_PrivateData from CPDF_Page (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix non-XFA build. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/include/fpdf_doc.h ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>());
}
« no previous file with comments | « core/fpdfdoc/include/fpdf_doc.h ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698