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@gmx.de>
This commit is contained in:
X512 2020-01-10 01:05:56 +09:00 committed by Stephan Aßmus
parent 3d7fbc1a0b
commit 6ab29b9387
2 changed files with 23 additions and 4 deletions

View File

@ -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);

View File

@ -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);