MCPcopy Create free account
hub / github.com/ddnet/ddnet / LoadFile

Method LoadFile

src/game/client/components/community_icons.cpp:68–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68bool CCommunityIcons::LoadFile(const char *pPath, int DirType, CImageInfo &Info, CImageInfo &InfoGrayscale, SHA256_DIGEST &Sha256)
69{
70 if(!Graphics()->LoadPng(Info, pPath, DirType))
71 {
72 log_error("menus/browser", "Failed to load community icon from '%s'", pPath);
73 return false;
74 }
75 if(Info.m_Format != CImageInfo::FORMAT_RGBA)
76 {
77 Info.Free();
78 log_error("menus/browser", "Failed to load community icon from '%s': must be an RGBA image", pPath);
79 return false;
80 }
81 if(!Storage()->CalculateHashes(pPath, DirType, &Sha256))
82 {
83 Info.Free();
84 log_error("menus/browser", "Failed to load community icon from '%s': could not calculate hash", pPath);
85 return false;
86 }
87 InfoGrayscale = Info.DeepCopy();
88 ConvertToGrayscale(InfoGrayscale);
89 return true;
90}
91
92void CCommunityIcons::LoadFinish(const char *pCommunityId, CImageInfo &Info, CImageInfo &InfoGrayscale, const SHA256_DIGEST &Sha256)
93{

Callers 1

RunMethod · 0.80

Calls 7

GraphicsFunction · 0.85
StorageFunction · 0.85
ConvertToGrayscaleFunction · 0.85
CalculateHashesMethod · 0.80
DeepCopyMethod · 0.80
LoadPngMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected