Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2385)

Unified Diff: core/fpdfdoc/cpvt_generateap.cpp

Issue 2239853002: Hidden annotations should not be drawn (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Hidden annotations should not be drawn Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_annot.cpp ('k') | core/fpdfdoc/include/cpdf_annot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpvt_generateap.cpp
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index f15869b13004d4021c5f15f9b30ac76a566abf83..20773337eb29e4bf24311f9376ecc47237a1817d 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -14,6 +14,7 @@
#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
#include "core/fpdfdoc/cpvt_color.h"
#include "core/fpdfdoc/cpvt_fontmap.h"
+#include "core/fpdfdoc/include/cpdf_annot.h"
#include "core/fpdfdoc/include/cpdf_formfield.h"
#include "core/fpdfdoc/include/cpvt_word.h"
@@ -612,13 +613,20 @@ bool CPVT_GenerateAP::GenerateTextFieldAP(CPDF_Document* pDoc,
return GenerateWidgetAP(pDoc, pAnnotDict, 0);
}
-bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
- CPDF_Dictionary* pAnnotDict) {
+static bool ShouldGenerateAPForAnnotation(CPDF_Dictionary* pAnnotDict) {
Lei Zhang 2016/08/15 19:02:10 Move this into the anonymous namespace above and d
// If AP dictionary exists, we use the appearance defined in the
// existing AP dictionary.
if (pAnnotDict->KeyExist("AP"))
return false;
+ return !CPDF_Annot::IsAnnotationHidden(pAnnotDict);
+}
+
+bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
+ CPDF_Dictionary* pAnnotDict) {
+ if (!ShouldGenerateAPForAnnotation(pAnnotDict))
+ return false;
+
CFX_ByteTextBuf sAppStream;
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
@@ -690,9 +698,7 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
- // If AP dictionary exists, we use the appearance defined in the
- // existing AP dictionary.
- if (pAnnotDict->KeyExist("AP"))
+ if (!ShouldGenerateAPForAnnotation(pAnnotDict))
return false;
CFX_ByteTextBuf sAppStream;
@@ -720,9 +726,7 @@ bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
- // If AP dictionary exists, we use the appearance defined in the
- // existing AP dictionary.
- if (pAnnotDict->KeyExist("AP"))
+ if (!ShouldGenerateAPForAnnotation(pAnnotDict))
return false;
FX_FLOAT fBorderWidth = GetBorderWidth(*pAnnotDict);
@@ -776,9 +780,7 @@ bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
- // If AP dictionary exists, we use the appearance defined in the
- // existing AP dictionary.
- if (pAnnotDict->KeyExist("AP"))
+ if (!ShouldGenerateAPForAnnotation(pAnnotDict))
return false;
CFX_ByteTextBuf sAppStream;
@@ -805,9 +807,7 @@ bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
- // If AP dictionary exists, we use the appearance defined in the
- // existing AP dictionary.
- if (pAnnotDict->KeyExist("AP"))
+ if (!ShouldGenerateAPForAnnotation(pAnnotDict))
return false;
CFX_ByteTextBuf sAppStream;
@@ -855,9 +855,7 @@ bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
- // If AP dictionary exists, we use the appearance defined in the
- // existing AP dictionary.
- if (pAnnotDict->KeyExist("AP"))
+ if (!ShouldGenerateAPForAnnotation(pAnnotDict))
return false;
CFX_ByteTextBuf sAppStream;
@@ -906,9 +904,7 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
- // If AP dictionary exists, we use the appearance defined in the
- // existing AP dictionary.
- if (pAnnotDict->KeyExist("AP"))
+ if (!ShouldGenerateAPForAnnotation(pAnnotDict))
return false;
CFX_ByteTextBuf sAppStream;
« no previous file with comments | « core/fpdfdoc/cpdf_annot.cpp ('k') | core/fpdfdoc/include/cpdf_annot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698