UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DrawElementCoreTypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Stats/Stats.h"
7#include "SlateGlobals.h"
8
13struct FSlateBoxElement;
14struct FSlateBoxElement; // ET_DebugQuad
21struct FSlateBoxElement; // ET_Border
27
30
58
59#if STATS
60
62{
63 static void MemoryAllocated(int32 SizeBytes)
64 {
66 }
67
68 static void MemoryFreed(int32 SizeBytes)
69 {
71 }
72};
73
75{
76 static void MemoryAllocated(int32 SizeBytes)
77 {
79 }
80
81 static void MemoryFreed(int32 SizeBytes)
82 {
84 }
85};
86
87template<typename StatTracker>
89{
90public:
91 typedef FDefaultAllocator Super;
92
93 class ForAnyElementType : public FDefaultAllocator::ForAnyElementType
94 {
95 public:
97
98 ForAnyElementType()
99 : AllocatedSize(0)
100 {
101
102 }
103
109 inline void MoveToEmpty(ForAnyElementType& Other)
110 {
111 Super::MoveToEmpty(Other);
112
113 AllocatedSize = Other.AllocatedSize;
114 Other.AllocatedSize = 0;
115 }
116
118 ~ForAnyElementType()
119 {
120 if (AllocatedSize)
121 {
122 StatTracker::MemoryFreed(AllocatedSize);
123 }
124 }
125
126 void ResizeAllocation(int32 PreviousNumElements, int32 NumElements, int32 NumBytesPerElement)
127 {
128 const int32 NewSize = NumElements * NumBytesPerElement;
129 StatTracker::MemoryAllocated(NewSize - AllocatedSize);
130
131 AllocatedSize = NewSize;
132
133 Super::ResizeAllocation(PreviousNumElements, NumElements, NumBytesPerElement);
134 }
135
136 private:
137 ForAnyElementType(const ForAnyElementType&);
138 ForAnyElementType& operator=(const ForAnyElementType&);
139 private:
140 int32 AllocatedSize;
141 };
142};
143
144template <typename T>
145struct TAllocatorTraits<FSlateStatTrackingMemoryAllocator<T>> : TAllocatorTraitsBase<FSlateStatTrackingMemoryAllocator<T>>
146{
148};
149
150#endif // STATS
151
152#if STATS
153
154template <typename DrawElementType>
156
173
174#else
175
176template <typename DrawElementType>
178
195
196#endif // STATS
197
199template<EElementType ElementType>
200using TSlateDrawElement = typename TTupleElement<(uint8)ElementType, FSlateDrawElementMap>::Type::ElementType;
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define DEC_DWORD_STAT_BY(StatId, Amount)
Definition Stats.h:703
#define INC_DWORD_STAT_BY(StatId, Amount)
Definition Stats.h:698
#define DECLARE_MEMORY_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:687
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EElementType
Definition DrawElementCoreTypes.h:35
typename TTupleElement<(uint8) ElementType, FSlateDrawElementMap >::Type::ElementType TSlateDrawElement
Definition DrawElementCoreTypes.h:200
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition DrawElementTypes.h:46
Definition Array.h:670
Definition ContainerAllocationPolicies.h:830
Definition ContainerAllocationPolicies.h:631
Definition DrawElementTypes.h:423
Definition DrawElementTypes.h:688
Definition DrawElementTypes.h:727
Definition DrawElementTypes.h:550
Definition DrawElementTypes.h:616
Definition DrawElementTypes.h:752
Definition DrawElementTypes.h:462
Definition DrawElementTypes.h:512
Definition DrawElementTypes.h:564
Definition DrawElementTypes.h:476
Definition DrawElementTypes.h:671
Definition ContainerAllocationPolicies.h:247
@ IsZeroConstruct
Definition ContainerAllocationPolicies.h:248
Definition ContainerAllocationPolicies.h:256