diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2018-06-27 13:03:00 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2018-06-28 18:04:46 +0300 |
commit | 5366ecf5b53757640522f24413cacc00397d3645 (patch) | |
tree | 16c2a3efc9114e0a763ccdb09bf1cb7f570177e8 /qt_tstfrm | |
parent | fa65b1a203134bec37371fe818067f9ae7c821c8 (diff) |
Usage of shaders library
Diffstat (limited to 'qt_tstfrm')
-rw-r--r-- | qt_tstfrm/test_main_loop.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/qt_tstfrm/test_main_loop.cpp b/qt_tstfrm/test_main_loop.cpp index 961a4fff7a..2360cd1221 100644 --- a/qt_tstfrm/test_main_loop.cpp +++ b/qt_tstfrm/test_main_loop.cpp @@ -10,6 +10,7 @@ #include <cstring> #include <memory> +#include <vector> namespace { @@ -33,32 +34,31 @@ private: void RunTestLoop(char const * testName, RenderFunction && fn, bool autoExit) { - auto buf = new char[strlen(testName) + 1]; - MY_SCOPE_GUARD(argvFreeFun, [&buf](){ delete [] buf; }); - strcpy(buf, testName); + std::vector<char> buf(strlen(testName) + 1); + strcpy(buf.data(), testName); + char * raw = buf.data(); int argc = 1; - QApplication app(argc, &buf); + QApplication app(argc, &raw); if (autoExit) QTimer::singleShot(3000, &app, SLOT(quit())); - auto widget = new MyWidget(std::move(fn)); + auto widget = std::make_unique<MyWidget>(std::move(fn)); widget->setWindowTitle(testName); widget->show(); app.exec(); - delete widget; } void RunTestInOpenGLOffscreenEnvironment(char const * testName, bool apiOpenGLES3, TestFunction const & fn) { - auto buf = new char[strlen(testName) + 1]; - MY_SCOPE_GUARD(argvFreeFun, [&buf](){ delete [] buf; }); - strcpy(buf, testName); + std::vector<char> buf(strlen(testName) + 1); + strcpy(buf.data(), testName); + char * raw = buf.data(); int argc = 1; - QApplication app(argc, &buf); + QApplication app(argc, &raw); QSurfaceFormat fmt; fmt.setAlphaBufferSize(8); |