MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / loadFile

Method loadFile

tests/ktxdiff/ktxdiff_main.cpp:176–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174};
175
176void Texture::loadFile() {
177 auto file = std::ifstream(DecodeUTF8Path(filepath).c_str(), std::ios::binary | std::ios::in | std::ios::ate);
178 if (!file)
179 error(EXIT_CODE_ERROR, "ktxdiff error \"{}\": Failed to open file: {}\n", filepath, errnoMessage());
180
181 const auto fileSize = file.tellg();
182 file.seekg(0);
183 if (file.fail())
184 error(EXIT_CODE_ERROR, "ktxdiff error \"{}\": Failed to seek file: {}\n", filepath, errnoMessage());
185
186 rawData.resize(fileSize);
187 file.read(reinterpret_cast<char*>(rawData.data()), fileSize);
188 if (file.fail())
189 error(EXIT_CODE_ERROR, "ktxdiff error \"{}\": Failed to read file: {}\n", filepath, errnoMessage());
190}
191
192void Texture::loadKTX() {
193 KTX_error_code ec = KTX_SUCCESS;

Callers

nothing calls this directly

Calls 7

errorFunction · 0.85
errnoMessageFunction · 0.70
DecodeUTF8PathFunction · 0.50
c_strMethod · 0.45
resizeMethod · 0.45
readMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected