[haiku-commits] haiku: hrev53713 - src/servers/app

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 12 Jan 2020 11:10:32 -0500 (EST)

hrev53713 adds 1 changeset to branch 'master'
old head: 3d7fbc1a0b5e11f729a171b6ac71336b28f78ae4
new head: 6ab29b9387589db1bfa61ee00761aacbc43cd80d
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=6ab29b938758+%5E3d7fbc1a0b5e

----------------------------------------------------------------------------

6ab29b938758: app_server: fix drawing of transparent views
  
  This change makes to draw parent view before current view if current view
  ViewColor is transparent. Views with transparent parts such as BDragger are 
now
  drawing properly without workarounds.
  
  Change-Id: I0450d1f012555137c8e7dd2d08c0c27df39465ff
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/2091
  Reviewed-by: Stephan Aßmus <superstippi@xxxxxx>

                                              [ X512 <danger_mail@xxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53713
Commit:      6ab29b9387589db1bfa61ee00761aacbc43cd80d
URL:         https://git.haiku-os.org/haiku/commit/?id=6ab29b938758
Author:      X512 <danger_mail@xxxxxxx>
Date:        Thu Jan  9 16:05:56 2020 UTC
Committer:   Stephan Aßmus <superstippi@xxxxxx>
Commit-Date: Sun Jan 12 16:10:29 2020 UTC

----------------------------------------------------------------------------

2 files changed, 23 insertions(+), 4 deletions(-)
src/servers/app/View.cpp | 24 ++++++++++++++++++++++--
src/servers/app/View.h   |  3 +--

----------------------------------------------------------------------------

diff --git a/src/servers/app/View.cpp b/src/servers/app/View.cpp
index 554308d475..8964810b19 100644
--- a/src/servers/app/View.cpp
+++ b/src/servers/app/View.cpp
@@ -720,8 +720,10 @@ View::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
                                // include their own dirty regions in 
ParentResized()
                                for (View* child = FirstChild(); child;
                                                child = child->NextSibling()) {
-                                       if (!child->IsVisible())
+                                       if (!child->IsVisible()
+                                               || child->fViewColor == 
B_TRANSPARENT_COLOR) {
                                                continue;
+                                       }
                                        IntRect previousChildVisible(
                                                child->Frame() & oldBounds & 
Bounds());
                                        if 
(dirty->Frame().Intersects(previousChildVisible)) {
@@ -925,6 +927,22 @@ View::CopyBits(IntRect src, IntRect dst, BRegion& 
windowContentClipping)
 // #pragma mark -
 
 
+void
+View::SetViewColor(const rgb_color& color)
+{
+       rgb_color oldColor = fViewColor;
+       fViewColor = color;
+       // Child view with B_TRANSPARENT_COLOR view color change clipping of
+       // parent view.
+       if (fParent != NULL
+               && IsVisible()
+               && ((oldColor == B_TRANSPARENT_COLOR)
+                       != (color == B_TRANSPARENT_COLOR))) {
+               fParent->RebuildClipping(false);
+       }
+}
+
+
 void
 View::ColorUpdated(color_which which, rgb_color color)
 {
@@ -1406,8 +1424,10 @@ View::RebuildClipping(bool deep)
                                return;
 
                        for (; child; child = child->NextSibling()) {
-                               if (child->IsVisible())
+                               if (child->IsVisible()
+                                       && child->fViewColor != 
B_TRANSPARENT_COLOR) {
                                        
childrenRegion->Include((clipping_rect)child->Frame());
+                               }
                        }
 
                        fLocalClipping.Exclude(childrenRegion);
diff --git a/src/servers/app/View.h b/src/servers/app/View.h
index 84e2b3cf16..7c82cfee64 100644
--- a/src/servers/app/View.h
+++ b/src/servers/app/View.h
@@ -135,8 +135,7 @@ public:
 
                        const rgb_color& ViewColor() const
                                                                { return 
fViewColor; }
-                       void                    SetViewColor(const rgb_color& 
color)
-                                                               { fViewColor = 
color; }
+                       void                    SetViewColor(const rgb_color& 
color);
 
                        void                    ColorUpdated(color_which which, 
rgb_color color);
                        void                    SetViewUIColor(color_which 
which, float tint);


Other related posts:

  • » [haiku-commits] haiku: hrev53713 - src/servers/app - Stephan Aßmus