[haiku-commits] r42493 - in haiku/trunk/src/servers/app: . decorator

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 26 Jul 2011 07:53:36 +0200 (CEST)

Author: czeidler
Date: 2011-07-26 07:53:35 +0200 (Tue, 26 Jul 2011)
New Revision: 42493
Changeset: https://dev.haiku-os.org/changeset/42493

Modified:
   haiku/trunk/src/servers/app/Window.cpp
   haiku/trunk/src/servers/app/decorator/Decorator.cpp
   haiku/trunk/src/servers/app/decorator/Decorator.h
   haiku/trunk/src/servers/app/decorator/DefaultDecorator.cpp
   haiku/trunk/src/servers/app/decorator/DefaultDecorator.h
Log:
* Draw the complete decorator off screen and copy it to the front when 
finished. Stippi please take a look. This fixes some flickering when drawing 
shifted tabs in stack mode. In stack mode the different tabs sometime repaint 
each other, thus the decorator has to been drawn double buffered to avoid 
artefacts.
* Add an option to draw the button directly, i.e. when they are clicked.



Modified: haiku/trunk/src/servers/app/Window.cpp
===================================================================
--- haiku/trunk/src/servers/app/Window.cpp      2011-07-26 04:37:27 UTC (rev 
42492)
+++ haiku/trunk/src/servers/app/Window.cpp      2011-07-26 05:53:35 UTC (rev 
42493)
@@ -1761,11 +1761,12 @@
        if (dirtyBorderRegion->CountRects() > 0 && 
engine->LockParallelAccess()) {
                engine->ConstrainClippingRegion(dirtyBorderRegion);
                bool copyToFrontEnabled = engine->CopyToFrontEnabled();
-               engine->SetCopyToFrontEnabled(true);
+               engine->SetCopyToFrontEnabled(false);
 
                decorator->Draw(dirtyBorderRegion->Frame());
 
                engine->SetCopyToFrontEnabled(copyToFrontEnabled);
+               engine->CopyToFront(*dirtyBorderRegion);
 
 // TODO: remove this once the DrawState stuff is handled
 // more cleanly. The reason why this is needed is that

Modified: haiku/trunk/src/servers/app/decorator/Decorator.cpp
===================================================================
--- haiku/trunk/src/servers/app/decorator/Decorator.cpp 2011-07-26 04:37:27 UTC 
(rev 42492)
+++ haiku/trunk/src/servers/app/decorator/Decorator.cpp 2011-07-26 05:53:35 UTC 
(rev 42493)
@@ -651,10 +651,10 @@
                return;
 
        _DrawTab(tab, tab->tabRect);
-       _DrawZoom(tab, tab->zoomRect);
-       _DrawMinimize(tab, tab->minimizeRect);
+       _DrawZoom(tab, false, tab->zoomRect);
+       _DrawMinimize(tab, false, tab->minimizeRect);
        _DrawTitle(tab, tab->tabRect);
-       _DrawClose(tab, tab->closeRect);
+       _DrawClose(tab, false, tab->closeRect);
 }
 
 
@@ -665,7 +665,7 @@
        Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
        if (decoratorTab == NULL)
                return;
-       _DrawClose(decoratorTab, decoratorTab->closeRect);
+       _DrawClose(decoratorTab, true, decoratorTab->closeRect);
 }
 
 
@@ -698,7 +698,7 @@
        Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
        if (decoratorTab == NULL)
                return;
-       _DrawZoom(decoratorTab, decoratorTab->zoomRect);
+       _DrawZoom(decoratorTab, true, decoratorTab->zoomRect);
 }
 
 
@@ -779,7 +779,7 @@
        \param rect Area of the button to update
 */
 void
-Decorator::_DrawClose(Decorator::Tab* tab, BRect rect)
+Decorator::_DrawClose(Decorator::Tab* tab, bool direct, BRect rect)
 {
 }
 
@@ -807,7 +807,7 @@
        \param rect Area of the button to update
 */
 void
-Decorator::_DrawZoom(Decorator::Tab* tab, BRect rect)
+Decorator::_DrawZoom(Decorator::Tab* tab, bool direct, BRect rect)
 {
 }
 
@@ -820,7 +820,7 @@
        \param rect Area of the button to update
 */
 void
-Decorator::_DrawMinimize(Decorator::Tab* tab, BRect rect)
+Decorator::_DrawMinimize(Decorator::Tab* tab, bool direct, BRect rect)
 {
 }
 

Modified: haiku/trunk/src/servers/app/decorator/Decorator.h
===================================================================
--- haiku/trunk/src/servers/app/decorator/Decorator.h   2011-07-26 04:37:27 UTC 
(rev 42492)
+++ haiku/trunk/src/servers/app/decorator/Decorator.h   2011-07-26 05:53:35 UTC 
(rev 42493)
@@ -173,10 +173,14 @@
 
        virtual void                    _DrawTabs(BRect rect);
        virtual void                    _DrawTab(Decorator::Tab* tab, BRect 
rect);
-       virtual void                    _DrawClose(Decorator::Tab* tab, BRect 
rect);
        virtual void                    _DrawTitle(Decorator::Tab* tab, BRect 
rect);
-       virtual void                    _DrawZoom(Decorator::Tab* tab, BRect 
rect);
-       virtual void                    _DrawMinimize(Decorator::Tab* tab, 
BRect rect);
+       //! direct means drawing without double buffering
+       virtual void                    _DrawClose(Decorator::Tab* tab, bool 
direct,
+                                                               BRect rect);
+       virtual void                    _DrawZoom(Decorator::Tab* tab, bool 
direct,
+                                                               BRect rect);
+       virtual void                    _DrawMinimize(Decorator::Tab* tab, bool 
direct,
+                                                               BRect rect);
 
        virtual Decorator::Tab* _AllocateNewTab() = 0;
 

Modified: haiku/trunk/src/servers/app/decorator/DefaultDecorator.cpp
===================================================================
--- haiku/trunk/src/servers/app/decorator/DefaultDecorator.cpp  2011-07-26 
04:37:27 UTC (rev 42492)
+++ haiku/trunk/src/servers/app/decorator/DefaultDecorator.cpp  2011-07-26 
05:53:35 UTC (rev 42493)
@@ -952,7 +952,7 @@
 
 
 void
-DefaultDecorator::_DrawClose(Decorator::Tab* _tab, BRect rect)
+DefaultDecorator::_DrawClose(Decorator::Tab* _tab, bool direct, BRect rect)
 {
        STRACE(("_DrawClose(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right,
                rect.bottom));
@@ -967,7 +967,7 @@
                tab->closeBitmaps[index] = bitmap;
        }
 
-       _DrawButtonBitmap(bitmap, rect);
+       _DrawButtonBitmap(bitmap, direct, rect);
 }
 
 
@@ -1016,7 +1016,7 @@
 
 
 void
-DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, BRect rect)
+DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, bool direct, BRect rect)
 {
        STRACE(("_DrawZoom(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right,
                rect.bottom));
@@ -1032,7 +1032,7 @@
                tab->zoomBitmaps[index] = bitmap;
        }
 
-       _DrawButtonBitmap(bitmap, rect);
+       _DrawButtonBitmap(bitmap, direct, rect);
 }
 
 
@@ -1397,7 +1397,7 @@
 
 
 bool
-DefaultDecorator::_RemoveTab(int32 index, BRegion* updateRegion )
+DefaultDecorator::_RemoveTab(int32 index, BRegion* updateRegion)
 {
        BRect oldTitle = fTitleBarRect;
        _DoLayout();
@@ -1475,9 +1475,9 @@
 {
        // Draw the buttons if we're supposed to
        if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect))
-               _DrawClose(tab, tab->closeRect);
+               _DrawClose(tab, false, tab->closeRect);
        if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect))
-               _DrawZoom(tab, tab->zoomRect);
+               _DrawZoom(tab, false, tab->zoomRect);
 }
 
 
@@ -1574,13 +1574,14 @@
 
 
 void
-DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect)
+DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, bool direct,
+       BRect rect)
 {
        if (bitmap == NULL)
                return;
 
        bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled();
-       fDrawingEngine->SetCopyToFrontEnabled(true);
+       fDrawingEngine->SetCopyToFrontEnabled(direct);
        drawing_mode oldMode;
        fDrawingEngine->SetDrawingMode(B_OP_OVER, oldMode);
        fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect);

Modified: haiku/trunk/src/servers/app/decorator/DefaultDecorator.h
===================================================================
--- haiku/trunk/src/servers/app/decorator/DefaultDecorator.h    2011-07-26 
04:37:27 UTC (rev 42492)
+++ haiku/trunk/src/servers/app/decorator/DefaultDecorator.h    2011-07-26 
05:53:35 UTC (rev 42493)
@@ -113,11 +113,14 @@
        virtual void                            _DrawFrame(BRect r);
        virtual void                            _DrawTab(Decorator::Tab* tab, 
BRect r);
 
-       virtual void                            _DrawClose(Decorator::Tab* tab, 
BRect r);
+       virtual void                            _DrawClose(Decorator::Tab* tab, 
bool direct,
+                                                                       BRect 
r);
        virtual void                            _DrawTitle(Decorator::Tab* tab, 
BRect r);
-       virtual void                            _DrawZoom(Decorator::Tab* tab, 
BRect r);
+       virtual void                            _DrawZoom(Decorator::Tab* tab, 
bool direct,
+                                                                       BRect 
r);
 
-       virtual void                            _SetTitle(Decorator::Tab* tab, 
const char* string,
+       virtual void                            _SetTitle(Decorator::Tab* tab,
+                                                                       const 
char* string,
                                                                        
BRegion* updateRegion = NULL);
        virtual void                            _SetFocus(Decorator::Tab* tab);
 
@@ -162,7 +165,7 @@
 private:
                        void                            
_UpdateFont(DesktopSettings& settings);
                        void                            
_DrawButtonBitmap(ServerBitmap* bitmap,
-                                                                       BRect 
rect);
+                                                                       bool 
direct, BRect rect);
                        void                            
_DrawBlendedRect(DrawingEngine *engine,
                                                                        BRect 
rect, bool down,
                                                                        const 
ComponentColors& colors);


Other related posts:

  • » [haiku-commits] r42493 - in haiku/trunk/src/servers/app: . decorator - clemens . zeidler