UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SlateVectorGraphicsCache.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
8
11
12//typedef TFunctionRef<TUniquePtr<FSlateTextureAtlas> (int32 AtlasSize, int32 AtlasStride, ESlateTextureAtlasPaddingStyle PaddingStyle)> FCreateAtlasFunction;
13
15{
16public:
18
19 SLATECORE_API FSlateShaderResourceProxy* GetShaderResource(const FSlateBrush& Brush, FVector2f LocalSize, float DrawScale);
20
23
26
27 virtual void RequestFlushCache(const FString& Reason) override;
28
29
30 int32 GetNumAtlasPages() const { return Atlases.Num(); }
31 FSlateShaderResource* GetAtlasPageResource(const int32 InIndex) const { return Atlases[InIndex]->GetAtlasTexture(); }
32 bool IsAtlasPageResourceAlphaOnly(const int32 InIndex) const { return false; }
33 const FSlateTextureAtlas* GetAtlas(const int32 InIndex) const { return Atlases[InIndex].Get(); }
34
35#if WITH_ATLAS_DEBUGGING
37#endif
38
39private:
40 void FlushCache();
41
42private:
43 struct FVectorCacheKey
44 {
45 FName BrushName;
46 FIntPoint PixelSize;
47
48 FVectorCacheKey(FName InBrushName, FVector2f LocalSize, float DrawScale)
49 : BrushName(InBrushName)
50 , PixelSize((LocalSize*DrawScale).IntPoint())
51 {
52 KeyHash = HashCombine(GetTypeHash(BrushName), GetTypeHash(PixelSize));
53 }
54
55 bool operator==(const FVectorCacheKey& Other) const
56 {
57 return BrushName == Other.BrushName
58 && PixelSize == Other.PixelSize;
59 }
60
61 friend inline uint32 GetTypeHash(const FVectorCacheKey& Key)
62 {
63 return Key.KeyHash;
64 }
65
66 private:
67 uint32 KeyHash;
68 };
69
70 struct FRasterRequest
71 {
72 FVectorCacheKey Key;
73 TArray<uint8> PixelData;
74
75 FRasterRequest(FName InBrushName, FVector2f InLocalSize, float InDrawScale)
77 {}
78 };
79
80#if WITH_ATLAS_DEBUGGING
82#endif
87
88 TArray<FRasterRequest> PendingRequests;
89
90 bool bFlushRequested;
91};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr uint32 HashCombine(uint32 A, uint32 C)
Definition TypeHash.h:36
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition NameTypes.h:617
Definition TextureAtlas.h:283
Definition SlateShaderResource.h:129
Definition SlateShaderResource.h:44
Definition TextureAtlas.h:99
Definition SlateVectorGraphicsCache.h:15
SLATECORE_API void UpdateCache()
Definition SlateVectorGraphicsCache.cpp:78
FSlateShaderResource * GetAtlasPageResource(const int32 InIndex) const
Definition SlateVectorGraphicsCache.h:31
SLATECORE_API void DeleteResources()
Definition SlateVectorGraphicsCache.cpp:213
int32 GetNumAtlasPages() const
Definition SlateVectorGraphicsCache.h:30
const FSlateTextureAtlas * GetAtlas(const int32 InIndex) const
Definition SlateVectorGraphicsCache.h:33
SLATECORE_API FSlateShaderResourceProxy * GetShaderResource(const FSlateBrush &Brush, FVector2f LocalSize, float DrawScale)
Definition SlateVectorGraphicsCache.cpp:45
SLATECORE_API void ReleaseResources(bool bWaitForRelease=false)
Definition SlateVectorGraphicsCache.cpp:208
bool IsAtlasPageResourceAlphaOnly(const int32 InIndex) const
Definition SlateVectorGraphicsCache.h:32
SLATECORE_API void ConditionalFlushCache()
Definition SlateVectorGraphicsCache.cpp:177
virtual void RequestFlushCache(const FString &Reason) override
Definition SlateVectorGraphicsCache.cpp:186
Definition TextureAtlas.h:262
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
uint32 GetTypeHash(const FKey &Key)
Definition BlackboardKey.h:35
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501
Definition TextureAtlas.h:72
Definition SlateBrush.h:239
Definition IntPoint.h:25