diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-10-14 22:54:38 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-10-15 15:41:22 +0200 |
commit | 342e427d33af0d4bfa694248e7a47fdf1f7f270d (patch) | |
tree | d0e4d69fd3b2bf746e6f85998668b968507b1a24 /external | |
parent | c43e4005e7b0f19920a3e50120298391251cf8af (diff) |
pdfium: add support for border property of PDF annotations
This extends PDFium with readon of "Border" property from the
PDF annotations and adds the API to PDFium wrapper.
Border is mostly used for border (line) width and the radius of
rounding of the border (for drawing a rounded rectangle for
example).
Change-Id: I03f189eee03155ec699b2f56ceed23e6839a3f03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104361
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/pdfium/AnnotationBorderProperties.patch.1 | 60 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 1 |
2 files changed, 61 insertions, 0 deletions
diff --git a/external/pdfium/AnnotationBorderProperties.patch.1 b/external/pdfium/AnnotationBorderProperties.patch.1 new file mode 100644 index 000000000000..87f8f48beed9 --- /dev/null +++ b/external/pdfium/AnnotationBorderProperties.patch.1 @@ -0,0 +1,60 @@ +diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp +index c1471220b..229651d82 100644 +--- a/fpdfsdk/fpdf_annot.cpp ++++ b/fpdfsdk/fpdf_annot.cpp +@@ -756,6 +756,35 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetColor(FPDF_ANNOTATION annot, + return true; + } + ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetBorder(FPDF_ANNOTATION annot, ++ float* hor_radius, ++ float* vert_radius, ++ float* width) { ++ CPDF_Dictionary* pAnnotDict = GetAnnotDictFromFPDFAnnotation(annot); ++ if (!pAnnotDict || !hor_radius || !vert_radius || !width) ++ return false; ++ ++ // If BA entry exists, then Border is ignored ++ if (pAnnotDict->KeyExist("BA")) ++ return false; ++ ++ CPDF_Array* pBorderArray = pAnnotDict->GetArrayFor("Border"); ++ if (!pBorderArray) { ++ *hor_radius = 0.0f; ++ *vert_radius = 0.0f; ++ *width = 1.0f; ++ return true; ++ } ++ if (pBorderArray->size() < 3) ++ return false; ++ ++ *hor_radius = pBorderArray->GetNumberAt(0); ++ *vert_radius = pBorderArray->GetNumberAt(1); ++ *width = pBorderArray->GetNumberAt(2); ++ ++ return true; ++} ++ + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV + FPDFAnnot_HasAttachmentPoints(FPDF_ANNOTATION annot) { + if (!annot) +diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h +index 2176450c8..ce033cde3 100644 +--- a/public/fpdf_annot.h ++++ b/public/fpdf_annot.h +@@ -313,6 +313,12 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetColor(FPDF_ANNOTATION annot, + unsigned int* A); + + // Experimental API. ++// TODO ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetBorder(FPDF_ANNOTATION annot, ++ float* hor_radius, ++ float* vert_radius, ++ float* width); ++// Experimental API. + // Check if the annotation is of a type that has attachment points + // (i.e. quadpoints). Quadpoints are the vertices of the rectangle that + // encompasses the texts affected by the annotation. They provide the +-- +2.26.2 + diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index b5cbb6dc23df..5eccb92001eb 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -15,6 +15,7 @@ pdfium_patches += build.patch.1 pdfium_patches += windows7.patch.1 pdfium_patches += c++20-comparison.patch pdfium_patches += AnnotationInkAndVertices.patch.1 +pdfium_patches += AnnotationBorderProperties.patch.1 # Work around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94141> "c++20 rewritten operator== # recursive call mixing friend and external operators for template class" in GCC with |