62{
63 if(bIOFailure || pAvatarDownloaded->m_iImage == -1)
64 {
65 OnFailure.Broadcast(
nullptr, k_EResultFail);
66 RemoveFromRoot();
67 return;
68 }
69
70 uint32 Width, Height;
71 if (SteamUtils()->GetImageSize(pAvatarDownloaded->m_iImage, &Width, &Height) && Width > 0 && Height > 0)
72 {
73
74
75 uint8 *ImageRGBA = new uint8[Width * Height * 4];
76
77 if (SteamUtils()->GetImageRGBA(pAvatarDownloaded->m_iImage, (uint8*)ImageRGBA, 4 * Height * Width * sizeof(char)))
78 {
79 UTexture2D* AvatarTexture = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8);
80 if (AvatarTexture)
81 {
82 UE_LOG(LogTemp,
Error, TEXT(
"Width: %i Height: %i"), Width, Height);
83 void* TextureData = AvatarTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
84
85 FMemory::Memcpy(TextureData, (void*)ImageRGBA, Height * Width * 4);
86 AvatarTexture->PlatformData->Mips[0].BulkData.Unlock();
87 delete[] ImageRGBA;
88 AvatarTexture->NeverStream = true;
89 AvatarTexture->UpdateResource();
90 OnSuccess.Broadcast(AvatarTexture, k_EResultOK);
91 RemoveFromRoot();
92 return;
93 }
94 }
95 }
96 OnFailure.Broadcast(
nullptr, k_EResultFail);
97 RemoveFromRoot();
98}
FResponseGetFriendAvatarDelegate OnSuccess
Definition GetFriendAvatar.h:44