* 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:
parent
cdd7c1fb44
commit
3652a43917
@ -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);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
layer->fParent = NULL;
|
||||
|
||||
|
||||
if (fLastChild == layer)
|
||||
fLastChild = layer->fPreviousSibling;
|
||||
// layer->fNextSibling would be NULL
|
||||
|
||||
|
||||
if (fFirstChild == layer )
|
||||
fFirstChild = layer->fNextSibling;
|
||||
// layer->fPreviousSibling would be NULL
|
||||
@ -265,7 +265,7 @@ ViewLayer::RemoveChild(ViewLayer* layer)
|
||||
// connect child before and after layer
|
||||
if (layer->fPreviousSibling)
|
||||
layer->fPreviousSibling->fNextSibling = layer->fNextSibling;
|
||||
|
||||
|
||||
if (layer->fNextSibling)
|
||||
layer->fNextSibling->fPreviousSibling = layer->fPreviousSibling;
|
||||
|
||||
@ -511,7 +511,7 @@ ViewLayer::_UpdateOverlayView() const
|
||||
BRect destination = fBitmapDestination;
|
||||
ConvertToScreen(&destination);
|
||||
|
||||
overlay->SetView(fBitmapSource, destination);
|
||||
overlay->Configure(fBitmapSource, destination);
|
||||
}
|
||||
|
||||
|
||||
@ -1255,6 +1255,8 @@ ViewLayer::IsHidden() const
|
||||
void
|
||||
ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
||||
{
|
||||
bool wasVisible = fVisible;
|
||||
|
||||
fVisible = parentVisible && !fHidden;
|
||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
||||
child->UpdateVisibleDeep(fVisible);
|
||||
@ -1265,10 +1267,9 @@ ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
||||
if (overlay == NULL)
|
||||
return;
|
||||
|
||||
if (fVisible && !overlay->IsVisible()) {
|
||||
if (fVisible && !wasVisible)
|
||||
_UpdateOverlayView();
|
||||
overlay->Show();
|
||||
} else if (!fVisible && overlay->IsVisible())
|
||||
else if (!fVisible && wasVisible)
|
||||
overlay->Hide();
|
||||
}
|
||||
|
||||
|
@ -866,9 +866,13 @@ AccelerantHWInterface::FreeOverlayBuffer(const overlay_buffer* buffer)
|
||||
|
||||
|
||||
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
|
||||
void
|
||||
AccelerantHWInterface::CopyRegion(const clipping_rect* sortedRectList,
|
||||
@ -897,7 +890,6 @@ AccelerantHWInterface::CopyRegion(const clipping_rect* sortedRectList,
|
||||
{
|
||||
if (fAccScreenBlit && fAccAcquireEngine) {
|
||||
if (fAccAcquireEngine(B_2D_ACCELERATION, 0xff, &fSyncToken, &fEngineToken) >= B_OK) {
|
||||
|
||||
// make sure the blit_params cache is large enough
|
||||
if (fBlitParamsCount < count) {
|
||||
fBlitParamsCount = (count / kDefaultParamsCount + 1) * kDefaultParamsCount;
|
||||
|
@ -65,9 +65,8 @@ public:
|
||||
color_space space);
|
||||
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
||||
|
||||
virtual void ShowOverlay(Overlay* overlay);
|
||||
virtual void ConfigureOverlay(Overlay* overlay);
|
||||
virtual void HideOverlay(Overlay* overlay);
|
||||
virtual void UpdateOverlay(Overlay* overlay);
|
||||
|
||||
// accelerated drawing
|
||||
virtual void CopyRegion(const clipping_rect* sortedRectList,
|
||||
|
@ -336,7 +336,7 @@ HWInterface::FreeOverlayBuffer(const overlay_buffer* buffer)
|
||||
|
||||
|
||||
void
|
||||
HWInterface::ShowOverlay(Overlay* overlay)
|
||||
HWInterface::ConfigureOverlay(Overlay* overlay)
|
||||
{
|
||||
}
|
||||
|
||||
@ -347,12 +347,6 @@ HWInterface::HideOverlay(Overlay* overlay)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HWInterface::UpdateOverlay(Overlay* overlay)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// HideSoftwareCursor
|
||||
bool
|
||||
HWInterface::HideSoftwareCursor(const BRect& area)
|
||||
|
@ -107,9 +107,8 @@ class HWInterface : public MultiLocker {
|
||||
color_space space);
|
||||
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
||||
|
||||
virtual void ShowOverlay(Overlay* overlay);
|
||||
virtual void ConfigureOverlay(Overlay* overlay);
|
||||
virtual void HideOverlay(Overlay* overlay);
|
||||
virtual void UpdateOverlay(Overlay* overlay);
|
||||
|
||||
// frame buffer access (you need to ReadLock!)
|
||||
RenderingBuffer* DrawingBuffer() const;
|
||||
|
@ -20,8 +20,7 @@ Overlay::Overlay(HWInterface& interface)
|
||||
fHWInterface(interface),
|
||||
fOverlayBuffer(NULL),
|
||||
fClientData(NULL),
|
||||
fOverlayToken(NULL),
|
||||
fVisible(false)
|
||||
fOverlayToken(NULL)
|
||||
{
|
||||
fSemaphore = create_sem(1, "overlay lock");
|
||||
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
|
||||
Overlay::Hide()
|
||||
{
|
||||
if (fOverlayToken == NULL)
|
||||
return;
|
||||
|
||||
fVisible = false;
|
||||
fHWInterface.HideOverlay(this);
|
||||
}
|
||||
|
||||
@ -174,10 +158,13 @@ Overlay::SetColorSpace(uint32 colorSpace)
|
||||
|
||||
|
||||
void
|
||||
Overlay::SetView(const BRect& source, const BRect& destination)
|
||||
Overlay::Configure(const BRect& source, const BRect& destination)
|
||||
{
|
||||
if (fOverlayToken == NULL)
|
||||
return;
|
||||
if (fOverlayToken == NULL) {
|
||||
fOverlayToken = fHWInterface.AcquireOverlayChannel();
|
||||
if (fOverlayToken == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
fView.h_start = (uint16)source.left;
|
||||
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.height = (uint16)destination.IntegerHeight() + 1;
|
||||
|
||||
if (fVisible)
|
||||
fHWInterface.UpdateOverlay(this);
|
||||
fHWInterface.ConfigureOverlay(this);
|
||||
}
|
||||
|
||||
|
@ -47,12 +47,7 @@ class Overlay {
|
||||
const RGBColor& Color() const
|
||||
{ return fColor; }
|
||||
|
||||
bool IsVisible() const
|
||||
{ return fVisible; }
|
||||
|
||||
void SetView(const BRect& source, const BRect& destination);
|
||||
|
||||
void Show();
|
||||
void Configure(const BRect& source, const BRect& destination);
|
||||
void Hide();
|
||||
|
||||
private:
|
||||
@ -64,7 +59,6 @@ class Overlay {
|
||||
overlay_window fWindow;
|
||||
sem_id fSemaphore;
|
||||
RGBColor fColor;
|
||||
bool fVisible;
|
||||
};
|
||||
|
||||
#endif // OVERLAY_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user