summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_imagecacheentry.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-18 13:48:33 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-18 21:21:59 +0000
commitf605c24fa76c9034184ed6a5054200962a0b6c07 (patch)
treeac9e02f447e0d3ca07155082eb84ea546fc73762 /core/fpdfapi/render/cpdf_imagecacheentry.cpp
parent940967de0b588d3abb9cba5822ae5f5c5fe05017 (diff)
downloadpdfium-f605c24fa76c9034184ed6a5054200962a0b6c07.tar.xz
Add more CFX_UnownedPtr usage.
One lifetime issue was fixed by passing CPDF_RenderStatus into Continue() methods rather than holidng a pointer which was going stale. Bug: Change-Id: I63b9dce4c1a0d1377cc407b5460535f7c916a040 Reviewed-on: https://pdfium-review.googlesource.com/5659 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_imagecacheentry.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_imagecacheentry.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
index 392eaba914..74e0bf16d7 100644
--- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp
+++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
@@ -22,11 +22,8 @@ CPDF_ImageCacheEntry::CPDF_ImageCacheEntry(CPDF_Document* pDoc,
CPDF_Stream* pStream)
: m_dwTimeCount(0),
m_MatteColor(0),
- m_pRenderStatus(nullptr),
m_pDocument(pDoc),
m_pStream(pStream),
- m_pCurBitmap(nullptr),
- m_pCurMask(nullptr),
m_dwCacheSize(0) {}
CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() {}
@@ -70,11 +67,10 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
if (!pRenderStatus)
return 0;
- m_pRenderStatus = pRenderStatus;
m_pCurBitmap = pdfium::MakeRetain<CPDF_DIBSource>();
int ret = m_pCurBitmap.As<CPDF_DIBSource>()->StartLoadDIBSource(
- m_pDocument, m_pStream, true, pFormResources, pPageResources, bStdCS,
- GroupFamily, bLoadMask);
+ m_pDocument.Get(), m_pStream.Get(), true, pFormResources, pPageResources,
+ bStdCS, GroupFamily, bLoadMask);
if (ret == 2)
return ret;
@@ -82,14 +78,15 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
m_pCurBitmap.Reset();
return 0;
}
- ContinueGetCachedBitmap();
+ ContinueGetCachedBitmap(pRenderStatus);
return 0;
}
-void CPDF_ImageCacheEntry::ContinueGetCachedBitmap() {
+void CPDF_ImageCacheEntry::ContinueGetCachedBitmap(
+ CPDF_RenderStatus* pRenderStatus) {
m_MatteColor = m_pCurBitmap.As<CPDF_DIBSource>()->GetMatteColor();
m_pCurMask = m_pCurBitmap.As<CPDF_DIBSource>()->DetachMask();
- CPDF_RenderContext* pContext = m_pRenderStatus->GetContext();
+ CPDF_RenderContext* pContext = pRenderStatus->GetContext();
CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache();
m_dwTimeCount = pPageRenderCache->GetTimeCount();
if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() <
@@ -108,7 +105,8 @@ void CPDF_ImageCacheEntry::ContinueGetCachedBitmap() {
CalcSize();
}
-int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause) {
+int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause,
+ CPDF_RenderStatus* pRenderStatus) {
int ret = m_pCurBitmap.As<CPDF_DIBSource>()->ContinueLoadDIBSource(pPause);
if (!ret) {
m_pCurBitmap.Reset();
@@ -117,7 +115,7 @@ int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause) {
if (ret == 2)
return ret;
- ContinueGetCachedBitmap();
+ ContinueGetCachedBitmap(pRenderStatus);
return 0;
}