OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fxcrt/include/fx_basic.h" | 7 #include "core/fxcrt/include/fx_basic.h" |
8 #include "core/fxcrt/include/fx_ext.h" | 8 #include "core/fxcrt/include/fx_ext.h" |
9 | 9 |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 void CFX_PrivateData::ClearAll() { | 89 void CFX_PrivateData::ClearAll() { |
90 FX_PRIVATEDATA* pList = m_DataList.GetData(); | 90 FX_PRIVATEDATA* pList = m_DataList.GetData(); |
91 int count = m_DataList.GetSize(); | 91 int count = m_DataList.GetSize(); |
92 for (int i = 0; i < count; i++) { | 92 for (int i = 0; i < count; i++) { |
93 pList[i].FreeData(); | 93 pList[i].FreeData(); |
94 } | 94 } |
95 m_DataList.RemoveAll(); | 95 m_DataList.RemoveAll(); |
96 } | 96 } |
97 void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) { | 97 void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) { |
98 if (!FXSYS_memchr(strc.GetPtr(), '.', strc.GetLength())) { | 98 if (!FXSYS_memchr(strc.raw_str(), '.', strc.GetLength())) { |
99 bInteger = TRUE; | 99 bInteger = TRUE; |
100 int cc = 0, integer = 0; | 100 int cc = 0, integer = 0; |
101 const FX_CHAR* str = strc.GetCStr(); | 101 const FX_CHAR* str = strc.c_str(); |
102 int len = strc.GetLength(); | 102 int len = strc.GetLength(); |
103 FX_BOOL bNegative = FALSE; | 103 FX_BOOL bNegative = FALSE; |
104 if (str[0] == '+') { | 104 if (str[0] == '+') { |
105 cc++; | 105 cc++; |
106 } else if (str[0] == '-') { | 106 } else if (str[0] == '-') { |
107 bNegative = TRUE; | 107 bNegative = TRUE; |
108 cc++; | 108 cc++; |
109 } | 109 } |
110 while (cc < len && std::isdigit(str[cc])) { | 110 while (cc < len && std::isdigit(str[cc])) { |
111 // TODO(dsinclair): This is not the right way to handle overflow. | 111 // TODO(dsinclair): This is not the right way to handle overflow. |
(...skipping 10 matching lines...) Expand all Loading... |
122 bInteger = FALSE; | 122 bInteger = FALSE; |
123 *(FX_FLOAT*)pData = FX_atof(strc); | 123 *(FX_FLOAT*)pData = FX_atof(strc); |
124 } | 124 } |
125 } | 125 } |
126 FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { | 126 FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { |
127 if (strc.GetLength() == 0) { | 127 if (strc.GetLength() == 0) { |
128 return 0.0; | 128 return 0.0; |
129 } | 129 } |
130 int cc = 0; | 130 int cc = 0; |
131 FX_BOOL bNegative = FALSE; | 131 FX_BOOL bNegative = FALSE; |
132 const FX_CHAR* str = strc.GetCStr(); | 132 const FX_CHAR* str = strc.c_str(); |
133 int len = strc.GetLength(); | 133 int len = strc.GetLength(); |
134 if (str[0] == '+') { | 134 if (str[0] == '+') { |
135 cc++; | 135 cc++; |
136 } else if (str[0] == '-') { | 136 } else if (str[0] == '-') { |
137 bNegative = TRUE; | 137 bNegative = TRUE; |
138 cc++; | 138 cc++; |
139 } | 139 } |
140 while (cc < len) { | 140 while (cc < len) { |
141 if (str[cc] != '+' && str[cc] != '-') { | 141 if (str[cc] != '+' && str[cc] != '-') { |
142 break; | 142 break; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 d * m.b + e * m.e + f * m.h, d * m.c + e * m.f + f * m.i, | 358 d * m.b + e * m.e + f * m.h, d * m.c + e * m.f + f * m.i, |
359 g * m.a + h * m.d + i * m.g, g * m.b + h * m.e + i * m.h, | 359 g * m.a + h * m.d + i * m.g, g * m.b + h * m.e + i * m.h, |
360 g * m.c + h * m.f + i * m.i); | 360 g * m.c + h * m.f + i * m.i); |
361 } | 361 } |
362 | 362 |
363 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1& v) { | 363 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1& v) { |
364 return CFX_Vector_3by1(a * v.a + b * v.b + c * v.c, | 364 return CFX_Vector_3by1(a * v.a + b * v.b + c * v.c, |
365 d * v.a + e * v.b + f * v.c, | 365 d * v.a + e * v.b + f * v.c, |
366 g * v.a + h * v.b + i * v.c); | 366 g * v.a + h * v.b + i * v.c); |
367 } | 367 } |
OLD | NEW |