| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 #include "core/fxcrt/include/fx_system.h" | |
| 8 #include "core/fxge/include/fx_ge.h" | |
| 9 | |
| 10 CFX_GraphStateData::CFX_GraphStateData() | |
| 11 : m_LineCap(LineCapButt), | |
| 12 m_DashCount(0), | |
| 13 m_DashArray(nullptr), | |
| 14 m_DashPhase(0), | |
| 15 m_LineJoin(LineJoinMiter), | |
| 16 m_MiterLimit(10 * 1.0f), | |
| 17 m_LineWidth(1.0f) {} | |
| 18 | |
| 19 CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) { | |
| 20 m_DashArray = nullptr; | |
| 21 Copy(src); | |
| 22 } | |
| 23 | |
| 24 void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { | |
| 25 m_LineCap = src.m_LineCap; | |
| 26 m_DashCount = src.m_DashCount; | |
| 27 FX_Free(m_DashArray); | |
| 28 m_DashArray = nullptr; | |
| 29 m_DashPhase = src.m_DashPhase; | |
| 30 m_LineJoin = src.m_LineJoin; | |
| 31 m_MiterLimit = src.m_MiterLimit; | |
| 32 m_LineWidth = src.m_LineWidth; | |
| 33 if (m_DashCount) { | |
| 34 m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount); | |
| 35 FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT)); | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 CFX_GraphStateData::~CFX_GraphStateData() { | |
| 40 FX_Free(m_DashArray); | |
| 41 } | |
| 42 | |
| 43 void CFX_GraphStateData::SetDashCount(int count) { | |
| 44 FX_Free(m_DashArray); | |
| 45 m_DashArray = nullptr; | |
| 46 m_DashCount = count; | |
| 47 if (count == 0) { | |
| 48 return; | |
| 49 } | |
| 50 m_DashArray = FX_Alloc(FX_FLOAT, count); | |
| 51 } | |
| OLD | NEW |