summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorRalf Sippl <ralf.sippl@gmail.com>2018-04-12 21:20:26 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-12 21:20:26 +0000
commit1638179e85863b5045fcea2282fd3e0622aeac13 (patch)
treee21cc4c409ed04ccb4496f17c4edcc0d8f586cdc /samples
parentc9f4f0dbcaaf9e86ef2b64c844b094bd2f6b1a92 (diff)
downloadpdfium-1638179e85863b5045fcea2282fd3e0622aeac13.tar.xz
Add index parameter to quadpoints getter and setter.
This is needed for working with multiline text markup annotations. Based on https://pdfium-review.googlesource.com/12012. Bug: pdfium:1045 Change-Id: Ifb105996b8b950bb2d5fceaf754b4f571155aef4 Reviewed-on: https://pdfium-review.googlesource.com/29150 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/pdfium_test_write_helper.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/samples/pdfium_test_write_helper.cc b/samples/pdfium_test_write_helper.cc
index 5a2e0f66ce..d061252e07 100644
--- a/samples/pdfium_test_write_helper.cc
+++ b/samples/pdfium_test_write_helper.cc
@@ -315,15 +315,22 @@ void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num) {
// Retrieve the annotation's quadpoints if it is a markup annotation.
if (FPDFAnnot_HasAttachmentPoints(annot.get())) {
- FS_QUADPOINTSF quadpoints;
- if (FPDFAnnot_GetAttachmentPoints(annot.get(), &quadpoints)) {
- fprintf(fp,
- "Quadpoints: (%.3f, %.3f), (%.3f, %.3f), (%.3f, %.3f), (%.3f, "
- "%.3f)\n",
- quadpoints.x1, quadpoints.y1, quadpoints.x2, quadpoints.y2,
- quadpoints.x3, quadpoints.y3, quadpoints.x4, quadpoints.y4);
- } else {
- fprintf(fp, "Failed to retrieve quadpoints.\n");
+ size_t qp_count = FPDFAnnot_CountAttachmentPoints(annot.get());
+ fprintf(fp, "Number of quadpoints sets: %zu\n", qp_count);
+
+ // Iterate through all quadpoints of the current annotation
+ for (size_t j = 0; j < qp_count; ++j) {
+ FS_QUADPOINTSF quadpoints;
+ if (FPDFAnnot_GetAttachmentPoints(annot.get(), j, &quadpoints)) {
+ fprintf(fp,
+ "Quadpoints set #%zu: (%.3f, %.3f), (%.3f, %.3f), "
+ "(%.3f, %.3f), (%.3f, %.3f)\n",
+ j + 1, quadpoints.x1, quadpoints.y1, quadpoints.x2,
+ quadpoints.y2, quadpoints.x3, quadpoints.y3, quadpoints.x4,
+ quadpoints.y4);
+ } else {
+ fprintf(fp, "Failed to retrieve quadpoints set #%zu.\n", j + 1);
+ }
}
}