[vlc-commits] win32: added support of background color changing

Sergey Radionov git at videolan.org
Sat Jan 21 23:12:16 CET 2012


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Sat Jan 14 22:54:21 2012 +0700| [066e1f5fa7e6683140d5d1de6141c15b685f73ea] | committer: Cheng Sun

win32: added support of background color changing

Modified-by: Cheng Sun <chengsun9 at gmail.com>
Signed-off-by: Cheng Sun <chengsun9 at gmail.com>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=066e1f5fa7e6683140d5d1de6141c15b685f73ea
---

 common/win32_fullscreen.cpp |   12 +++++++++++-
 common/win32_fullscreen.h   |    3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/common/win32_fullscreen.cpp b/common/win32_fullscreen.cpp
index 0943849..24bbdf3 100644
--- a/common/win32_fullscreen.cpp
+++ b/common/win32_fullscreen.cpp
@@ -607,6 +607,10 @@ VLCHolderWnd::CreateHolderWindow(HINSTANCE hInstance,
 
 VLCHolderWnd::~VLCHolderWnd()
 {
+    if(_hBgBrush) {
+        DeleteObject(_hBgBrush);
+        _hBgBrush = 0;
+    }
 }
 
 bool VLCHolderWnd::Create(HWND hWndParent)
@@ -618,7 +622,13 @@ bool VLCHolderWnd::Create(HWND hWndParent)
 
 void VLCHolderWnd::PreRegisterWindowClass(WNDCLASS* wc)
 {
-    wc->hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
+    if( !_hBgBrush){
+        BYTE r = 0, g = 0, b = 0;
+        HtmlColor2RGB(PO()->get_bg_color(), &r, &g, &b);
+        _hBgBrush = CreateSolidBrush(RGB(r, g, b));
+    }
+
+    wc->hbrBackground = _hBgBrush;
     wc->lpszClassName = TEXT("Web Plugin VLC Window Holder Class");
 }
 
diff --git a/common/win32_fullscreen.h b/common/win32_fullscreen.h
index 0024d1a..ea41231 100644
--- a/common/win32_fullscreen.h
+++ b/common/win32_fullscreen.h
@@ -145,7 +145,7 @@ public:
 protected:
     VLCHolderWnd(HINSTANCE hInstance, VLCWindowsManager* WM)
         : VLCWnd(hInstance), _hMouseHook(NULL), _MouseHookThreadId(0),
-         _wm(WM), _CtrlsWnd(0) {};
+         _wm(WM), _CtrlsWnd(0), _hBgBrush(0) {};
     bool Create(HWND hWndParent);
 
     virtual void PreRegisterWindowClass(WNDCLASS* wc);
@@ -184,6 +184,7 @@ private:
 
 private:
     VLCWindowsManager* _wm;
+    HBRUSH _hBgBrush;
     VLCControlsWnd*    _CtrlsWnd;
 };
 



More information about the vlc-commits mailing list