MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / loadGpuImage

Function loadGpuImage

TheForceEngine/TFE_Editor/editor.cpp:1280–1308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1278 }
1279
1280 TextureGpu* loadGpuImage(const char* path)
1281 {
1282 std::map<std::string, TextureGpu*>::iterator iImage = s_gpuImages.find(path);
1283 if (iImage != s_gpuImages.end())
1284 {
1285 return iImage->second;
1286 }
1287
1288 char imagePath[TFE_MAX_PATH];
1289 strcpy(imagePath, path);
1290 if (!TFE_Paths::mapSystemPath(imagePath))
1291 {
1292 memset(imagePath, 0, TFE_MAX_PATH);
1293 TFE_Paths::appendPath(TFE_PathType::PATH_PROGRAM, path, imagePath, TFE_MAX_PATH);
1294 FileUtil::fixupPath(imagePath);
1295 }
1296
1297 TextureGpu* gpuImage = nullptr;
1298 SDL_Surface* image = TFE_Image::get(imagePath);
1299 if (image)
1300 {
1301 gpuImage = TFE_RenderBackend::createTexture(image->w, image->h, (u32*)image->pixels, MAG_FILTER_LINEAR);
1302 if (gpuImage)
1303 {
1304 s_gpuImages[path] = gpuImage;
1305 }
1306 }
1307 return gpuImage;
1308 }
1309
1310 void editor_clearUid()
1311 {

Callers 4

loadIconsFunction · 0.70
browserLoadIconsFunction · 0.50
initFunction · 0.50
loadSingleEntityDataFunction · 0.50

Calls 6

mapSystemPathFunction · 0.50
appendPathFunction · 0.50
fixupPathFunction · 0.50
getFunction · 0.50
createTextureFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected