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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 "xfa/fxfa/parser/cxfa_data.h"
8
9 #include "xfa/fxfa/parser/xfa_object.h"
10
11 // Static.
12 FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) {
13 uint8_t r = 0, g = 0, b = 0;
14 if (wsValue.GetLength() == 0)
15 return 0xff000000;
16
17 int cc = 0;
18 const FX_WCHAR* str = wsValue.c_str();
19 int len = wsValue.GetLength();
20 while (XFA_IsSpace(str[cc]) && cc < len)
21 cc++;
22
23 if (cc >= len)
24 return 0xff000000;
25
26 while (cc < len) {
27 if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
28 break;
29
30 r = r * 10 + str[cc] - '0';
31 cc++;
32 }
33 if (cc < len && str[cc] == ',') {
34 cc++;
35 while (XFA_IsSpace(str[cc]) && cc < len)
36 cc++;
37
38 while (cc < len) {
39 if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
40 break;
41
42 g = g * 10 + str[cc] - '0';
43 cc++;
44 }
45 if (cc < len && str[cc] == ',') {
46 cc++;
47 while (XFA_IsSpace(str[cc]) && cc < len)
48 cc++;
49
50 while (cc < len) {
51 if (str[cc] == ',' || !XFA_IsDigit(str[cc]))
52 break;
53
54 b = b * 10 + str[cc] - '0';
55 cc++;
56 }
57 }
58 }
59 return (0xff << 24) | (r << 16) | (g << 8) | b;
60 }
61
62 XFA_ELEMENT CXFA_Data::GetClassID() const {
63 return m_pNode ? m_pNode->GetClassID() : XFA_ELEMENT_UNKNOWN;
64 }
65
66 FX_BOOL CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr,
67 FX_FLOAT& fValue,
68 FX_BOOL bUseDefault) const {
69 CXFA_Measurement ms;
70 if (m_pNode->TryMeasure(eAttr, ms, bUseDefault)) {
71 fValue = ms.ToUnit(XFA_UNIT_Pt);
72 return TRUE;
73 }
74 return FALSE;
75 }
76
77 FX_BOOL CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue) {
78 CXFA_Measurement ms(fValue, XFA_UNIT_Pt);
79 return m_pNode->SetMeasure(eAttr, ms);
80 }
OLDNEW
« 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