MCPcopy Create free account
hub / github.com/GRAnimated/MinecraftLCE / LoadTextureData

Method LoadTextureData

src/4JLibraries_Source/NX/Render/TextureUtil.cpp:90–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89static stbi_io_callbacks sCallbacks;
90int TextureUtil::LoadTextureData(const char* fileName, int* x, int* y, int** pixels) {
91 sCallbacks.read = StbiFile::read;
92 sCallbacks.skip = StbiFile::skip;
93 sCallbacks.eof = StbiFile::eof;
94
95 StbiFile file;
96 file.CreateFile(fileName);
97
98 int result;
99 if (file.IsValidFile()) {
100 int channels = 0;
101 unsigned char* data = stbi_load_from_callbacks(&sCallbacks, file.Get(), x, y, &channels, 4);
102 result = ProcessLoadedTextureData(data, x, y, pixels);
103 } else {
104 result = -1;
105 }
106
107 file.CloseFile();
108 return result;
109}
110
111int TextureUtil::LoadTextureData(unsigned char* data, unsigned int len, int* x, int* y, int** pixels) {
112 int channels = 0;

Callers

nothing calls this directly

Calls 5

ProcessLoadedTextureDataFunction · 0.85
CreateFileMethod · 0.80
IsValidFileMethod · 0.80
GetMethod · 0.80
CloseFileMethod · 0.80

Tested by

no test coverage detected