* Accidently broke overlay (but BerliOS didn't let me commit yesterday :-/), since
ViewLayer::SetViewBitmap() did not show the overlay, only updated it. * Simplified overlay handling a bit, removed Overlay::Show(), and IsVisible(), replaced Update() by Configure(). * Made similar changes in the HWInterface as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17504 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -251,13 +251,13 @@ ViewLayer::RemoveChild(ViewLayer* layer)
|
|||||||
printf("ViewLayer::RemoveChild(%p - %s) - ViewLayer is not child of this (%p) layer!\n", layer, layer ? layer->Name() : NULL, this);
|
printf("ViewLayer::RemoveChild(%p - %s) - ViewLayer is not child of this (%p) layer!\n", layer, layer ? layer->Name() : NULL, this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
layer->fParent = NULL;
|
layer->fParent = NULL;
|
||||||
|
|
||||||
if (fLastChild == layer)
|
if (fLastChild == layer)
|
||||||
fLastChild = layer->fPreviousSibling;
|
fLastChild = layer->fPreviousSibling;
|
||||||
// layer->fNextSibling would be NULL
|
// layer->fNextSibling would be NULL
|
||||||
|
|
||||||
if (fFirstChild == layer )
|
if (fFirstChild == layer )
|
||||||
fFirstChild = layer->fNextSibling;
|
fFirstChild = layer->fNextSibling;
|
||||||
// layer->fPreviousSibling would be NULL
|
// layer->fPreviousSibling would be NULL
|
||||||
@@ -265,7 +265,7 @@ ViewLayer::RemoveChild(ViewLayer* layer)
|
|||||||
// connect child before and after layer
|
// connect child before and after layer
|
||||||
if (layer->fPreviousSibling)
|
if (layer->fPreviousSibling)
|
||||||
layer->fPreviousSibling->fNextSibling = layer->fNextSibling;
|
layer->fPreviousSibling->fNextSibling = layer->fNextSibling;
|
||||||
|
|
||||||
if (layer->fNextSibling)
|
if (layer->fNextSibling)
|
||||||
layer->fNextSibling->fPreviousSibling = layer->fPreviousSibling;
|
layer->fNextSibling->fPreviousSibling = layer->fPreviousSibling;
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ ViewLayer::_UpdateOverlayView() const
|
|||||||
BRect destination = fBitmapDestination;
|
BRect destination = fBitmapDestination;
|
||||||
ConvertToScreen(&destination);
|
ConvertToScreen(&destination);
|
||||||
|
|
||||||
overlay->SetView(fBitmapSource, destination);
|
overlay->Configure(fBitmapSource, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1255,6 +1255,8 @@ ViewLayer::IsHidden() const
|
|||||||
void
|
void
|
||||||
ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
||||||
{
|
{
|
||||||
|
bool wasVisible = fVisible;
|
||||||
|
|
||||||
fVisible = parentVisible && !fHidden;
|
fVisible = parentVisible && !fHidden;
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
||||||
child->UpdateVisibleDeep(fVisible);
|
child->UpdateVisibleDeep(fVisible);
|
||||||
@@ -1265,10 +1267,9 @@ ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
|||||||
if (overlay == NULL)
|
if (overlay == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fVisible && !overlay->IsVisible()) {
|
if (fVisible && !wasVisible)
|
||||||
_UpdateOverlayView();
|
_UpdateOverlayView();
|
||||||
overlay->Show();
|
else if (!fVisible && wasVisible)
|
||||||
} else if (!fVisible && overlay->IsVisible())
|
|
||||||
overlay->Hide();
|
overlay->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -866,9 +866,13 @@ AccelerantHWInterface::FreeOverlayBuffer(const overlay_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccelerantHWInterface::ShowOverlay(Overlay* overlay)
|
AccelerantHWInterface::ConfigureOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
UpdateOverlay(overlay);
|
// TODO: this only needs to be done on mode changes!
|
||||||
|
overlay->SetColorSpace(fDisplayMode.space);
|
||||||
|
|
||||||
|
fAccConfigureOverlay(overlay->OverlayToken(), overlay->OverlayBuffer(),
|
||||||
|
overlay->OverlayWindow(), overlay->OverlayView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -879,17 +883,6 @@ AccelerantHWInterface::HideOverlay(Overlay* overlay)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
AccelerantHWInterface::UpdateOverlay(Overlay* overlay)
|
|
||||||
{
|
|
||||||
// TODO: this only needs to be done on mode changes!
|
|
||||||
overlay->SetColorSpace(fDisplayMode.space);
|
|
||||||
|
|
||||||
fAccConfigureOverlay(overlay->OverlayToken(), overlay->OverlayBuffer(),
|
|
||||||
overlay->OverlayWindow(), overlay->OverlayView());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// CopyRegion
|
// CopyRegion
|
||||||
void
|
void
|
||||||
AccelerantHWInterface::CopyRegion(const clipping_rect* sortedRectList,
|
AccelerantHWInterface::CopyRegion(const clipping_rect* sortedRectList,
|
||||||
@@ -897,7 +890,6 @@ AccelerantHWInterface::CopyRegion(const clipping_rect* sortedRectList,
|
|||||||
{
|
{
|
||||||
if (fAccScreenBlit && fAccAcquireEngine) {
|
if (fAccScreenBlit && fAccAcquireEngine) {
|
||||||
if (fAccAcquireEngine(B_2D_ACCELERATION, 0xff, &fSyncToken, &fEngineToken) >= B_OK) {
|
if (fAccAcquireEngine(B_2D_ACCELERATION, 0xff, &fSyncToken, &fEngineToken) >= B_OK) {
|
||||||
|
|
||||||
// make sure the blit_params cache is large enough
|
// make sure the blit_params cache is large enough
|
||||||
if (fBlitParamsCount < count) {
|
if (fBlitParamsCount < count) {
|
||||||
fBlitParamsCount = (count / kDefaultParamsCount + 1) * kDefaultParamsCount;
|
fBlitParamsCount = (count / kDefaultParamsCount + 1) * kDefaultParamsCount;
|
||||||
|
|||||||
@@ -65,9 +65,8 @@ public:
|
|||||||
color_space space);
|
color_space space);
|
||||||
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
||||||
|
|
||||||
virtual void ShowOverlay(Overlay* overlay);
|
virtual void ConfigureOverlay(Overlay* overlay);
|
||||||
virtual void HideOverlay(Overlay* overlay);
|
virtual void HideOverlay(Overlay* overlay);
|
||||||
virtual void UpdateOverlay(Overlay* overlay);
|
|
||||||
|
|
||||||
// accelerated drawing
|
// accelerated drawing
|
||||||
virtual void CopyRegion(const clipping_rect* sortedRectList,
|
virtual void CopyRegion(const clipping_rect* sortedRectList,
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ HWInterface::FreeOverlayBuffer(const overlay_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HWInterface::ShowOverlay(Overlay* overlay)
|
HWInterface::ConfigureOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,12 +347,6 @@ HWInterface::HideOverlay(Overlay* overlay)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
HWInterface::UpdateOverlay(Overlay* overlay)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// HideSoftwareCursor
|
// HideSoftwareCursor
|
||||||
bool
|
bool
|
||||||
HWInterface::HideSoftwareCursor(const BRect& area)
|
HWInterface::HideSoftwareCursor(const BRect& area)
|
||||||
|
|||||||
@@ -107,9 +107,8 @@ class HWInterface : public MultiLocker {
|
|||||||
color_space space);
|
color_space space);
|
||||||
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
||||||
|
|
||||||
virtual void ShowOverlay(Overlay* overlay);
|
virtual void ConfigureOverlay(Overlay* overlay);
|
||||||
virtual void HideOverlay(Overlay* overlay);
|
virtual void HideOverlay(Overlay* overlay);
|
||||||
virtual void UpdateOverlay(Overlay* overlay);
|
|
||||||
|
|
||||||
// frame buffer access (you need to ReadLock!)
|
// frame buffer access (you need to ReadLock!)
|
||||||
RenderingBuffer* DrawingBuffer() const;
|
RenderingBuffer* DrawingBuffer() const;
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ Overlay::Overlay(HWInterface& interface)
|
|||||||
fHWInterface(interface),
|
fHWInterface(interface),
|
||||||
fOverlayBuffer(NULL),
|
fOverlayBuffer(NULL),
|
||||||
fClientData(NULL),
|
fClientData(NULL),
|
||||||
fOverlayToken(NULL),
|
fOverlayToken(NULL)
|
||||||
fVisible(false)
|
|
||||||
{
|
{
|
||||||
fSemaphore = create_sem(1, "overlay lock");
|
fSemaphore = create_sem(1, "overlay lock");
|
||||||
fColor.SetColor(21, 16, 21, 16);
|
fColor.SetColor(21, 16, 21, 16);
|
||||||
@@ -110,27 +109,12 @@ Overlay::OverlayToken() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Overlay::Show()
|
|
||||||
{
|
|
||||||
if (fOverlayToken == NULL) {
|
|
||||||
fOverlayToken = fHWInterface.AcquireOverlayChannel();
|
|
||||||
if (fOverlayToken == NULL)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fVisible = true;
|
|
||||||
fHWInterface.ShowOverlay(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Overlay::Hide()
|
Overlay::Hide()
|
||||||
{
|
{
|
||||||
if (fOverlayToken == NULL)
|
if (fOverlayToken == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fVisible = false;
|
|
||||||
fHWInterface.HideOverlay(this);
|
fHWInterface.HideOverlay(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,10 +158,13 @@ Overlay::SetColorSpace(uint32 colorSpace)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Overlay::SetView(const BRect& source, const BRect& destination)
|
Overlay::Configure(const BRect& source, const BRect& destination)
|
||||||
{
|
{
|
||||||
if (fOverlayToken == NULL)
|
if (fOverlayToken == NULL) {
|
||||||
return;
|
fOverlayToken = fHWInterface.AcquireOverlayChannel();
|
||||||
|
if (fOverlayToken == NULL)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fView.h_start = (uint16)source.left;
|
fView.h_start = (uint16)source.left;
|
||||||
fView.v_start = (uint16)source.top;
|
fView.v_start = (uint16)source.top;
|
||||||
@@ -189,7 +176,6 @@ Overlay::SetView(const BRect& source, const BRect& destination)
|
|||||||
fWindow.width = (uint16)destination.IntegerWidth() + 1;
|
fWindow.width = (uint16)destination.IntegerWidth() + 1;
|
||||||
fWindow.height = (uint16)destination.IntegerHeight() + 1;
|
fWindow.height = (uint16)destination.IntegerHeight() + 1;
|
||||||
|
|
||||||
if (fVisible)
|
fHWInterface.ConfigureOverlay(this);
|
||||||
fHWInterface.UpdateOverlay(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,12 +47,7 @@ class Overlay {
|
|||||||
const RGBColor& Color() const
|
const RGBColor& Color() const
|
||||||
{ return fColor; }
|
{ return fColor; }
|
||||||
|
|
||||||
bool IsVisible() const
|
void Configure(const BRect& source, const BRect& destination);
|
||||||
{ return fVisible; }
|
|
||||||
|
|
||||||
void SetView(const BRect& source, const BRect& destination);
|
|
||||||
|
|
||||||
void Show();
|
|
||||||
void Hide();
|
void Hide();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -64,7 +59,6 @@ class Overlay {
|
|||||||
overlay_window fWindow;
|
overlay_window fWindow;
|
||||||
sem_id fSemaphore;
|
sem_id fSemaphore;
|
||||||
RGBColor fColor;
|
RGBColor fColor;
|
||||||
bool fVisible;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OVERLAY_H
|
#endif // OVERLAY_H
|
||||||
|
|||||||
Reference in New Issue
Block a user