Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: xfa/fxfa/parser/cxfa_data.cpp

Issue 1861353002: Split fxfa_objectacc.h into pieces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_data.h ('k') | xfa/fxfa/parser/cxfa_edge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/cxfa_data.cpp
diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cbcb079cadc1aad07b6f33890ab217adc2557da6
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_data.cpp
@@ -0,0 +1,80 @@
+// 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 "xfa/fxfa/parser/cxfa_data.h"
+
+#include "xfa/fxfa/parser/xfa_object.h"
+
+// Static.
+FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) {
+ uint8_t r = 0, g = 0, b = 0;
+ if (wsValue.GetLength() == 0)
+ return 0xff000000;
+
+ int cc = 0;
+ const FX_WCHAR* str = wsValue.c_str();
+ int len = wsValue.GetLength();
+ while (XFA_IsSpace(str[cc]) && cc < len)
+ cc++;
+
+ if (cc >= len)
+ return 0xff000000;
+
+ while (cc < len) {
+ if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
+ break;
+
+ r = r * 10 + str[cc] - '0';
+ cc++;
+ }
+ if (cc < len && str[cc] == ',') {
+ cc++;
+ while (XFA_IsSpace(str[cc]) && cc < len)
+ cc++;
+
+ while (cc < len) {
+ if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
+ break;
+
+ g = g * 10 + str[cc] - '0';
+ cc++;
+ }
+ if (cc < len && str[cc] == ',') {
+ cc++;
+ while (XFA_IsSpace(str[cc]) && cc < len)
+ cc++;
+
+ while (cc < len) {
+ if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
+ break;
+
+ b = b * 10 + str[cc] - '0';
+ cc++;
+ }
+ }
+ }
+ return (0xff << 24) | (r << 16) | (g << 8) | b;
+}
+
+XFA_ELEMENT CXFA_Data::GetClassID() const {
+ return m_pNode ? m_pNode->GetClassID() : XFA_ELEMENT_UNKNOWN;
+}
+
+FX_BOOL CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr,
+ FX_FLOAT& fValue,
+ FX_BOOL bUseDefault) const {
+ CXFA_Measurement ms;
+ if (m_pNode->TryMeasure(eAttr, ms, bUseDefault)) {
+ fValue = ms.ToUnit(XFA_UNIT_Pt);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+FX_BOOL CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue) {
+ CXFA_Measurement ms(fValue, XFA_UNIT_Pt);
+ return m_pNode->SetMeasure(eAttr, ms);
+}
« no previous file with comments | « xfa/fxfa/parser/cxfa_data.h ('k') | xfa/fxfa/parser/cxfa_edge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698