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 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
9 | 9 |
| 10 #include <algorithm> |
| 11 |
10 #include "fx_memory.h" | 12 #include "fx_memory.h" |
11 #include "fx_stream.h" | 13 #include "fx_stream.h" |
12 #include "fx_string.h" | 14 #include "fx_string.h" |
13 #include "fx_system.h" | 15 #include "fx_system.h" |
14 | 16 |
15 // The FX_ArraySize(arr) macro returns the # of elements in an array arr. | 17 // The FX_ArraySize(arr) macro returns the # of elements in an array arr. |
16 // The expression is a compile-time constant, and therefore can be | 18 // The expression is a compile-time constant, and therefore can be |
17 // used in defining new arrays, for example. If you use FX_ArraySize on | 19 // used in defining new arrays, for example. If you use FX_ArraySize on |
18 // a pointer by mistake, you will get a compile-time error. | 20 // a pointer by mistake, you will get a compile-time error. |
19 // | 21 // |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 } | 1091 } |
1090 m_DataLists.RemoveAll(); | 1092 m_DataLists.RemoveAll(); |
1091 m_CurList = 0; | 1093 m_CurList = 0; |
1092 } | 1094 } |
1093 | 1095 |
1094 void Append(int32_t nStart, int32_t nCount) { | 1096 void Append(int32_t nStart, int32_t nCount) { |
1095 if (nStart < 0) { | 1097 if (nStart < 0) { |
1096 return; | 1098 return; |
1097 } | 1099 } |
1098 while (nCount > 0) { | 1100 while (nCount > 0) { |
1099 int32_t temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); | 1101 int32_t temp_count = std::min(nCount, FX_DATALIST_LENGTH); |
1100 DataList list; | 1102 DataList list; |
1101 list.data = FX_Alloc2D(uint8_t, temp_count, unit); | 1103 list.data = FX_Alloc2D(uint8_t, temp_count, unit); |
1102 list.start = nStart; | 1104 list.start = nStart; |
1103 list.count = temp_count; | 1105 list.count = temp_count; |
1104 Append(list); | 1106 Append(list); |
1105 nCount -= temp_count; | 1107 nCount -= temp_count; |
1106 nStart += temp_count; | 1108 nStart += temp_count; |
1107 } | 1109 } |
1108 } | 1110 } |
1109 | 1111 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 FX_FLOAT c; | 1255 FX_FLOAT c; |
1254 FX_FLOAT d; | 1256 FX_FLOAT d; |
1255 FX_FLOAT e; | 1257 FX_FLOAT e; |
1256 FX_FLOAT f; | 1258 FX_FLOAT f; |
1257 FX_FLOAT g; | 1259 FX_FLOAT g; |
1258 FX_FLOAT h; | 1260 FX_FLOAT h; |
1259 FX_FLOAT i; | 1261 FX_FLOAT i; |
1260 }; | 1262 }; |
1261 | 1263 |
1262 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1264 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |