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

Side by Side Diff: core/fpdfapi/fpdf_page/include/cpdf_image.h

Issue 2194393002: Fix a leak with FPDFPageObj_NewImgeObj(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix Created 4 years, 4 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_
8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_
9 9
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
(...skipping 12 matching lines...) Expand all
23 class CPDF_Page; 23 class CPDF_Page;
24 class IFX_FileRead; 24 class IFX_FileRead;
25 class IFX_FileWrite; 25 class IFX_FileWrite;
26 class IFX_Pause; 26 class IFX_Pause;
27 27
28 class CPDF_Image { 28 class CPDF_Image {
29 public: 29 public:
30 explicit CPDF_Image(CPDF_Document* pDoc); 30 explicit CPDF_Image(CPDF_Document* pDoc);
31 ~CPDF_Image(); 31 ~CPDF_Image();
32 32
33 FX_BOOL LoadImageF(CPDF_Stream* pImageStream, FX_BOOL bInline); 33 bool CanRelease() const;
34
35 void Release(); 34 void Release();
Wei Li 2016/08/04 18:00:39 Nit: Release() can be removed. Callers can directl
36 35
37 CPDF_Image* Clone(); 36 CPDF_Image* Clone();
38 37
39 CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; } 38 CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; }
40 CPDF_Stream* GetStream() const { return m_pStream; } 39 CPDF_Stream* GetStream() const { return m_pStream; }
41 CPDF_Dictionary* GetDict() const { 40 CPDF_Dictionary* GetDict() const {
42 return m_pStream ? m_pStream->GetDict() : nullptr; 41 return m_pStream ? m_pStream->GetDict() : nullptr;
43 } 42 }
44 CPDF_Dictionary* GetOC() const { return m_pOC; } 43 CPDF_Dictionary* GetOC() const { return m_pOC; }
45 CPDF_Document* GetDocument() const { return m_pDocument; } 44 CPDF_Document* GetDocument() const { return m_pDocument; }
46 45
47 int32_t GetPixelHeight() const { return m_Height; } 46 int32_t GetPixelHeight() const { return m_Height; }
48 int32_t GetPixelWidth() const { return m_Width; } 47 int32_t GetPixelWidth() const { return m_Width; }
49 48
50 FX_BOOL IsInline() { return m_bInline; } 49 bool IsInline() const { return m_bInline; }
51 FX_BOOL IsMask() const { return m_bIsMask; } 50 bool IsMask() const { return m_bIsMask; }
52 FX_BOOL IsInterpol() const { return m_bInterpolate; } 51 bool IsInterpol() const { return m_bInterpolate; }
52
53 void LoadImageF(CPDF_Stream* pImageStream, bool bInline);
53 54
54 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, 55 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr,
55 uint32_t* pMatteColor = nullptr, 56 uint32_t* pMatteColor = nullptr,
56 FX_BOOL bStdCS = FALSE, 57 FX_BOOL bStdCS = FALSE,
57 uint32_t GroupFamily = 0, 58 uint32_t GroupFamily = 0,
58 FX_BOOL bLoadMask = FALSE) const; 59 FX_BOOL bLoadMask = FALSE) const;
59 60
60 void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; } 61 void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; }
61 void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); 62 void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress);
62 void SetJpegImage(uint8_t* pImageData, uint32_t size); 63 void SetJpegImage(uint8_t* pImageData, uint32_t size);
(...skipping 11 matching lines...) Expand all
74 CFX_DIBSource* DetachMask(); 75 CFX_DIBSource* DetachMask();
75 76
76 CFX_DIBSource* m_pDIBSource; 77 CFX_DIBSource* m_pDIBSource;
77 CFX_DIBSource* m_pMask; 78 CFX_DIBSource* m_pMask;
78 uint32_t m_MatteColor; 79 uint32_t m_MatteColor;
79 80
80 private: 81 private:
81 CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); 82 CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size);
82 83
83 CPDF_Stream* m_pStream; 84 CPDF_Stream* m_pStream;
84 FX_BOOL m_bInline; 85 bool m_bInline;
85 CPDF_Dictionary* m_pInlineDict; 86 CPDF_Dictionary* m_pInlineDict;
86 int32_t m_Height; 87 int32_t m_Height;
87 int32_t m_Width; 88 int32_t m_Width;
88 FX_BOOL m_bIsMask; 89 bool m_bIsMask;
89 FX_BOOL m_bInterpolate; 90 bool m_bInterpolate;
90 CPDF_Document* m_pDocument; 91 CPDF_Document* const m_pDocument;
91 CPDF_Dictionary* m_pOC; 92 CPDF_Dictionary* m_pOC;
92 }; 93 };
93 94
94 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ 95 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698