• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXGE_CFX_GRAPHSTATEDATA_H_
8 #define CORE_FXGE_CFX_GRAPHSTATEDATA_H_
9 
10 #include <stdint.h>
11 
12 #include <vector>
13 
14 #include "core/fxcrt/retain_ptr.h"
15 
16 class CFX_GraphStateData {
17  public:
18   enum class LineCap : uint8_t { kButt = 0, kRound = 1, kSquare = 2 };
19 
20   enum class LineJoin : uint8_t { kMiter = 0, kRound = 1, kBevel = 2 };
21 
22   CFX_GraphStateData();
23   CFX_GraphStateData(const CFX_GraphStateData& src);
24   CFX_GraphStateData(CFX_GraphStateData&& src) noexcept;
25   ~CFX_GraphStateData();
26 
27   CFX_GraphStateData& operator=(const CFX_GraphStateData& that);
28   CFX_GraphStateData& operator=(CFX_GraphStateData&& that) noexcept;
29 
30   LineCap m_LineCap = LineCap::kButt;
31   LineJoin m_LineJoin = LineJoin::kMiter;
32   float m_DashPhase = 0.0f;
33   float m_MiterLimit = 10.0f;
34   float m_LineWidth = 1.0f;
35   std::vector<float> m_DashArray;
36 };
37 
38 class CFX_RetainableGraphStateData final : public Retainable,
39                                            public CFX_GraphStateData {
40  public:
41   CONSTRUCT_VIA_MAKE_RETAIN;
42 
43   RetainPtr<CFX_RetainableGraphStateData> Clone() const;
44 
45  private:
46   CFX_RetainableGraphStateData();
47   CFX_RetainableGraphStateData(const CFX_RetainableGraphStateData& src);
48   ~CFX_RetainableGraphStateData() override;
49 };
50 
51 #endif  // CORE_FXGE_CFX_GRAPHSTATEDATA_H_
52