diff options
author | Jane Liu <janeliulwq@google.com> | 2017-08-15 10:50:22 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-16 17:15:02 +0000 |
commit | 0c6b07d3fdbbabda8753e6457f4323237fc5be30 (patch) | |
tree | 8b1b62186095a8a2191c60e234dfd8a63b8d30db /samples/pdfium_test.cc | |
parent | ca89829775fec2968b51fe5abad86bad1b6a277b (diff) | |
download | pdfium-0c6b07d3fdbbabda8753e6457f4323237fc5be30.tar.xz |
Changed the return type of FPDFAnnot_Get{Rect|AttachmentPoints}()
Instead of returning structs, changed FPDFAnnot_GetRect() and
FPDFAnnot_GetAttachmentPoints() to return a bool and take a struct
as an out parameter.
Change-Id: I380e76eb1566b2488150fb31e9dad564a3ee10d4
Reviewed-on: https://pdfium-review.googlesource.com/10470
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
Diffstat (limited to 'samples/pdfium_test.cc')
-rw-r--r-- | samples/pdfium_test.cc | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index f8096abc50..31235f0eff 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -416,18 +416,26 @@ 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)) { - FS_QUADPOINTSF quadpoints = FPDFAnnot_GetAttachmentPoints(annot); - 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); + FS_QUADPOINTSF quadpoints; + if (FPDFAnnot_GetAttachmentPoints(annot, &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"); + } } // Retrieve the annotation's rectangle coordinates. - FS_RECTF rect = FPDFAnnot_GetRect(annot); - fprintf(fp, "Rectangle: l - %.3f, b - %.3f, r - %.3f, t - %.3f\n\n", - rect.left, rect.bottom, rect.right, rect.top); + FS_RECTF rect; + if (FPDFAnnot_GetRect(annot, &rect)) { + fprintf(fp, "Rectangle: l - %.3f, b - %.3f, r - %.3f, t - %.3f\n\n", + rect.left, rect.bottom, rect.right, rect.top); + } else { + fprintf(fp, "Failed to retrieve annotation rectangle.\n"); + } FPDFPage_CloseAnnot(annot); } |