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

Unified Diff: core/fpdfdoc/cpdf_annot.cpp

Issue 2323203002: Define behaviors of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. (Closed)
Patch Set: roll DEPS Created 4 years, 3 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/fpdfapi/fpdf_render/include/cpdf_renderoptions.h ('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/cpdf_annot.cpp
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 4e0b04e9b623195c36ff47093d66f53cf7d53941..0cc3596a4d015acf1ab099d8cf31ba0315b66ffd 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -73,6 +73,16 @@ void CPDF_Annot::GenerateAPIfNeeded() {
CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict);
}
+bool CPDF_Annot::ShouldDrawAnnotation() {
+ if (IsAnnotationHidden(m_pAnnotDict))
+ return false;
+
+ if (m_nSubtype == CPDF_Annot::Subtype::POPUP && !m_bOpenState)
+ return false;
+
+ return true;
+}
+
void CPDF_Annot::ClearCachedAP() {
m_APMap.clear();
}
@@ -294,10 +304,7 @@ FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
const CFX_Matrix* pUser2Device,
AppearanceMode mode,
const CPDF_RenderOptions* pOptions) {
- if (IsAnnotationHidden(m_pAnnotDict))
- return FALSE;
-
- if (m_nSubtype == CPDF_Annot::Subtype::POPUP && !m_bOpenState)
+ if (!ShouldDrawAnnotation())
return FALSE;
// It might happen that by the time this annotation instance was created,
@@ -322,6 +329,16 @@ FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage,
CPDF_RenderContext* pContext,
const CFX_Matrix* pUser2Device,
AppearanceMode mode) {
+ if (!ShouldDrawAnnotation())
+ return FALSE;
+
+ // It might happen that by the time this annotation instance was created,
+ // it was flagged as "hidden" (e.g. /F 2), and hence CPVT_GenerateAP decided
+ // to not "generate" its AP.
+ // If for a reason the object is no longer hidden, but still does not have
+ // its "AP" generated, generate it now.
+ GenerateAPIfNeeded();
+
CFX_Matrix matrix;
CPDF_Form* pForm =
FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);
« no previous file with comments | « core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h ('k') | core/fpdfdoc/include/cpdf_annot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698