From 75f84a56fed36111ece82d0ac96e87289622b093 Mon Sep 17 00:00:00 2001 From: jaepark Date: Fri, 9 Sep 2016 15:39:09 -0700 Subject: Define behaviors of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. Previously, PDFium only supported widget annotations to draw forms. As we've implemented other annotations, the behavior of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw changed. So, this CL clearly defines what needs to be done in FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. This CL first assumes that PDFium users will always call FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw to render PDF pages, because otherwise they are not able to support PDF forms. FPDF_RenderPageBitmap_Retail should only deal with non-widget annotations, such as highlight, underline, text, etc. If FPDF_ANNOT flag is passed, non-widget annotations are drawn. Otherwise, they are hidden. FPDF_FFLDraw should only deal with annotations that requires user-interaction, such as widget annotations and popup annotation. Since popup annotation is associated with non-widget annotation, they should not be drawn if the associated annotation is hidden. Thus, if FPDF_ANNOT flag is passed, popup annotations are drawn. Otherwise, they are hidden. Widget annotations should be always drawn regardless of FPDF_ANNOT flag since they need to be always displayed for PDF forms. Also, roll DEPS for testing/corpus to 8485b30. BUG=pdfium:594 Review-Url: https://codereview.chromium.org/2323203002 --- core/fpdfapi/fpdf_render/fpdf_render.cpp | 16 +++++++++++++++- core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'core/fpdfapi') diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 887ea30a42..fbb0745506 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -100,7 +100,21 @@ CPDF_RenderOptions::CPDF_RenderOptions() m_AddFlags(0), m_pOCContext(nullptr), m_dwLimitCacheSize(1024 * 1024 * 100), - m_HalftoneLimit(-1) {} + m_HalftoneLimit(-1), + m_bDrawAnnots(false) {} + +CPDF_RenderOptions::CPDF_RenderOptions(const CPDF_RenderOptions& rhs) + : m_ColorMode(rhs.m_ColorMode), + m_BackColor(rhs.m_BackColor), + m_ForeColor(rhs.m_ForeColor), + m_Flags(rhs.m_Flags), + m_Interpolation(rhs.m_Interpolation), + m_AddFlags(rhs.m_AddFlags), + m_pOCContext(rhs.m_pOCContext), + m_dwLimitCacheSize(rhs.m_dwLimitCacheSize), + m_HalftoneLimit(rhs.m_HalftoneLimit), + m_bDrawAnnots(rhs.m_bDrawAnnots) {} + FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const { if (m_ColorMode == RENDER_COLOR_NORMAL) { return argb; diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h index 2590dbbd2d..7c513aea9e 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h @@ -36,6 +36,7 @@ class CPDF_OCContext; class CPDF_RenderOptions { public: CPDF_RenderOptions(); + CPDF_RenderOptions(const CPDF_RenderOptions& rhs); FX_ARGB TranslateColor(FX_ARGB argb) const; int m_ColorMode; @@ -47,6 +48,7 @@ class CPDF_RenderOptions { CPDF_OCContext* m_pOCContext; uint32_t m_dwLimitCacheSize; int m_HalftoneLimit; + bool m_bDrawAnnots; }; #endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_ -- cgit v1.2.3