DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags, IFSDK_PAUSE* pause) { if (!bitmap || !pause || pause->version != 1) return FPDF_RENDER_FAILED; CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage) return FPDF_RENDER_FAILED; CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext; pPage->SetRenderContext(WrapUnique(pContext)); CFX_FxgeDevice* pDevice = new CFX_FxgeDevice; pContext->m_pDevice.reset(pDevice); CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap); pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false); IFSDK_PAUSE_Adapter IPauseAdapter(pause); FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, rotate, flags, FALSE, &IPauseAdapter); if (pContext->m_pRenderer) { return CPDF_ProgressiveRenderer::ToFPDFStatus( pContext->m_pRenderer->GetStatus()); } return FPDF_RENDER_FAILED; }
DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage) return; CPDF_PageRenderContext* pContext = pPage->GetRenderContext(); if (!pContext) return; pContext->m_pDevice->RestoreState(false); pPage->SetRenderContext(std::unique_ptr<CPDF_PageRenderContext>()); }