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

Side by Side Diff: core/fpdfapi/page/cpdf_image.h

Issue 2523093003: Use CFX_MaybeOwned<> in CPDF_Image (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | core/fpdfapi/page/cpdf_image.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PAGE_CPDF_IMAGE_H_ 7 #ifndef CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_ 8 #define CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "core/fpdfapi/parser/cpdf_stream.h" 12 #include "core/fpdfapi/parser/cpdf_stream.h"
13 #include "core/fxcrt/cfx_maybe_owned.h"
13 #include "core/fxcrt/fx_system.h" 14 #include "core/fxcrt/fx_system.h"
14 15
15 class CFX_DIBSource; 16 class CFX_DIBSource;
16 class CFX_DIBitmap; 17 class CFX_DIBitmap;
17 class CPDF_Document; 18 class CPDF_Document;
18 class CPDF_Page; 19 class CPDF_Page;
19 class IFX_Pause; 20 class IFX_Pause;
20 class IFX_SeekableReadStream; 21 class IFX_SeekableReadStream;
21 22
22 class CPDF_Image { 23 class CPDF_Image {
23 public: 24 public:
24 explicit CPDF_Image(CPDF_Document* pDoc); 25 explicit CPDF_Image(CPDF_Document* pDoc);
25 CPDF_Image(CPDF_Document* pDoc, std::unique_ptr<CPDF_Stream> pStream); 26 CPDF_Image(CPDF_Document* pDoc, std::unique_ptr<CPDF_Stream> pStream);
26 CPDF_Image(CPDF_Document* pDoc, uint32_t dwStreamObjNum); 27 CPDF_Image(CPDF_Document* pDoc, uint32_t dwStreamObjNum);
27 ~CPDF_Image(); 28 ~CPDF_Image();
28 29
29 void ConvertStreamToIndirectObject(); 30 void ConvertStreamToIndirectObject();
30 31
31 CPDF_Dictionary* GetInlineDict() const { return m_pDict; } 32 CPDF_Dictionary* GetInlineDict() const { return m_pDict.Get(); }
32 CPDF_Stream* GetStream() const { return m_pStream; } 33 CPDF_Stream* GetStream() const { return m_pStream.Get(); }
33 CPDF_Dictionary* GetDict() const { 34 CPDF_Dictionary* GetDict() const {
34 return m_pStream ? m_pStream->GetDict() : nullptr; 35 return m_pStream ? m_pStream->GetDict() : nullptr;
35 } 36 }
36 CPDF_Dictionary* GetOC() const { return m_pOC; } 37 CPDF_Dictionary* GetOC() const { return m_pOC; }
37 CPDF_Document* GetDocument() const { return m_pDocument; } 38 CPDF_Document* GetDocument() const { return m_pDocument; }
38 39
39 int32_t GetPixelHeight() const { return m_Height; } 40 int32_t GetPixelHeight() const { return m_Height; }
40 int32_t GetPixelWidth() const { return m_Width; } 41 int32_t GetPixelWidth() const { return m_Width; }
41 42
42 bool IsInline() const { return m_bIsInline; } 43 bool IsInline() const { return m_bIsInline; }
(...skipping 27 matching lines...) Expand all
70 private: 71 private:
71 void FinishInitialization(); 72 void FinishInitialization();
72 std::unique_ptr<CPDF_Dictionary> InitJPEG(uint8_t* pData, uint32_t size); 73 std::unique_ptr<CPDF_Dictionary> InitJPEG(uint8_t* pData, uint32_t size);
73 74
74 int32_t m_Height = 0; 75 int32_t m_Height = 0;
75 int32_t m_Width = 0; 76 int32_t m_Width = 0;
76 bool m_bIsInline = false; 77 bool m_bIsInline = false;
77 bool m_bIsMask = false; 78 bool m_bIsMask = false;
78 bool m_bInterpolate = false; 79 bool m_bInterpolate = false;
79 CPDF_Document* const m_pDocument; 80 CPDF_Document* const m_pDocument;
80 CPDF_Stream* m_pStream = nullptr; 81 CFX_MaybeOwned<CPDF_Stream> m_pStream;
81 CPDF_Dictionary* m_pDict = nullptr; 82 CFX_MaybeOwned<CPDF_Dictionary> m_pDict;
82 std::unique_ptr<CPDF_Stream> m_pOwnedStream;
83 std::unique_ptr<CPDF_Dictionary> m_pOwnedDict;
84 CPDF_Dictionary* m_pOC = nullptr; 83 CPDF_Dictionary* m_pOC = nullptr;
85 }; 84 };
86 85
87 #endif // CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_ 86 #endif // CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/page/cpdf_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698