MCPcopy Create free account
hub / github.com/baldurk/renderdoc / Execute

Method Execute

renderdoccmd/renderdoccmd.cpp:383–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381 }
382
383 virtual int Execute(const CaptureOptions &)
384 {
385 FileType type = FileType::JPG;
386
387 if(format == "png")
388 {
389 type = FileType::PNG;
390 }
391 else if(format == "tga")
392 {
393 type = FileType::TGA;
394 }
395 else if(format == "bmp")
396 {
397 type = FileType::BMP;
398 }
399 else
400 {
401 const char *dot = strrchr(outfile.c_str(), '.');
402
403 if(dot != NULL && strstr(dot, "png"))
404 type = FileType::PNG;
405 else if(dot != NULL && strstr(dot, "tga"))
406 type = FileType::TGA;
407 else if(dot != NULL && strstr(dot, "bmp"))
408 type = FileType::BMP;
409 else if(dot != NULL && strstr(dot, "jpg"))
410 type = FileType::JPG;
411 else
412 std::cerr << "Couldn't guess format from '" << outfile << "', defaulting to jpg."
413 << std::endl;
414 }
415
416 bytebuf buf;
417
418 ICaptureFile *file = RENDERDOC_OpenCaptureFile();
419 ResultDetails st = file->OpenFile(conv(infile), "rdc", NULL);
420 if(st.OK())
421 {
422 buf = file->GetThumbnail(type, maxsize).data;
423 }
424 else
425 {
426 std::cerr << "Couldn't open '" << infile << "': " << st.Message() << std::endl;
427 }
428 file->Shutdown();
429
430 if(buf.empty())
431 {
432 std::cerr << "Couldn't fetch the thumbnail in '" << infile << "'" << std::endl;
433 }
434 else
435 {
436 FILE *f = fopen(outfile.c_str(), "wb");
437
438 if(!f)
439 {
440 std::cerr << "Couldn't open destination file '" << outfile << "'" << std::endl;

Callers

nothing calls this directly

Calls 12

OpenFileMethod · 0.80
convFunction · 0.70
fopenFunction · 0.50
fwriteFunction · 0.50
fcloseFunction · 0.50
c_strMethod · 0.45
GetThumbnailMethod · 0.45
ShutdownMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected