OLD | NEW |
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 #include "core/fpdfapi/fpdf_page/cpdf_graphstate.h" | 7 #include "core/fxge/include/cfx_graphstate.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 | 10 |
11 CPDF_GraphState::CPDF_GraphState() {} | 11 CFX_GraphState::CFX_GraphState() {} |
12 | 12 |
13 CPDF_GraphState::CPDF_GraphState(const CPDF_GraphState& that) | 13 CFX_GraphState::CFX_GraphState(const CFX_GraphState& that) |
14 : m_Ref(that.m_Ref) {} | 14 : m_Ref(that.m_Ref) {} |
15 | 15 |
16 CPDF_GraphState::~CPDF_GraphState() {} | 16 CFX_GraphState::~CFX_GraphState() {} |
17 | 17 |
18 void CPDF_GraphState::Emplace() { | 18 void CFX_GraphState::Emplace() { |
19 m_Ref.Emplace(); | 19 m_Ref.Emplace(); |
20 } | 20 } |
21 | 21 |
22 void CPDF_GraphState::SetLineDash(CPDF_Array* pArray, | 22 void CFX_GraphState::SetLineDash(CPDF_Array* pArray, |
23 FX_FLOAT phase, | 23 FX_FLOAT phase, |
24 FX_FLOAT scale) { | 24 FX_FLOAT scale) { |
25 CFX_GraphStateData* pData = m_Ref.GetPrivateCopy(); | 25 CFX_GraphStateData* pData = m_Ref.GetPrivateCopy(); |
26 pData->m_DashPhase = phase * scale; | 26 pData->m_DashPhase = phase * scale; |
27 pData->SetDashCount(static_cast<int>(pArray->GetCount())); | 27 pData->SetDashCount(static_cast<int>(pArray->GetCount())); |
28 for (size_t i = 0; i < pArray->GetCount(); i++) | 28 for (size_t i = 0; i < pArray->GetCount(); i++) |
29 pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; | 29 pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; |
30 } | 30 } |
31 | 31 |
32 FX_FLOAT CPDF_GraphState::GetLineWidth() const { | 32 FX_FLOAT CFX_GraphState::GetLineWidth() const { |
33 return m_Ref.GetObject()->m_LineWidth; | 33 return m_Ref.GetObject()->m_LineWidth; |
34 } | 34 } |
35 | 35 |
36 void CPDF_GraphState::SetLineWidth(FX_FLOAT width) { | 36 void CFX_GraphState::SetLineWidth(FX_FLOAT width) { |
37 m_Ref.GetPrivateCopy()->m_LineWidth = width; | 37 m_Ref.GetPrivateCopy()->m_LineWidth = width; |
38 } | 38 } |
39 | 39 |
40 CFX_GraphStateData::LineCap CPDF_GraphState::GetLineCap() const { | 40 CFX_GraphStateData::LineCap CFX_GraphState::GetLineCap() const { |
41 return m_Ref.GetObject()->m_LineCap; | 41 return m_Ref.GetObject()->m_LineCap; |
42 } | 42 } |
43 void CPDF_GraphState::SetLineCap(CFX_GraphStateData::LineCap cap) { | 43 void CFX_GraphState::SetLineCap(CFX_GraphStateData::LineCap cap) { |
44 m_Ref.GetPrivateCopy()->m_LineCap = cap; | 44 m_Ref.GetPrivateCopy()->m_LineCap = cap; |
45 } | 45 } |
46 | 46 |
47 CFX_GraphStateData::LineJoin CPDF_GraphState::GetLineJoin() const { | 47 CFX_GraphStateData::LineJoin CFX_GraphState::GetLineJoin() const { |
48 return m_Ref.GetObject()->m_LineJoin; | 48 return m_Ref.GetObject()->m_LineJoin; |
49 } | 49 } |
50 | 50 |
51 void CPDF_GraphState::SetLineJoin(CFX_GraphStateData::LineJoin join) { | 51 void CFX_GraphState::SetLineJoin(CFX_GraphStateData::LineJoin join) { |
52 m_Ref.GetPrivateCopy()->m_LineJoin = join; | 52 m_Ref.GetPrivateCopy()->m_LineJoin = join; |
53 } | 53 } |
54 | 54 |
55 FX_FLOAT CPDF_GraphState::GetMiterLimit() const { | 55 FX_FLOAT CFX_GraphState::GetMiterLimit() const { |
56 return m_Ref.GetObject()->m_MiterLimit; | 56 return m_Ref.GetObject()->m_MiterLimit; |
57 } | 57 } |
58 | 58 |
59 void CPDF_GraphState::SetMiterLimit(FX_FLOAT limit) { | 59 void CFX_GraphState::SetMiterLimit(FX_FLOAT limit) { |
60 m_Ref.GetPrivateCopy()->m_MiterLimit = limit; | 60 m_Ref.GetPrivateCopy()->m_MiterLimit = limit; |
61 } | 61 } |
OLD | NEW |