diff --git a/src/servers/app/ServerBitmap.h b/src/servers/app/ServerBitmap.h index 4df7cba67f..ee2a527374 100644 --- a/src/servers/app/ServerBitmap.h +++ b/src/servers/app/ServerBitmap.h @@ -67,7 +67,7 @@ class ServerBitmap { uint32 AreaOffset() const; void SetOverlay(::Overlay* cookie); - ::Overlay* Overlay() const; + ::Overlay* Overlay() const; //! Does a shallow copy of the bitmap passed to it inline void ShallowCopy(const ServerBitmap *from); diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 85d0e3817e..4c4c8f7c67 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -1514,13 +1514,23 @@ ServerWindow::_DispatchViewMessage(int32 code, if (status == B_OK) { ServerBitmap* bitmap = fServerApp->FindBitmap(bitmapToken); if (bitmapToken == -1 || bitmap != NULL) { + bool wasOverlay = fCurrentLayer->ViewBitmap() != NULL + && fCurrentLayer->ViewBitmap()->Overlay() != NULL; + // TODO: this is a race condition: the bitmap could have been // deleted in the mean time!! fCurrentLayer->SetViewBitmap(bitmap, srcRect, dstRect, resizingMode, options); - BRegion dirty(fCurrentLayer->Bounds()); - fWindowLayer->InvalidateView(fCurrentLayer, dirty); + // TODO: if we revert the view color overlay handling + // in ViewLayer::Draw() to the R5 version, we never + // need to invalidate the view for overlays. + + // invalidate view - but only if this is a non-overlay switch + if (bitmap == NULL || bitmap->Overlay() == NULL || !wasOverlay) { + BRegion dirty(fCurrentLayer->Bounds()); + fWindowLayer->InvalidateView(fCurrentLayer, dirty); + } if (bitmap != NULL && bitmap->Overlay() != NULL) colorKey = bitmap->Overlay()->Color().GetColor32(); diff --git a/src/servers/app/ViewLayer.h b/src/servers/app/ViewLayer.h index e17f194d26..3e3a7080c6 100644 --- a/src/servers/app/ViewLayer.h +++ b/src/servers/app/ViewLayer.h @@ -141,6 +141,9 @@ class ViewLayer { { return fViewColor; } void SetViewColor(const RGBColor& color) { fViewColor = color; } + + ServerBitmap* ViewBitmap() const + { return fViewBitmap; } void SetViewBitmap(ServerBitmap* bitmap, BRect sourceRect, BRect destRect, int32 resizingMode, int32 options);