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

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

Issue 2301263003: Make CPDF_ClipPath have a CPDF_ClipPathData rather than inheriting (Closed)
Patch Set: safe bool while we're at it Created 4 years, 3 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
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp ('k') | core/fxcrt/include/cfx_count_ref.h » ('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_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_
8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_ 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_
9 9
10 #include "core/fpdfapi/fpdf_page/cpdf_clippathdata.h" 10 #include <memory>
11 #include <utility>
12 #include <vector>
13
11 #include "core/fpdfapi/fpdf_page/include/cpdf_path.h" 14 #include "core/fpdfapi/fpdf_page/include/cpdf_path.h"
15 #include "core/fxcrt/include/cfx_count_ref.h"
12 #include "core/fxcrt/include/fx_basic.h" 16 #include "core/fxcrt/include/fx_basic.h"
13 #include "core/fxcrt/include/fx_coordinates.h" 17 #include "core/fxcrt/include/fx_coordinates.h"
14 #include "core/fxcrt/include/fx_system.h"
15 18
19 class CPDF_Path;
16 class CPDF_TextObject; 20 class CPDF_TextObject;
17 21
18 class CPDF_ClipPath : public CFX_CountRef<CPDF_ClipPathData> { 22 class CPDF_ClipPath {
19 public: 23 public:
24 CPDF_ClipPath();
25 CPDF_ClipPath(const CPDF_ClipPath& that);
26 ~CPDF_ClipPath();
27
28 void Emplace() { m_Ref.Emplace(); }
29 void SetNull() { m_Ref.SetNull(); }
30
31 explicit operator bool() const { return !!m_Ref; }
32 bool operator==(const CPDF_ClipPath& that) const {
33 return m_Ref == that.m_Ref;
34 }
35 bool operator!=(const CPDF_ClipPath& that) const { return !(*this == that); }
36
20 uint32_t GetPathCount() const; 37 uint32_t GetPathCount() const;
21 CPDF_Path GetPath(size_t i) const; 38 CPDF_Path GetPath(size_t i) const;
22 uint8_t GetClipType(size_t i) const; 39 uint8_t GetClipType(size_t i) const;
23 uint32_t GetTextCount() const; 40 uint32_t GetTextCount() const;
24 CPDF_TextObject* GetText(size_t i) const; 41 CPDF_TextObject* GetText(size_t i) const;
25 CFX_FloatRect GetClipBox() const; 42 CFX_FloatRect GetClipBox() const;
26 void AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge); 43 void AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge);
27 void AppendTexts(std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts); 44 void AppendTexts(std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts);
28 void Transform(const CFX_Matrix& matrix); 45 void Transform(const CFX_Matrix& matrix);
46
47 private:
48 class PathData {
49 public:
50 using PathAndTypeData = std::pair<CPDF_Path, uint8_t>;
51
52 PathData();
53 PathData(const PathData& that);
54 ~PathData();
55
56 std::vector<PathAndTypeData> m_PathAndTypeList;
57 std::vector<std::unique_ptr<CPDF_TextObject>> m_TextList;
58 };
59
60 CFX_CountRef<PathData> m_Ref;
29 }; 61 };
30 62
31 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_ 63 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp ('k') | core/fxcrt/include/cfx_count_ref.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698