From 6a74b3d26c660f0f52561f9024c302ad3b699b77 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:03:20 +0200 Subject: [PATCH] optimize videowindow (black bg) --- client/windows/GUIClasses.cpp | 9 +++++++-- client/windows/GUIClasses.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index ea9e7a77f..3832defb1 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -34,6 +34,7 @@ #include "../widgets/TextControls.h" #include "../widgets/ObjectLists.h" #include "../widgets/VideoWidget.h" +#include "../widgets/GraphicalPrimitiveCanvas.h" #include "../render/Canvas.h" #include "../render/IRenderHandler.h" @@ -1618,6 +1619,7 @@ VideoWindow::VideoWindow(VideoPath video, ImagePath rim, bool showBackground, fl if(!rim.empty()) { + setBackground(rim); videoPlayer = std::make_shared(Point(80, 186), video, true, [this](){ exit(false); }); pos = center(Rect(0, 0, 800, 600)); } @@ -1630,8 +1632,11 @@ VideoWindow::VideoWindow(VideoPath video, ImagePath rim, bool showBackground, fl if(showBackground) backgroundAroundWindow = std::make_shared(ImagePath::builtin("DIBOXBCK"), Rect(-pos.x, -pos.y, GH.screenDimensions().x, GH.screenDimensions().y)); - if(!rim.empty()) - setBackground(rim); + if(rim.empty()) + { + blackBackground = std::make_shared(Rect(0, 0, pos.w, pos.h)); + blackBackground->addBox(Point(0, 0), Point(pos.w, pos.h), Colors::BLACK); + } } void VideoWindow::exit(bool skipped) diff --git a/client/windows/GUIClasses.h b/client/windows/GUIClasses.h index 4c7b68a75..5e58ad6d2 100644 --- a/client/windows/GUIClasses.h +++ b/client/windows/GUIClasses.h @@ -44,6 +44,7 @@ class CFilledTexture; class IImage; class VideoWidget; class VideoWidgetOnce; +class GraphicalPrimitiveCanvas; enum class EUserEvent; @@ -506,6 +507,7 @@ class VideoWindow : public CWindowObject { std::shared_ptr videoPlayer; std::shared_ptr backgroundAroundWindow; + std::shared_ptr blackBackground; std::function closeCb;