Skip to content

Commit

Permalink
Use a more effective way to toggle video full screen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Feb 1, 2025
1 parent 52a5319 commit 2608ae5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions wiliwili/source/view/mpv_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,18 +707,17 @@ void MPVCore::setFrameSize(brls::Rect r) {
// 在视频暂停时调整纹理尺寸,视频画面会被清空为黑色,强制重新绘制一次,避免这个问题
mpvRenderContextRender(mpv_context, mpv_params);
mpvRenderContextReportSwap(mpv_context);
#elif !defined(MPV_USE_FB)
// Using default framebuffer
#if defined(BOREALIS_USE_GXM)
#elif defined(BOREALIS_USE_GXM)
// This line will be called between beginFrame() and endFrame() in Application::frame(),
// but mpvRenderContextRender(...) will call functions similar to beginFrame() and endFrame() to draw content to FBO,
// and that will cause error in GXM, so call in brls::sync to make the mpv drawing calls outside the brls::Application::frame().
brls::sync([this]() {
mpvRenderContextRender(mpv_context, mpv_params);
mpvRenderContextReportSwap(mpv_context);
});
#elif defined(BOREALIS_USE_D3D11)
#else
#elif !defined(MPV_USE_FB)
// Using default framebuffer
#ifndef BOREALIS_USE_D3D11
this->mpv_fbo.w = brls::Application::windowWidth;
this->mpv_fbo.h = brls::Application::windowHeight;
#endif
Expand Down Expand Up @@ -794,7 +793,7 @@ void MPVCore::draw(brls::Rect area, float alpha) {
#elif defined(BOREALIS_USE_GXM)
auto *vg = brls::Application::getNVGContext();

NVGpaint img = nvgImagePattern(vg, 0, 0, mpv_fbo.w, mpv_fbo.h, 0, nvg_image, alpha);
NVGpaint img = nvgImagePattern(vg, area.getMinX(), area.getMinY(), area.getWidth(), area.getHeight(), 0, nvg_image, alpha);
nvgBeginPath(vg);
nvgRect(vg, area.getMinX(), area.getMinY(), area.getWidth(), area.getHeight());
nvgFillPaint(vg, img);
Expand Down

0 comments on commit 2608ae5

Please sign in to comment.