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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 } | 986 } |
985 m_DataLists.RemoveAll(); | 987 m_DataLists.RemoveAll(); |
986 m_CurList = 0; | 988 m_CurList = 0; |
987 } | 989 } |
988 | 990 |
989 void Append(int32_t nStart, int32_t nCount) { | 991 void Append(int32_t nStart, int32_t nCount) { |
990 if (nStart < 0) { | 992 if (nStart < 0) { |
991 return; | 993 return; |
992 } | 994 } |
993 while (nCount > 0) { | 995 while (nCount > 0) { |
994 int32_t temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); | 996 int32_t temp_count = std::min(nCount, FX_DATALIST_LENGTH); |
995 DataList list; | 997 DataList list; |
996 list.data = FX_Alloc2D(uint8_t, temp_count, unit); | 998 list.data = FX_Alloc2D(uint8_t, temp_count, unit); |
997 list.start = nStart; | 999 list.start = nStart; |
998 list.count = temp_count; | 1000 list.count = temp_count; |
999 Append(list); | 1001 Append(list); |
1000 nCount -= temp_count; | 1002 nCount -= temp_count; |
1001 nStart += temp_count; | 1003 nStart += temp_count; |
1002 } | 1004 } |
1003 } | 1005 } |
1004 | 1006 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 FX_FLOAT c; | 1141 FX_FLOAT c; |
1140 FX_FLOAT d; | 1142 FX_FLOAT d; |
1141 FX_FLOAT e; | 1143 FX_FLOAT e; |
1142 FX_FLOAT f; | 1144 FX_FLOAT f; |
1143 FX_FLOAT g; | 1145 FX_FLOAT g; |
1144 FX_FLOAT h; | 1146 FX_FLOAT h; |
1145 FX_FLOAT i; | 1147 FX_FLOAT i; |
1146 }; | 1148 }; |
1147 | 1149 |
1148 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1150 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |