diff options
author | Cary Clark <caryclark@google.com> | 2016-03-14 16:51:29 -0400 |
---|---|---|
committer | Cary Clark <caryclark@google.com> | 2016-03-14 16:51:29 -0400 |
commit | 399be5bf559f72d4649a60320a3d802f6b21780b (patch) | |
tree | f2d0a20d0575c2ffa7ce103c012eb66b86e16ba7 /fpdfsdk/fpdfformfill.cpp | |
parent | 13ee55a8267963c9b39486a6a22646fbdd770742 (diff) | |
download | pdfium-399be5bf559f72d4649a60320a3d802f6b21780b.tar.xz |
Add bitmaps and skp output to Skia port
This is a first-cut at supporting bitmaps.
Also added a --skp option to pdfium_test to generate
a Skia picture file. The picture file can be loaded
in Skia's SampleApp, debugger, or skiaserver to
examine the generated picture.
(This also includes fixes suggested in the prior Skia CL.
My apologies for fat-fingers abandoning that one.)
R=dsinclair@chromium.org, tsepez@chromium.org, dsinclair
Review URL: https://codereview.chromium.org/1776313002 .
Diffstat (limited to 'fpdfsdk/fpdfformfill.cpp')
-rw-r--r-- | fpdfsdk/fpdfformfill.cpp | 50 |
1 files changed, 40 insertions, 10 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) { |