Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: xfa/fxfa/app/xfa_ffwidget.cpp

Issue 2451493002: Refcount all the IFX_ stream classes all the time. (Closed)
Patch Set: Clean up cast expression Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_ffdoc.cpp ('k') | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_ffwidget.cpp
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index dfe418b76be026c7c5739515c3b726e2a340bb56..99333ba1dd518ef32680bcecc8617b16e9742b67 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 =
« no previous file with comments | « xfa/fxfa/app/xfa_ffdoc.cpp ('k') | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698