summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-17 13:41:13 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-17 13:41:13 -0800
commit979ddd8e4d331b330360f321b7b0c1acaead6445 (patch)
tree473af0a917597b08b66c4154cfd4c8e5fdd0a923 /core/src/fpdfapi
parent1871821653de9f4b1706d726f4d318cf739e55af (diff)
downloadpdfium-979ddd8e4d331b330360f321b7b0c1acaead6445.tar.xz
Merge to XFA: Tidy CPDF_RenderContext
Original Review URL: https://codereview.chromium.org/1536623004 . (cherry picked from commit 761660c4074269ac806d06c9bef70e4e9fb0eb29) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1531423002 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp34
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp3
4 files changed, 17 insertions, 30 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index bee188e049..1c46583e59 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -956,30 +956,18 @@ CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(
}
return pStates;
}
-CPDF_RenderContext::CPDF_RenderContext() {}
-void CPDF_RenderContext::Create(CPDF_Document* pDoc,
- CPDF_PageRenderCache* pPageCache,
- CPDF_Dictionary* pPageResources,
- FX_BOOL bFirstLayer) {
- m_pDocument = pDoc;
- m_pPageResources = pPageResources;
- m_pPageCache = pPageCache;
- m_bFirstLayer = bFirstLayer;
-}
-void CPDF_RenderContext::Create(CPDF_Page* pPage, FX_BOOL bFirstLayer) {
- m_pDocument = pPage->m_pDocument;
- m_pPageResources = pPage->m_pPageResources;
- m_pPageCache = pPage->GetRenderCache();
- m_bFirstLayer = bFirstLayer;
-}
+CPDF_RenderContext::CPDF_RenderContext(CPDF_Page* pPage)
+ : m_pDocument(pPage->m_pDocument),
+ m_pPageResources(pPage->m_pPageResources),
+ m_pPageCache(pPage->GetRenderCache()),
+ m_bFirstLayer(TRUE) {}
+CPDF_RenderContext::CPDF_RenderContext(CPDF_Document* pDoc,
+ CPDF_PageRenderCache* pPageCache)
+ : m_pDocument(pDoc),
+ m_pPageResources(nullptr),
+ m_pPageCache(pPageCache),
+ m_bFirstLayer(TRUE) {}
CPDF_RenderContext::~CPDF_RenderContext() {}
-void CPDF_RenderContext::Clear() {
- m_pDocument = NULL;
- m_pPageResources = NULL;
- m_pPageCache = NULL;
- m_bFirstLayer = TRUE;
- m_ContentList.RemoveAll();
-}
void CPDF_RenderContext::AppendObjectList(CPDF_PageObjects* pObjs,
const CFX_Matrix* pObject2Device) {
_PDF_RenderItem* pItem = m_ContentList.AddSpace();
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index babf70396b..8d0568e719 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -250,7 +250,7 @@ FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap,
return FALSE;
}
CPDF_RenderContext* pContext = pRenderStatus->GetContext();
- CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache;
+ CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache();
m_dwTimeCount = pPageRenderCache->GetTimeCount();
CPDF_DIBSource* pSrc = new CPDF_DIBSource;
CPDF_DIBSource* pMaskSrc = NULL;
@@ -325,7 +325,7 @@ int CPDF_ImageCache::ContinueGetCachedBitmap() {
m_MatteColor = ((CPDF_DIBSource*)m_pCurBitmap)->m_MatteColor;
m_pCurMask = ((CPDF_DIBSource*)m_pCurBitmap)->DetachMask();
CPDF_RenderContext* pContext = m_pRenderStatus->GetContext();
- CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache;
+ CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache();
m_dwTimeCount = pPageRenderCache->GetTimeCount();
if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() <
FPDF_HUGE_IMAGE_SIZE) {
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index d3390517e9..9c7b0018fa 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -340,7 +340,7 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() {
dest_height = -dest_height;
}
if (m_Loader.StartLoadImage(
- m_pImageObject, m_pRenderStatus->m_pContext->m_pPageCache,
+ m_pImageObject, m_pRenderStatus->m_pContext->GetPageCache(),
m_LoadHandle, m_bStdCS, m_pRenderStatus->m_GroupFamily,
m_pRenderStatus->m_bLoadMask, m_pRenderStatus, dest_width,
dest_height)) {
@@ -444,8 +444,8 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
pGeneralState->m_StrokeAlpha == 1 && pGeneralState->m_FillAlpha == 1) {
CPDF_Document* pDocument = NULL;
CPDF_Page* pPage = NULL;
- if (m_pRenderStatus->m_pContext->m_pPageCache) {
- pPage = m_pRenderStatus->m_pContext->m_pPageCache->GetPage();
+ if (m_pRenderStatus->m_pContext->GetPageCache()) {
+ pPage = m_pRenderStatus->m_pContext->GetPageCache()->GetPage();
pDocument = pPage->m_pDocument;
} else {
pDocument = m_pImageObject->m_pImage->GetDocument();
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 9076b7ba20..718fa73009 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -988,8 +988,7 @@ static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc,
}
flags |= RENDER_FORCE_HALFTONE;
options.m_Flags = flags;
- CPDF_RenderContext context;
- context.Create(pDoc, pCache, NULL);
+ CPDF_RenderContext context(pDoc, pCache);
context.DrawObjectList(&bitmap_device, pPattern->m_pForm, &mtPattern2Bitmap,
&options);
return pBitmap;