summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-25 16:16:32 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-25 16:16:32 -0700
commit5ce09684216ed6b74836de9bd056b8f15bd66a4e (patch)
tree841e23498e3684f4b83062c958169bb05573af7d /core/fpdfapi
parent65be4b1818ab99df2bf5b6265604fc25456db49d (diff)
downloadpdfium-5ce09684216ed6b74836de9bd056b8f15bd66a4e.tar.xz
Remove CFX_PrivateData from CPDF_Document
Replace it with two generic slots for Links and Codec usage. Since the codec is at a lower layer than the document, we don't provide separate get/set methods, since having a document upon which to call these would be a layering violation. Do the same for the Links for simplicity. Review-Url: https://codereview.chromium.org/2005193003
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_document.h9
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp6
2 files changed, 10 insertions, 5 deletions
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
index f7a7f9f183..e1d1c77a12 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
@@ -11,6 +11,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
+#include "core/fpdfdoc/include/fpdf_doc.h"
#include "core/fxcrt/include/fx_basic.h"
class CFX_Font;
@@ -35,7 +36,7 @@ class CPDF_StreamAcc;
#define FPDFPERM_PRINT_HIGH 0x0800
#define FPDF_PAGE_MAX_NUM 0xFFFFF
-class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
+class CPDF_Document : public CPDF_IndirectObjectHolder {
public:
explicit CPDF_Document(CPDF_Parser* pParser);
~CPDF_Document();
@@ -57,6 +58,9 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
void ClearPageData();
void RemoveColorSpaceFromPageData(CPDF_Object* pObject);
+ std::unique_ptr<CFX_Deletable>* CodecContext() { return &m_pCodecContext; }
+ std::unique_ptr<CPDF_LinkList>* LinksContext() { return &m_pLinksContext; }
+
CPDF_DocRenderData* GetRenderData() const { return m_pDocRender.get(); }
void ClearRenderData();
void ClearRenderFont();
@@ -107,7 +111,6 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
friend class CPDF_OCContext;
// Retrieve page count information by getting count value from the tree nodes
- // or walking through the tree nodes to calculate it.
int RetrievePageCount() const;
CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages,
int iPage,
@@ -131,6 +134,8 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
// TODO(thestig): Figure out why this cannot be a std::unique_ptr.
CPDF_DocPageData* m_pDocPage;
std::unique_ptr<CPDF_DocRenderData> m_pDocRender;
+ std::unique_ptr<CFX_Deletable> m_pCodecContext;
+ std::unique_ptr<CPDF_LinkList> m_pLinksContext;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 19aeb71e9a..75f6a231a4 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -355,9 +355,9 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
}
}
ret = pJbig2Module->StartDecode(
- m_pJbig2Context, m_pDocument, m_Width, m_Height, m_pStreamAcc.get(),
- m_pGlobalStream.get(), m_pCachedBitmap->GetBuffer(),
- m_pCachedBitmap->GetPitch(), pPause);
+ m_pJbig2Context, m_pDocument->CodecContext(), m_Width, m_Height,
+ m_pStreamAcc.get(), m_pGlobalStream.get(),
+ m_pCachedBitmap->GetBuffer(), m_pCachedBitmap->GetPitch(), pPause);
if (ret < 0) {
m_pCachedBitmap.reset();
m_pGlobalStream.reset();