summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdfannot.cpp15
-rw-r--r--fpdfsdk/fpdfannot_embeddertest.cpp21
-rw-r--r--fpdfsdk/fpdfview_c_api_test.c1
-rw-r--r--public/fpdf_annot.h11
4 files changed, 3 insertions, 45 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index c52807148e..b5dccaade1 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -583,7 +583,7 @@ FPDFAnnot_HasAttachmentPoints(FPDF_ANNOTATION annot) {
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot,
const FS_QUADPOINTSF* quad_points) {
- if (!FPDFAnnot_HasAttachmentPoints(annot) || !quad_points)
+ if (!annot || !quad_points || !FPDFAnnot_HasAttachmentPoints(annot))
return false;
CPDF_Dictionary* pAnnotDict =
@@ -621,21 +621,10 @@ FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot,
return true;
}
-FPDF_EXPORT size_t FPDF_CALLCONV
-FPDFAnnot_CountAttachmentPoints(FPDF_ANNOTATION annot) {
- if (!FPDFAnnot_HasAttachmentPoints(annot))
- return 0;
-
- CPDF_Dictionary* pAnnotDict =
- CPDFAnnotContextFromFPDFAnnotation(annot)->GetAnnotDict();
- const CPDF_Array* pArray = GetQuadPointsArrayFromDictionary(pAnnotDict);
- return pArray ? pArray->GetCount() / 8 : 0;
-}
-
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFAnnot_GetAttachmentPoints(FPDF_ANNOTATION annot,
FS_QUADPOINTSF* quad_points) {
- if (!FPDFAnnot_HasAttachmentPoints(annot) || !quad_points)
+ if (!annot || !quad_points || !FPDFAnnot_HasAttachmentPoints(annot))
return false;
return GetQuadPointsFromDictionary(
diff --git a/fpdfsdk/fpdfannot_embeddertest.cpp b/fpdfsdk/fpdfannot_embeddertest.cpp
index 552398c41f..b96460a395 100644
--- a/fpdfsdk/fpdfannot_embeddertest.cpp
+++ b/fpdfsdk/fpdfannot_embeddertest.cpp
@@ -47,7 +47,7 @@ TEST_F(FPDFAnnotEmbeddertest, RenderAnnotWithOnlyRolloverAP) {
TEST_F(FPDFAnnotEmbeddertest, RenderMultilineMarkupAnnotWithoutAP) {
const char md5_hash[] = "76512832d88017668d9acc7aacd13dae";
- // Open a file with multiline markup annotations.
+ // Open a file with two multiline markup annotations.
ASSERT_TRUE(OpenDocument("annotation_markup_multiline_no_ap.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
@@ -471,25 +471,6 @@ TEST_F(FPDFAnnotEmbeddertest, ModifyRectQuadpointsWithAP) {
UnloadPage(page);
}
-TEST_F(FPDFAnnotEmbeddertest, CountAttachmentPoints) {
- // Open a file with multiline markup annotations.
- ASSERT_TRUE(OpenDocument("annotation_markup_multiline_no_ap.pdf"));
- FPDF_PAGE page = LoadPage(0);
- ASSERT_TRUE(page);
- {
- std::unique_ptr<void, FPDFAnnotationDeleter> annot(
- FPDFPage_GetAnnot(page, 0));
- ASSERT_TRUE(annot);
-
- // This is a three line annotation.
- EXPECT_EQ(3u, FPDFAnnot_CountAttachmentPoints(annot.get()));
- }
- UnloadPage(page);
-
- // null annotation should return 0
- EXPECT_EQ(0u, FPDFAnnot_CountAttachmentPoints(nullptr));
-}
-
TEST_F(FPDFAnnotEmbeddertest, RemoveAnnotation) {
// Open a file with 3 annotations on its first page.
ASSERT_TRUE(OpenDocument("annotation_ink_multiple.pdf"));
diff --git a/fpdfsdk/fpdfview_c_api_test.c b/fpdfsdk/fpdfview_c_api_test.c
index 201fd90669..2a0b230ca5 100644
--- a/fpdfsdk/fpdfview_c_api_test.c
+++ b/fpdfsdk/fpdfview_c_api_test.c
@@ -55,7 +55,6 @@ int CheckPDFiumCApi() {
CHK(FPDFAnnot_GetColor);
CHK(FPDFAnnot_HasAttachmentPoints);
CHK(FPDFAnnot_SetAttachmentPoints);
- CHK(FPDFAnnot_CountAttachmentPoints);
CHK(FPDFAnnot_GetAttachmentPoints);
CHK(FPDFAnnot_SetRect);
CHK(FPDFAnnot_GetRect);
diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
index a84c4f982a..f4dc03a2c4 100644
--- a/public/fpdf_annot.h
+++ b/public/fpdf_annot.h
@@ -5,8 +5,6 @@
#ifndef PUBLIC_FPDF_ANNOT_H_
#define PUBLIC_FPDF_ANNOT_H_
-#include <stddef.h>
-
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
@@ -313,15 +311,6 @@ FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot,
const FS_QUADPOINTSF* quad_points);
// Experimental API.
-// Get the number of sets of quadpoints of an annotation.
-//
-// annot - handle to an annotation.
-//
-// Returns the number of sets of quadpoints, or 0 on failure.
-FPDF_EXPORT size_t FPDF_CALLCONV
-FPDFAnnot_CountAttachmentPoints(FPDF_ANNOTATION annot);
-
-// Experimental API.
// Get the attachment points (i.e. quadpoints) of an annotation.
//
// annot - handle to an annotation.