summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfformfill.cpp50
-rw-r--r--fpdfsdk/fpdfview.cpp22
2 files changed, 61 insertions, 11 deletions
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 31f5732ce5..b33e303db0 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -287,15 +287,16 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) {
return pSDKDoc->KillFocusAnnot(0);
}
-DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
- FPDF_BITMAP bitmap,
- FPDF_PAGE page,
- int start_x,
- int start_y,
- int size_x,
- int size_y,
- int rotate,
- int flags) {
+static void FFLCommon(FPDF_FORMHANDLE hHandle,
+ FPDF_BITMAP bitmap,
+ FPDF_RECORDER recorder,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags) {
if (!hHandle)
return;
@@ -336,7 +337,8 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y);
#ifdef _SKIA_SUPPORT_
- std::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice);
+ std::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice());
+ pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder));
#else
std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
#endif
@@ -374,6 +376,34 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
#endif // PDF_ENABLE_XFA
}
+DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
+ FPDF_BITMAP bitmap,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags) {
+ FFLCommon(hHandle, bitmap, nullptr, page, start_x, start_y, size_x, size_y,
+ rotate, flags);
+}
+
+#ifdef _SKIA_SUPPORT_
+DLLEXPORT void STDCALL FPDF_FFLRecord(FPDF_FORMHANDLE hHandle,
+ FPDF_RECORDER recorder,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags) {
+ FFLCommon(hHandle, nullptr, recorder, page, start_x, start_y, size_x, size_y,
+ rotate, flags);
+}
+#endif
+
#ifdef PDF_ENABLE_XFA
DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget) {
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 48fe0664a2..4630ac1e7e 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -645,7 +645,7 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
CRenderContext* pContext = new CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
#ifdef _SKIA_SUPPORT_
- pContext->m_pDevice = new CFX_SkiaDevice;
+ pContext->m_pDevice = new CFX_SkiaDevice();
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_SkiaDevice*)pContext->m_pDevice)
@@ -669,6 +669,26 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
pPage->RemovePrivateData((void*)1);
}
+#ifdef _SKIA_SUPPORT_
+DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page,
+ int size_x,
+ int size_y) {
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ if (!pPage)
+ return nullptr;
+ std::unique_ptr<CRenderContext> pContext(new CRenderContext);
+ pPage->SetPrivateData((void*)1, pContext.get(), DropContext);
+ CFX_SkiaDevice* skDevice = new CFX_SkiaDevice();
+ FPDF_RECORDER recorder = skDevice->CreateRecorder(size_x, size_y);
+ pContext->m_pDevice = skDevice;
+
+ FPDF_RenderPage_Retail(pContext.get(), page, 0, 0, size_x, size_y, 0, 0, TRUE,
+ NULL);
+ pPage->RemovePrivateData((void*)1);
+ return recorder;
+}
+#endif
+
DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) {
if (!page)
return;