summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_ffwidget.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-07 09:21:17 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 09:21:18 -0800
commit833619b4441915c7c55085d44b3221eaef0d9800 (patch)
tree68bf76e83078223ba03f490c2c13f484e40154d4 /xfa/fxfa/app/xfa_ffwidget.cpp
parent8f875507a986d10335e40a5f7c1679aff9770d0a (diff)
downloadpdfium-833619b4441915c7c55085d44b3221eaef0d9800.tar.xz
Refcount all the IFX_ stream classes all the time.
We can remove a lot of "bOwnsStream" logic in the process. Always pass these by const reference, in case the called method wants to hang on to the stream (one exception is where we stick a raw pointer into a void* slot in a context from another layer). Review-Url: https://codereview.chromium.org/2451493002
Diffstat (limited to 'xfa/fxfa/app/xfa_ffwidget.cpp')
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index dfe418b76b..99333ba1dd 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -1054,7 +1054,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType);
CFX_ByteString bsContent;
uint8_t* pImageBuffer = nullptr;
- IFX_SeekableReadStream* pImageFileRead = nullptr;
+ CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead;
if (wsImage.GetLength() > 0) {
XFA_ATTRIBUTEENUM iEncoding =
(XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding();
@@ -1092,7 +1092,6 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
CFX_DIBitmap* pBitmap =
XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi);
FX_Free(pImageBuffer);
- pImageFileRead->Release();
return pBitmap;
}
static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type,
@@ -1115,18 +1114,20 @@ static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type,
}
return dibFormat;
}
-CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_SeekableReadStream* pImageFileRead,
- FXCODEC_IMAGE_TYPE type,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi) {
+
+CFX_DIBitmap* XFA_LoadImageFromBuffer(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pImageFileRead,
+ FXCODEC_IMAGE_TYPE type,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi) {
CFX_GEModule* pGeModule = CFX_GEModule::Get();
- if (!pGeModule) {
+ if (!pGeModule)
return nullptr;
- }
+
CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
- if (!pCodecMgr) {
+ if (!pCodecMgr)
return nullptr;
- }
+
CFX_DIBAttribute dibAttr;
CFX_DIBitmap* pBitmap = nullptr;
CCodec_ProgressiveDecoder* pProgressiveDecoder =