]> git.sesse.net Git - vlc/commitdiff
* all: the vout window now processes refresh events.
authorCyril Deguet <asmax@videolan.org>
Sun, 14 Mar 2004 14:58:11 +0000 (14:58 +0000)
committerCyril Deguet <asmax@videolan.org>
Sun, 14 Mar 2004 14:58:11 +0000 (14:58 +0000)
    It only displays a black rectangle at the moment but it could be
    any bitmap

modules/gui/skins2/src/generic_window.cpp
modules/gui/skins2/src/generic_window.hpp
modules/gui/skins2/src/top_window.cpp
modules/gui/skins2/src/top_window.hpp
modules/gui/skins2/src/vout_window.cpp
modules/gui/skins2/src/vout_window.hpp

index bd5f0bcda5b9cd8ac29559648fa3c8b620acb587..4e22663b54e1603061e8adb0601d3cb8b81ffad4 100644 (file)
@@ -25,6 +25,7 @@
 #include "generic_window.hpp"
 #include "os_window.hpp"
 #include "os_factory.hpp"
+#include "../events/evt_refresh.hpp"
 
 
 GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
@@ -63,6 +64,14 @@ GenericWindow::~GenericWindow()
 }
 
 
+void GenericWindow::processEvent( EvtRefresh &rEvtRefresh )
+{
+    // Refresh the given area
+    refresh( rEvtRefresh.getXStart(), rEvtRefresh.getYStart(),
+             rEvtRefresh.getWidth(), rEvtRefresh.getHeight() );
+}
+
+
 void GenericWindow::show()
 {
     m_varVisible.set( true );
index e1b5033d62a5ee2108c02dfe8c5f77c83c7be37e..53a9712fa016dbaf5704442a4e9c4397fd16a218 100644 (file)
@@ -54,9 +54,10 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
         virtual void processEvent( EvtMouse &rEvtMouse ) {}
         virtual void processEvent( EvtLeave &rEvtLeave ) {}
         virtual void processEvent( EvtKey &rEvtKey ) {}
-        virtual void processEvent( EvtRefresh &rEvtRefresh ) {}
         virtual void processEvent( EvtScroll &rEvtScroll ) {}
 
+        virtual void processEvent( EvtRefresh &rEvtRefresh );
+
         // Show the window
         virtual void show();
 
index 3624c9c43159b5e97667ab157221afd80f3ab45d..2f5472fe22d4adf8b54ed6d824b986a2129f5142 100644 (file)
@@ -38,7 +38,6 @@
 #include "../events/evt_motion.hpp"
 #include "../events/evt_mouse.hpp"
 #include "../events/evt_key.hpp"
-#include "../events/evt_refresh.hpp"
 #include "../events/evt_special.hpp"
 #include "../events/evt_scroll.hpp"
 #include "../utils/position.hpp"
@@ -232,14 +231,6 @@ void TopWindow::processEvent( EvtKey &rEvtKey )
 }
 
 
-void TopWindow::processEvent( EvtRefresh &rEvtRefresh )
-{
-    // Refresh the given area
-    refresh( rEvtRefresh.getXStart(), rEvtRefresh.getYStart(),
-             rEvtRefresh.getWidth(), rEvtRefresh.getHeight() );
-}
-
-
 void TopWindow::processEvent( EvtScroll &rEvtScroll )
 {
     // Raise the windows
index 8391f4a37ee91497990f98a38555984b440f029f..f85f3d658733d5a70417a09bce0cd3f8c11ce990 100644 (file)
@@ -52,7 +52,6 @@ class TopWindow: public GenericWindow
         virtual void processEvent( EvtMouse &rEvtMouse );
         virtual void processEvent( EvtLeave &rEvtLeave );
         virtual void processEvent( EvtKey &rEvtKey );
-        virtual void processEvent( EvtRefresh &rEvtRefresh );
         virtual void processEvent( EvtScroll &rEvtScroll );
 
         /// Forward an event to a control
index 7af3f7fd26342403f24b6f8402d687cbf9bad16f..d394bb3821a2edbd35da981b405d02583ea0e340 100644 (file)
 
 #include "vout_window.hpp"
 #include "os_factory.hpp"
+#include "os_graphics.hpp"
 #include "os_window.hpp"
 
 
 VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
-                        bool dragDrop, bool playOnDrop, GenericWindow &rParent ):
+                        bool dragDrop, bool playOnDrop,
+                        GenericWindow &rParent ):
     GenericWindow( pIntf, left, top, dragDrop, playOnDrop,
-                   &rParent )
+                   &rParent ), m_pImage( NULL )
 {
 }
 
 
 VoutWindow::~VoutWindow()
 {
+    if( m_pImage )
+    {
+        delete m_pImage;
+    }
     // XXX we should stop the vout before destroying the window!
 }
 
+
+void VoutWindow::resize( int width, int height )
+{
+    // Get the OSFactory
+    OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+
+    // Recreate the image
+    if( m_pImage )
+    {
+        delete m_pImage;
+    }
+    m_pImage = pOsFactory->createOSGraphics( width, height );
+    // Draw a black rectangle
+    m_pImage->fillRect( 0, 0, width, height, 0 );
+
+    // Resize the window
+    GenericWindow::resize( width, height );
+}
+
+
+void VoutWindow::refresh( int left, int top, int width, int height )
+{
+    if( m_pImage )
+    {
+        m_pImage->copyToWindow( *getOSWindow(), left, top, width, height, left,
+                                top );
+    }
+}
index 8f0507ea1cc063f630d808356826ffa42c76160c..04b5274ad92b303e0c16a6d36b714b9c3cd49a91 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "generic_window.hpp"
 
+class OSGraphics;
+
 
 /// Class to handle a video output window
 class VoutWindow: public GenericWindow
@@ -34,6 +36,16 @@ class VoutWindow: public GenericWindow
         VoutWindow( intf_thread_t *pIntf, int xPos, int yPos,
                     bool dragDrop, bool playOnDrop, GenericWindow &rParent );
         virtual ~VoutWindow();
+
+        /// Resize the window
+        virtual void resize( int width, int height );
+
+        /// Refresh an area of the window
+        virtual void refresh( int left, int top, int width, int height );
+
+    private:
+        /// Image when there is no video
+        OSGraphics *m_pImage;
 };
 
 typedef CountedPtr<VoutWindow> VoutWindowPtr;