diff options
Diffstat (limited to 'DOCS')
-rw-r--r-- | DOCS/client_api_examples/qml_direct/main.cpp | 6 | ||||
-rw-r--r-- | DOCS/client_api_examples/qml_direct/main.h | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/DOCS/client_api_examples/qml_direct/main.cpp b/DOCS/client_api_examples/qml_direct/main.cpp index b999d10ff4..03e9f17e84 100644 --- a/DOCS/client_api_examples/qml_direct/main.cpp +++ b/DOCS/client_api_examples/qml_direct/main.cpp @@ -19,7 +19,7 @@ static void *get_proc_address(void *ctx, const char *name) { } MpvRenderer::MpvRenderer(mpv::qt::Handle a_mpv, mpv_opengl_cb_context *a_mpv_gl) - : mpv(a_mpv), mpv_gl(a_mpv_gl), window(0) + : mpv(a_mpv), mpv_gl(a_mpv_gl), window(0), size() { int r = mpv_opengl_cb_init_gl(mpv_gl, NULL, get_proc_address, NULL); if (r < 0) @@ -39,8 +39,7 @@ void MpvRenderer::paint() window->resetOpenGLState(); // Render to the whole window. - QSize s = window->size() * window->devicePixelRatio(); - int vp[4] = {0, 0, s.width(), -s.height()}; + int vp[4] = {0, 0, size.width(), -size.height()}; // This uses 0 as framebuffer, which indicates that mpv will render directly // to the frontbuffer. Note that mpv will always switch framebuffers @@ -107,6 +106,7 @@ void MpvObject::sync() renderer, &MpvRenderer::paint, Qt::DirectConnection); } renderer->window = window(); + renderer->size = window()->size() * window()->devicePixelRatio(); } void MpvObject::cleanup() diff --git a/DOCS/client_api_examples/qml_direct/main.h b/DOCS/client_api_examples/qml_direct/main.h index 90acdeedd2..66fe8c94a5 100644 --- a/DOCS/client_api_examples/qml_direct/main.h +++ b/DOCS/client_api_examples/qml_direct/main.h @@ -13,6 +13,7 @@ class MpvRenderer : public QObject mpv::qt::Handle mpv; mpv_opengl_cb_context *mpv_gl; QQuickWindow *window; + QSize size; friend class MpvObject; public: |