• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
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 <vector>
11 
12 #include "core/fxcrt/fx_system.h"
13 #include "core/fxcrt/retain_ptr.h"
14 
15 class CFX_GraphStateData {
16  public:
17   enum LineCap : uint8_t {
18     LineCapButt = 0,
19     LineCapRound = 1,
20     LineCapSquare = 2
21   };
22 
23   enum LineJoin : uint8_t {
24     LineJoinMiter = 0,
25     LineJoinRound = 1,
26     LineJoinBevel = 2
27   };
28 
29   CFX_GraphStateData();
30   CFX_GraphStateData(const CFX_GraphStateData& src);
31   CFX_GraphStateData(CFX_GraphStateData&& src);
32   ~CFX_GraphStateData();
33 
34   CFX_GraphStateData& operator=(const CFX_GraphStateData& that);
35   CFX_GraphStateData& operator=(CFX_GraphStateData&& that);
36 
37   LineCap m_LineCap = LineCapButt;
38   LineJoin m_LineJoin = LineJoinMiter;
39   float m_DashPhase = 0.0f;
40   float m_MiterLimit = 10.0f;
41   float m_LineWidth = 1.0f;
42   std::vector<float> m_DashArray;
43 };
44 
45 class CFX_RetainableGraphStateData : public Retainable,
46                                      public CFX_GraphStateData {
47  public:
48   template <typename T, typename... Args>
49   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
50 
51   RetainPtr<CFX_RetainableGraphStateData> Clone() const;
52 
53  private:
54   CFX_RetainableGraphStateData();
55   CFX_RetainableGraphStateData(const CFX_RetainableGraphStateData& src);
56   ~CFX_RetainableGraphStateData() override;
57 };
58 
59 #endif  // CORE_FXGE_CFX_GRAPHSTATEDATA_H_
60