summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_graphstatedata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-10 15:14:26 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-10 19:28:59 +0000
commit92e2276a8be492fd2be8e44a5d62e8a5879644d8 (patch)
tree0945f5edda0fbfb461ca1cae89a20adb583242e4 /core/fxge/cfx_graphstatedata.cpp
parent1437643bfaca635d52f4cb9ec41e3075cf893f79 (diff)
downloadpdfium-92e2276a8be492fd2be8e44a5d62e8a5879644d8.tar.xz
Move core/fxge/ge to core/fxge.
This brings the cpp and h files together and removes the redundant ge/ path. Change-Id: I36594b8ae719d362768ba4c2e4ce173e287363eb Reviewed-on: https://pdfium-review.googlesource.com/7452 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/cfx_graphstatedata.cpp')
-rw-r--r--core/fxge/cfx_graphstatedata.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/core/fxge/cfx_graphstatedata.cpp b/core/fxge/cfx_graphstatedata.cpp
new file mode 100644
index 0000000000..82fede176a
--- /dev/null
+++ b/core/fxge/cfx_graphstatedata.cpp
@@ -0,0 +1,52 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/cfx_graphstatedata.h"
+
+#include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/fx_system.h"
+
+CFX_GraphStateData::CFX_GraphStateData()
+ : m_LineCap(LineCapButt),
+ m_DashCount(0),
+ m_DashArray(nullptr),
+ m_DashPhase(0),
+ m_LineJoin(LineJoinMiter),
+ m_MiterLimit(10 * 1.0f),
+ m_LineWidth(1.0f) {}
+
+CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) {
+ m_DashArray = nullptr;
+ Copy(src);
+}
+
+void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
+ m_LineCap = src.m_LineCap;
+ m_DashCount = src.m_DashCount;
+ FX_Free(m_DashArray);
+ m_DashArray = nullptr;
+ m_DashPhase = src.m_DashPhase;
+ m_LineJoin = src.m_LineJoin;
+ m_MiterLimit = src.m_MiterLimit;
+ m_LineWidth = src.m_LineWidth;
+ if (m_DashCount) {
+ m_DashArray = FX_Alloc(float, m_DashCount);
+ memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(float));
+ }
+}
+
+CFX_GraphStateData::~CFX_GraphStateData() {
+ FX_Free(m_DashArray);
+}
+
+void CFX_GraphStateData::SetDashCount(int count) {
+ FX_Free(m_DashArray);
+ m_DashArray = nullptr;
+ m_DashCount = count;
+ if (count == 0)
+ return;
+ m_DashArray = FX_Alloc(float, count);
+}