From baa7ff4390b8b36c2d58c1b1f8d9775c76da656a Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Thu, 29 Jun 2017 19:18:23 -0400 Subject: Basic APIs and tests for extracting and setting annotation paths 1. Added APIs for retrieving existing annotation paths and setting annotation paths. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: Ic451bcd3be488261baf2182549c4238b887b219e Reviewed-on: https://pdfium-review.googlesource.com/6676 Commit-Queue: Jane Liu Reviewed-by: Lei Zhang Reviewed-by: dsinclair --- testing/embedder_test.cpp | 8 +++++--- testing/embedder_test.h | 4 +++- testing/resources/annotation_stamp_with_ap.pdf | Bin 0 -> 101719 bytes 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 testing/resources/annotation_stamp_with_ap.pdf (limited to 'testing') diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp index 7e34260e60..55e93a3d32 100644 --- a/testing/embedder_test.cpp +++ b/testing/embedder_test.cpp @@ -255,10 +255,12 @@ FPDF_PAGE EmbedderTest::LoadPage(int page_number) { } FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) { - return RenderPageWithFlags(page, 0); + return RenderPageWithFlags(page, form_handle_, 0); } -FPDF_BITMAP EmbedderTest::RenderPageWithFlags(FPDF_PAGE page, int flags) { +FPDF_BITMAP EmbedderTest::RenderPageWithFlags(FPDF_PAGE page, + FPDF_FORMHANDLE handle, + int flags) { int width = static_cast(FPDF_GetPageWidth(page)); int height = static_cast(FPDF_GetPageHeight(page)); int alpha = FPDFPage_HasTransparency(page) ? 1 : 0; @@ -266,7 +268,7 @@ FPDF_BITMAP EmbedderTest::RenderPageWithFlags(FPDF_PAGE page, int flags) { FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF; FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color); FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, flags); - FPDF_FFLDraw(form_handle_, bitmap, page, 0, 0, width, height, 0, flags); + FPDF_FFLDraw(handle, bitmap, page, 0, 0, width, height, 0, flags); return bitmap; } diff --git a/testing/embedder_test.h b/testing/embedder_test.h index fd48840d28..ba44673004 100644 --- a/testing/embedder_test.h +++ b/testing/embedder_test.h @@ -103,7 +103,9 @@ class EmbedderTest : public ::testing::Test, // Convert a loaded page into a bitmap with page rendering flags specified. // See public/fpdfview.h for a list of page rendering flags. - virtual FPDF_BITMAP RenderPageWithFlags(FPDF_PAGE page, int flags); + virtual FPDF_BITMAP RenderPageWithFlags(FPDF_PAGE page, + FPDF_FORMHANDLE handle, + int flags); // Relese the resources obtained from LoadPage(). Further use of |page| // is prohibited after this call is made. diff --git a/testing/resources/annotation_stamp_with_ap.pdf b/testing/resources/annotation_stamp_with_ap.pdf new file mode 100644 index 0000000000..9181c96af5 Binary files /dev/null and b/testing/resources/annotation_stamp_with_ap.pdf differ -- cgit v1.2.3