7#include "core/fpdfapi/page/cpdf_page.h"
12#include "constants/page_object.h"
13#include "core/fpdfapi/page/cpdf_contentparser.h"
14#include "core/fpdfapi/page/cpdf_pageimagecache.h"
15#include "core/fpdfapi/page/cpdf_pageobject.h"
16#include "core/fpdfapi/parser/cpdf_array.h"
17#include "core/fpdfapi/parser/cpdf_dictionary.h"
18#include "core/fpdfapi/parser/cpdf_object.h"
19#include "core/fxcrt/check.h"
20#include "core/fxcrt/check_op.h"
21#include "core/fxcrt/containers/contains.h"
27 m_pPDFDocument(pDocument) {
32 GetMutablePageAttr(pdfium::page_object::kResources);
33 m_pResources = pPageAttr ? pPageAttr->GetMutableDict() :
nullptr;
34 m_pPageResources = m_pResources;
37 m_Transparency.SetIsolated();
52 return m_pPDFDocument;
56 return m_PageSize.width;
60 return m_PageSize.height;
71 if (GetParseState() == ParseState::kNotParsed)
72 StartParse(std::make_unique<CPDF_ContentParser>(
this));
84 std::set<RetainPtr<
const CPDF_Dictionary>> visited;
86 while (pPageDict && !
pdfium::Contains(visited, pPageDict)) {
91 visited.insert(pPageDict);
101 box = pBox->GetRect();
124 if (m_PageSize.width == 0 || m_PageSize.height == 0)
174 CFX_Matrix matrix((x2 - x0) / m_PageSize.width, (y2 - y0) / m_PageSize.width,
175 (x1 - x0) / m_PageSize.height,
176 (y1 - y0) / m_PageSize.height, x0, y0);
177 return m_PageMatrix
* matrix;
182 GetPageAttr(pdfium::page_object::kRotate);
183 int rotate = pRotate ? (pRotate->GetInteger() / 90) % 4 : 0;
184 return (rotate < 0) ? (rotate + 4) : rotate;
188 return GetMutableDict()->GetOrCreateArrayFor(
"Annots");
192 return GetMutableDict()->GetMutableArrayFor(
"Annots");
196 return GetDict()->GetArrayFor(
"Annots");
200 m_pPageImageCache = std::make_unique<CPDF_PageImageCache>(
this);
204 DCHECK(!m_pRenderContext);
206 m_pRenderContext = std::move(pContext);
210 m_pRenderContext.reset();
215 m_pView->ClearPage(
this);
223 m_BBox = GetBox(pdfium::page_object::kCropBox);
224 if (m_BBox.IsEmpty())
227 m_BBox.Intersect(mediabox);
229 m_PageSize.width = m_BBox.Width();
230 m_PageSize.height = m_BBox.Height();
234 m_PageMatrix = CFX_Matrix(1.0f, 0, 0, 1.0f, -m_BBox.left, -m_BBox.bottom);
237 std::swap(m_PageSize.width, m_PageSize.height);
239 CFX_Matrix(0, -1.0f, 1.0f, 0, -m_BBox.bottom, m_BBox.right);
242 m_PageMatrix = CFX_Matrix(-1.0f, 0, 0, -1.0f, m_BBox.right, m_BBox.top);
245 std::swap(m_PageSize.width, m_PageSize.height);
246 m_PageMatrix = CFX_Matrix(0, 1.0f, -1.0f, 0, m_BBox.top, -m_BBox.left);
256 m_pPage->ClearRenderContext();
fxcrt::ByteString ByteString
constexpr CFX_FloatRect(float l, float b, float r, float t)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
constexpr CFX_Matrix()=default
CFX_Matrix operator*(const CFX_Matrix &right) const
CFX_PointF Transform(const CFX_PointF &point) const
CFX_Matrix GetInverse() const
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
void LoadTransparencyInfo()
ParseState GetParseState() const
void ContinueParse(PauseIndicatorIface *pPause)
RenderContextClearer(CPDF_Page *pPage)
RetainPtr< const CPDF_Array > GetAnnotsArray() const
RetainPtr< CPDF_Array > GetOrCreateAnnotsArray()
CPDF_Document * GetDocument() const override
float GetPageHeight() const override
std::optional< CFX_PointF > DeviceToPage(const FX_RECT &rect, int rotate, const CFX_PointF &device_point) const override
bool IsPage() const override
float GetPageWidth() const override
CPDFXFA_Page * AsXFAPage() override
RetainPtr< CPDF_Array > GetMutableAnnotsArray()
void SetRenderContext(std::unique_ptr< RenderContextIface > pContext)
CPDF_Page * AsPDFPage() override
std::optional< CFX_PointF > PageToDevice(const FX_RECT &rect, int rotate, const CFX_PointF &page_point) const override
CFX_Matrix GetDisplayMatrix(const FX_RECT &rect, int iRotate) const override
int GetPageRotation() const
void ClearRenderContext()
CFX_PTemplate< float > CFX_PointF