Chromium Code Reviews| 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 XFA_FGAS_CRT_FGAS_UTILS_H_ | 7 #ifndef XFA_FGAS_CRT_FGAS_UTILS_H_ |
| 8 #define XFA_FGAS_CRT_FGAS_UTILS_H_ | 8 #define XFA_FGAS_CRT_FGAS_UTILS_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/include/fx_coordinates.h" | 10 #include "core/fxcrt/include/fx_coordinates.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 int32_t iCount = -1) { | 73 int32_t iCount = -1) { |
| 74 return CFX_BaseArray::Copy(src, iStart, iCount); | 74 return CFX_BaseArray::Copy(src, iStart, iCount); |
| 75 } | 75 } |
| 76 int32_t RemoveLast(int32_t iCount = -1) { | 76 int32_t RemoveLast(int32_t iCount = -1) { |
| 77 return CFX_BaseArray::RemoveLast(iCount); | 77 return CFX_BaseArray::RemoveLast(iCount); |
| 78 } | 78 } |
| 79 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { | 79 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { |
| 80 CFX_BaseArray::RemoveAll(bLeaveMemory); | 80 CFX_BaseArray::RemoveAll(bLeaveMemory); |
| 81 } | 81 } |
| 82 }; | 82 }; |
| 83 typedef CFX_BaseArrayTemplate<void*> CFDE_PtrArray; | |
| 84 typedef CFX_BaseArrayTemplate<uint32_t> CFDE_DWordArray; | 83 typedef CFX_BaseArrayTemplate<uint32_t> CFDE_DWordArray; |
|
Tom Sepez
2016/05/19 16:20:53
This is only used in one place in fde_csscache.h,
| |
| 85 typedef CFX_BaseArrayTemplate<uint16_t> CFDE_WordArray; | |
| 86 | 84 |
| 87 template <class baseType> | 85 template <class baseType> |
| 88 class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray { | 86 class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray { |
| 89 public: | 87 public: |
| 90 CFX_ObjectBaseArrayTemplate(int32_t iGrowSize = 100) | 88 CFX_ObjectBaseArrayTemplate(int32_t iGrowSize = 100) |
| 91 : CFX_BaseArray(iGrowSize, sizeof(baseType)) {} | 89 : CFX_BaseArray(iGrowSize, sizeof(baseType)) {} |
| 92 ~CFX_ObjectBaseArrayTemplate() { RemoveAll(FALSE); } | 90 ~CFX_ObjectBaseArrayTemplate() { RemoveAll(FALSE); } |
| 93 int32_t GetSize() const { return CFX_BaseArray::GetSize(); } | 91 int32_t GetSize() const { return CFX_BaseArray::GetSize(); } |
| 94 int32_t GetBlockSize() const { return CFX_BaseArray::GetBlockSize(); } | 92 int32_t GetBlockSize() const { return CFX_BaseArray::GetBlockSize(); } |
| 95 int32_t Add(const baseType& element) { | 93 int32_t Add(const baseType& element) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 int32_t iCount = -1) { | 268 int32_t iCount = -1) { |
| 271 return CFX_BaseMassArray::Copy(src, iStart, iCount); | 269 return CFX_BaseMassArray::Copy(src, iStart, iCount); |
| 272 } | 270 } |
| 273 int32_t RemoveLast(int32_t iCount = -1) { | 271 int32_t RemoveLast(int32_t iCount = -1) { |
| 274 return CFX_BaseMassArray::RemoveLast(iCount); | 272 return CFX_BaseMassArray::RemoveLast(iCount); |
| 275 } | 273 } |
| 276 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { | 274 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { |
| 277 CFX_BaseMassArray::RemoveAll(bLeaveMemory); | 275 CFX_BaseMassArray::RemoveAll(bLeaveMemory); |
| 278 } | 276 } |
| 279 }; | 277 }; |
| 280 typedef CFX_MassArrayTemplate<void*> CFX_PtrMassArray; | |
| 281 typedef CFX_MassArrayTemplate<int32_t> CFX_Int32MassArray; | |
| 282 typedef CFX_MassArrayTemplate<uint32_t> CFX_DWordMassArray; | |
| 283 typedef CFX_MassArrayTemplate<uint16_t> CFX_WordMassArray; | |
| 284 typedef CFX_MassArrayTemplate<CFX_Rect> CFX_RectMassArray; | 278 typedef CFX_MassArrayTemplate<CFX_Rect> CFX_RectMassArray; |
|
Tom Sepez
2016/05/19 16:20:53
Ditto here, two usages, remove typedef and use ful
| |
| 285 typedef CFX_MassArrayTemplate<CFX_RectF> CFX_RectFMassArray; | |
| 286 | 279 |
| 287 template <class baseType> | 280 template <class baseType> |
| 288 class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { | 281 class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { |
| 289 public: | 282 public: |
| 290 CFX_ObjectMassArrayTemplate(int32_t iChunkSize = 100) | 283 CFX_ObjectMassArrayTemplate(int32_t iChunkSize = 100) |
| 291 : CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {} | 284 : CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {} |
| 292 ~CFX_ObjectMassArrayTemplate() { RemoveAll(FALSE); } | 285 ~CFX_ObjectMassArrayTemplate() { RemoveAll(FALSE); } |
| 293 int32_t GetSize() const { return CFX_BaseMassArray::GetSize(); } | 286 int32_t GetSize() const { return CFX_BaseMassArray::GetSize(); } |
| 294 int32_t Add(const baseType& element) { | 287 int32_t Add(const baseType& element) { |
| 295 int32_t index = CFX_BaseMassArray::GetSize(); | 288 int32_t index = CFX_BaseMassArray::GetSize(); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 } | 480 } |
| 488 RemoveAll(TRUE); | 481 RemoveAll(TRUE); |
| 489 for (int32_t i = iStart; i < iEnd; i++) { | 482 for (int32_t i = iStart; i < iEnd; i++) { |
| 490 Push(*src.GetAt(i)); | 483 Push(*src.GetAt(i)); |
| 491 } | 484 } |
| 492 return CFX_BaseStack::GetSize(); | 485 return CFX_BaseStack::GetSize(); |
| 493 } | 486 } |
| 494 }; | 487 }; |
| 495 | 488 |
| 496 #endif // XFA_FGAS_CRT_FGAS_UTILS_H_ | 489 #endif // XFA_FGAS_CRT_FGAS_UTILS_H_ |
| OLD | NEW |