summaryrefslogtreecommitdiff
path: root/core/fxge/ge/cfx_graphstatedata.cpp
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-08-10 07:51:38 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-10 07:51:39 -0700
commit9ada2d83cbb629f286936ebc7a208a61164f873b (patch)
tree227aa12df825dbda00a961bd894c35d9987638f2 /core/fxge/ge/cfx_graphstatedata.cpp
parentf3dc8c6941635e5c4cc20c8388289f6b148dc9eb (diff)
downloadpdfium-9ada2d83cbb629f286936ebc7a208a61164f873b.tar.xz
Move CFX_RenderDevice, CFX_FxgeDevice, and CFX_GraphStateData into their own files.
This is the third CL to separate fx_ge into classes, one per file. All fx_ge.h includes had to be replaced with new includes The method definitions for CFX_FxgeDevice were not moved to a single file. These methods are defined in two folders different from fxge/ge, so they were left untouched for now. Review-Url: https://codereview.chromium.org/2223213002
Diffstat (limited to 'core/fxge/ge/cfx_graphstatedata.cpp')
-rw-r--r--core/fxge/ge/cfx_graphstatedata.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/core/fxge/ge/cfx_graphstatedata.cpp b/core/fxge/ge/cfx_graphstatedata.cpp
new file mode 100644
index 0000000000..0a5b5e301c
--- /dev/null
+++ b/core/fxge/ge/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/include/cfx_graphstatedata.h"
+
+#include "core/fxcrt/include/fx_memory.h"
+#include "core/fxcrt/include/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(FX_FLOAT, m_DashCount);
+ FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_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(FX_FLOAT, count);
+}