* Some refactoring: renamed OverlayCookie to Overlay and put it in its own
source file. * An overlay is now also hidden in case its is removed from the window. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17209 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "ClientMemoryAllocator.h"
|
#include "ClientMemoryAllocator.h"
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
#include "Overlay.h"
|
||||||
#include "ServerBitmap.h"
|
#include "ServerBitmap.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
#include "ServerTokenSpace.h"
|
#include "ServerTokenSpace.h"
|
||||||
@@ -111,13 +112,13 @@ BitmapManager::CreateBitmap(ClientMemoryAllocator* allocator, HWInterface& hwInt
|
|||||||
uint8* buffer = NULL;
|
uint8* buffer = NULL;
|
||||||
|
|
||||||
if (flags & B_BITMAP_WILL_OVERLAY) {
|
if (flags & B_BITMAP_WILL_OVERLAY) {
|
||||||
OverlayCookie* overlayCookie = new (std::nothrow) OverlayCookie(hwInterface);
|
Overlay* overlay = new (std::nothrow) Overlay(hwInterface);
|
||||||
|
|
||||||
const overlay_buffer* overlayBuffer = NULL;
|
const overlay_buffer* overlayBuffer = NULL;
|
||||||
overlay_client_data* clientData = NULL;
|
overlay_client_data* clientData = NULL;
|
||||||
bool newArea = false;
|
bool newArea = false;
|
||||||
|
|
||||||
if (overlayCookie != NULL && overlayCookie->InitCheck() == B_OK) {
|
if (overlay != NULL && overlay->InitCheck() == B_OK) {
|
||||||
// allocate client memory to communicate the overlay semaphore
|
// allocate client memory to communicate the overlay semaphore
|
||||||
// and buffer location to the BBitmap
|
// and buffer location to the BBitmap
|
||||||
cookie = allocator->Allocate(sizeof(overlay_client_data),
|
cookie = allocator->Allocate(sizeof(overlay_client_data),
|
||||||
@@ -129,11 +130,11 @@ BitmapManager::CreateBitmap(ClientMemoryAllocator* allocator, HWInterface& hwInt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (overlayBuffer != NULL) {
|
if (overlayBuffer != NULL) {
|
||||||
overlayCookie->SetOverlayData(overlayBuffer, overlayToken, clientData);
|
overlay->SetOverlayData(overlayBuffer, overlayToken, clientData);
|
||||||
|
|
||||||
bitmap->fAllocator = allocator;
|
bitmap->fAllocator = allocator;
|
||||||
bitmap->fAllocationCookie = cookie;
|
bitmap->fAllocationCookie = cookie;
|
||||||
bitmap->SetOverlayCookie(overlayCookie);
|
bitmap->SetOverlay(overlay);
|
||||||
bitmap->fBytesPerRow = overlayBuffer->bytes_per_row;
|
bitmap->fBytesPerRow = overlayBuffer->bytes_per_row;
|
||||||
|
|
||||||
buffer = (uint8*)overlayBuffer->buffer;
|
buffer = (uint8*)overlayBuffer->buffer;
|
||||||
@@ -141,7 +142,7 @@ BitmapManager::CreateBitmap(ClientMemoryAllocator* allocator, HWInterface& hwInt
|
|||||||
*_allocationFlags = kFramebuffer | (newArea ? kNewAllocatorArea : 0);
|
*_allocationFlags = kFramebuffer | (newArea ? kNewAllocatorArea : 0);
|
||||||
} else {
|
} else {
|
||||||
hwInterface.ReleaseOverlayChannel(overlayToken);
|
hwInterface.ReleaseOverlayChannel(overlayToken);
|
||||||
delete overlayCookie;
|
delete overlay;
|
||||||
allocator->Free(cookie);
|
allocator->Free(cookie);
|
||||||
}
|
}
|
||||||
} else if (allocator != NULL) {
|
} else if (allocator != NULL) {
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
#include "ClientMemoryAllocator.h"
|
#include "ClientMemoryAllocator.h"
|
||||||
#include "ColorConversion.h"
|
#include "ColorConversion.h"
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
#include "Overlay.h"
|
||||||
#include <BitmapPrivate.h>
|
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -56,7 +55,7 @@ ServerBitmap::ServerBitmap(BRect rect, color_space space,
|
|||||||
:
|
:
|
||||||
fAllocator(NULL),
|
fAllocator(NULL),
|
||||||
fAllocationCookie(NULL),
|
fAllocationCookie(NULL),
|
||||||
fOverlayCookie(NULL),
|
fOverlay(NULL),
|
||||||
fBuffer(NULL),
|
fBuffer(NULL),
|
||||||
fReferenceCount(1),
|
fReferenceCount(1),
|
||||||
// WARNING: '1' is added to the width and height.
|
// WARNING: '1' is added to the width and height.
|
||||||
@@ -80,7 +79,7 @@ ServerBitmap::ServerBitmap(const ServerBitmap* bmp)
|
|||||||
:
|
:
|
||||||
fAllocator(NULL),
|
fAllocator(NULL),
|
||||||
fAllocationCookie(NULL),
|
fAllocationCookie(NULL),
|
||||||
fOverlayCookie(NULL),
|
fOverlay(NULL),
|
||||||
fBuffer(NULL),
|
fBuffer(NULL),
|
||||||
fReferenceCount(1)
|
fReferenceCount(1)
|
||||||
{
|
{
|
||||||
@@ -109,8 +108,8 @@ ServerBitmap::~ServerBitmap()
|
|||||||
else
|
else
|
||||||
free(fBuffer);
|
free(fBuffer);
|
||||||
|
|
||||||
delete fOverlayCookie;
|
delete fOverlay;
|
||||||
// deleting the cookie will also free the overlay buffer
|
// deleting the overlay will also free the overlay buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -305,16 +304,16 @@ ServerBitmap::AreaOffset() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerBitmap::SetOverlayCookie(::OverlayCookie* cookie)
|
ServerBitmap::SetOverlay(::Overlay* cookie)
|
||||||
{
|
{
|
||||||
fOverlayCookie = cookie;
|
fOverlay = cookie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
::OverlayCookie*
|
::Overlay*
|
||||||
ServerBitmap::OverlayCookie() const
|
ServerBitmap::Overlay() const
|
||||||
{
|
{
|
||||||
return fOverlayCookie;
|
return fOverlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -362,123 +361,3 @@ UtilityBitmap::UtilityBitmap(const uint8* alreadyPaddedData,
|
|||||||
UtilityBitmap::~UtilityBitmap()
|
UtilityBitmap::~UtilityBitmap()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
|
||||||
|
|
||||||
|
|
||||||
OverlayCookie::OverlayCookie(HWInterface& interface)
|
|
||||||
:
|
|
||||||
fHWInterface(interface),
|
|
||||||
fOverlayBuffer(NULL),
|
|
||||||
fClientData(NULL),
|
|
||||||
fOverlayToken(NULL)
|
|
||||||
{
|
|
||||||
fSemaphore = create_sem(1, "overlay lock");
|
|
||||||
fColor.SetColor(21, 16, 21, 16);
|
|
||||||
// TODO: whatever fine color we want to use here...
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OverlayCookie::~OverlayCookie()
|
|
||||||
{
|
|
||||||
fHWInterface.ReleaseOverlayChannel(fOverlayToken);
|
|
||||||
fHWInterface.FreeOverlayBuffer(fOverlayBuffer);
|
|
||||||
|
|
||||||
delete_sem(fSemaphore);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
OverlayCookie::InitCheck() const
|
|
||||||
{
|
|
||||||
return fSemaphore >= B_OK ? B_OK : fSemaphore;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
OverlayCookie::SetOverlayData(const overlay_buffer* overlayBuffer,
|
|
||||||
overlay_token token, overlay_client_data* clientData)
|
|
||||||
{
|
|
||||||
fOverlayBuffer = overlayBuffer;
|
|
||||||
fOverlayToken = token;
|
|
||||||
|
|
||||||
fClientData = clientData;
|
|
||||||
fClientData->lock = fSemaphore;
|
|
||||||
fClientData->buffer = (uint8*)fOverlayBuffer->buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
OverlayCookie::TakeOverToken(OverlayCookie* other)
|
|
||||||
{
|
|
||||||
overlay_token token = other->OverlayToken();
|
|
||||||
if (token == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fOverlayToken = token;
|
|
||||||
//other->fOverlayToken = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const overlay_buffer*
|
|
||||||
OverlayCookie::OverlayBuffer() const
|
|
||||||
{
|
|
||||||
return fOverlayBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
overlay_client_data*
|
|
||||||
OverlayCookie::ClientData() const
|
|
||||||
{
|
|
||||||
return fClientData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
overlay_token
|
|
||||||
OverlayCookie::OverlayToken() const
|
|
||||||
{
|
|
||||||
return fOverlayToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
OverlayCookie::Show()
|
|
||||||
{
|
|
||||||
// TODO: acquire token!
|
|
||||||
if (fOverlayToken == NULL) {
|
|
||||||
printf("%p: no overlay token\n", this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fHWInterface.ShowOverlay(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
OverlayCookie::Hide()
|
|
||||||
{
|
|
||||||
// TODO: acquire token!
|
|
||||||
if (fOverlayToken == NULL) {
|
|
||||||
printf("%p: no overlay token\n", this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fHWInterface.HideOverlay(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
OverlayCookie::SetView(const BRect& source, const BRect& destination)
|
|
||||||
{
|
|
||||||
fSource = source;
|
|
||||||
fDestination = destination;
|
|
||||||
|
|
||||||
if (fOverlayToken == NULL) {
|
|
||||||
printf("%p: no overlay token\n", this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fHWInterface.UpdateOverlay(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,11 @@
|
|||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <video_overlay.h>
|
|
||||||
|
|
||||||
|
|
||||||
class BitmapManager;
|
class BitmapManager;
|
||||||
class ClientMemoryAllocator;
|
class ClientMemoryAllocator;
|
||||||
class HWInterface;
|
class HWInterface;
|
||||||
class OverlayCookie;
|
class Overlay;
|
||||||
struct overlay_client_data;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ServerBitmap ServerBitmap.h
|
\class ServerBitmap ServerBitmap.h
|
||||||
@@ -69,8 +66,8 @@ class ServerBitmap {
|
|||||||
area_id Area() const;
|
area_id Area() const;
|
||||||
uint32 AreaOffset() const;
|
uint32 AreaOffset() const;
|
||||||
|
|
||||||
void SetOverlayCookie(::OverlayCookie* cookie);
|
void SetOverlay(::Overlay* cookie);
|
||||||
::OverlayCookie* OverlayCookie() const;
|
::Overlay* Overlay() const;
|
||||||
|
|
||||||
//! Does a shallow copy of the bitmap passed to it
|
//! Does a shallow copy of the bitmap passed to it
|
||||||
inline void ShallowCopy(const ServerBitmap *from);
|
inline void ShallowCopy(const ServerBitmap *from);
|
||||||
@@ -109,7 +106,7 @@ protected:
|
|||||||
|
|
||||||
ClientMemoryAllocator* fAllocator;
|
ClientMemoryAllocator* fAllocator;
|
||||||
void* fAllocationCookie;
|
void* fAllocationCookie;
|
||||||
::OverlayCookie* fOverlayCookie;
|
::Overlay* fOverlay;
|
||||||
uint8* fBuffer;
|
uint8* fBuffer;
|
||||||
int32 fReferenceCount;
|
int32 fReferenceCount;
|
||||||
|
|
||||||
@@ -140,54 +137,6 @@ class UtilityBitmap : public ServerBitmap {
|
|||||||
virtual ~UtilityBitmap();
|
virtual ~UtilityBitmap();
|
||||||
};
|
};
|
||||||
|
|
||||||
//! An allocation cookie for overlays
|
|
||||||
class OverlayCookie {
|
|
||||||
public:
|
|
||||||
OverlayCookie(HWInterface& interface);
|
|
||||||
~OverlayCookie();
|
|
||||||
|
|
||||||
status_t InitCheck() const;
|
|
||||||
|
|
||||||
void SetOverlayData(const overlay_buffer* overlayBuffer,
|
|
||||||
overlay_token token, overlay_client_data* clientData);
|
|
||||||
void TakeOverToken(OverlayCookie* other);
|
|
||||||
|
|
||||||
const overlay_buffer* OverlayBuffer() const;
|
|
||||||
overlay_client_data* ClientData() const;
|
|
||||||
overlay_token OverlayToken() const;
|
|
||||||
|
|
||||||
sem_id Semaphore() const
|
|
||||||
{ return fSemaphore; }
|
|
||||||
|
|
||||||
const RGBColor& Color() const
|
|
||||||
{ return fColor; }
|
|
||||||
|
|
||||||
void SetVisible(bool visible)
|
|
||||||
{ fVisible = visible; }
|
|
||||||
bool IsVisible() const
|
|
||||||
{ return fVisible; }
|
|
||||||
|
|
||||||
void SetView(const BRect& source, const BRect& destination);
|
|
||||||
const BRect& Source() const
|
|
||||||
{ return fSource; }
|
|
||||||
const BRect& Destination() const
|
|
||||||
{ return fDestination; }
|
|
||||||
|
|
||||||
void Show();
|
|
||||||
void Hide();
|
|
||||||
|
|
||||||
private:
|
|
||||||
HWInterface& fHWInterface;
|
|
||||||
const overlay_buffer* fOverlayBuffer;
|
|
||||||
overlay_client_data* fClientData;
|
|
||||||
overlay_token fOverlayToken;
|
|
||||||
sem_id fSemaphore;
|
|
||||||
RGBColor fColor;
|
|
||||||
BRect fSource;
|
|
||||||
BRect fDestination;
|
|
||||||
bool fVisible;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ShallowCopy (only for server bitmaps)
|
// ShallowCopy (only for server bitmaps)
|
||||||
void
|
void
|
||||||
ServerBitmap::ShallowCopy(const ServerBitmap* from)
|
ServerBitmap::ShallowCopy(const ServerBitmap* from)
|
||||||
|
|||||||
@@ -20,30 +20,15 @@
|
|||||||
mouse and key events from the server to its window, and other such things.
|
mouse and key events from the server to its window, and other such things.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
#include <AppDefs.h>
|
#include "ServerWindow.h"
|
||||||
#include <DirectWindow.h>
|
|
||||||
#include <GraphicsDefs.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <PortLink.h>
|
|
||||||
#include <Rect.h>
|
|
||||||
#include <View.h>
|
|
||||||
#include <ViewAux.h>
|
|
||||||
#include <Autolock.h>
|
|
||||||
#include <TokenSpace.h>
|
|
||||||
#include <WindowInfo.h>
|
|
||||||
#include <WindowPrivate.h>
|
|
||||||
|
|
||||||
#include <DirectWindowPrivate.h>
|
|
||||||
#include <MessagePrivate.h>
|
|
||||||
#include <PictureProtocol.h>
|
|
||||||
|
|
||||||
#include "AppServer.h"
|
#include "AppServer.h"
|
||||||
#include "DebugInfoManager.h"
|
#include "DebugInfoManager.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "DrawingEngine.h"
|
#include "DrawingEngine.h"
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
|
#include "Overlay.h"
|
||||||
#include "RAMLinkMsgReader.h"
|
#include "RAMLinkMsgReader.h"
|
||||||
#include "RenderingBuffer.h"
|
#include "RenderingBuffer.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
@@ -53,10 +38,24 @@
|
|||||||
#include "WindowLayer.h"
|
#include "WindowLayer.h"
|
||||||
#include "WorkspacesLayer.h"
|
#include "WorkspacesLayer.h"
|
||||||
|
|
||||||
#include "ServerWindow.h"
|
|
||||||
|
|
||||||
#include "clipping.h"
|
#include "clipping.h"
|
||||||
|
|
||||||
|
#include <DirectWindowPrivate.h>
|
||||||
|
#include <MessagePrivate.h>
|
||||||
|
#include <PictureProtocol.h>
|
||||||
|
#include <PortLink.h>
|
||||||
|
#include <ViewAux.h>
|
||||||
|
#include <WindowInfo.h>
|
||||||
|
#include <WindowPrivate.h>
|
||||||
|
|
||||||
|
#include <AppDefs.h>
|
||||||
|
#include <Autolock.h>
|
||||||
|
#include <DirectWindow.h>
|
||||||
|
#include <TokenSpace.h>
|
||||||
|
#include <View.h>
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
//#define TRACE_SERVER_WINDOW
|
//#define TRACE_SERVER_WINDOW
|
||||||
@@ -1514,8 +1513,8 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
BRegion dirty(fCurrentLayer->Bounds());
|
BRegion dirty(fCurrentLayer->Bounds());
|
||||||
fWindowLayer->InvalidateView(fCurrentLayer, dirty);
|
fWindowLayer->InvalidateView(fCurrentLayer, dirty);
|
||||||
|
|
||||||
if (bitmap != NULL && bitmap->OverlayCookie() != NULL)
|
if (bitmap != NULL && bitmap->Overlay() != NULL)
|
||||||
colorKey = bitmap->OverlayCookie()->Color().GetColor32();
|
colorKey = bitmap->Overlay()->Color().GetColor32();
|
||||||
} else
|
} else
|
||||||
status = B_BAD_VALUE;
|
status = B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
#include <Region.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "BitmapManager.h"
|
#include "BitmapManager.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "DrawingEngine.h"
|
#include "DrawingEngine.h"
|
||||||
|
#include "Overlay.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerBitmap.h"
|
#include "ServerBitmap.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
@@ -272,8 +273,13 @@ ViewLayer::RemoveChild(ViewLayer* layer)
|
|||||||
layer->fPreviousSibling = NULL;
|
layer->fPreviousSibling = NULL;
|
||||||
layer->fNextSibling = NULL;
|
layer->fNextSibling = NULL;
|
||||||
|
|
||||||
if (layer->IsVisible())
|
if (layer->IsVisible()) {
|
||||||
|
Overlay* overlay = _Overlay();
|
||||||
|
if (overlay != NULL)
|
||||||
|
overlay->Hide();
|
||||||
|
|
||||||
RebuildClipping(false);
|
RebuildClipping(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (fWindow) {
|
if (fWindow) {
|
||||||
layer->DetachedFromWindow();
|
layer->DetachedFromWindow();
|
||||||
@@ -452,8 +458,8 @@ ViewLayer::SetViewBitmap(ServerBitmap* bitmap, BRect sourceRect,
|
|||||||
if (fViewBitmap != NULL) {
|
if (fViewBitmap != NULL) {
|
||||||
if (bitmap != NULL) {
|
if (bitmap != NULL) {
|
||||||
// take over overlay token from current overlay (if it has any)
|
// take over overlay token from current overlay (if it has any)
|
||||||
OverlayCookie* oldOverlay = _Overlay();
|
Overlay* oldOverlay = _Overlay();
|
||||||
OverlayCookie* newOverlay = bitmap->OverlayCookie();
|
Overlay* newOverlay = bitmap->Overlay();
|
||||||
|
|
||||||
if (oldOverlay != NULL && newOverlay != NULL)
|
if (oldOverlay != NULL && newOverlay != NULL)
|
||||||
newOverlay->TakeOverToken(oldOverlay);
|
newOverlay->TakeOverToken(oldOverlay);
|
||||||
@@ -483,20 +489,20 @@ ViewLayer::SetViewBitmap(ServerBitmap* bitmap, BRect sourceRect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OverlayCookie*
|
::Overlay*
|
||||||
ViewLayer::_Overlay() const
|
ViewLayer::_Overlay() const
|
||||||
{
|
{
|
||||||
if (fViewBitmap == NULL)
|
if (fViewBitmap == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return fViewBitmap->OverlayCookie();
|
return fViewBitmap->Overlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::_UpdateOverlayView() const
|
ViewLayer::_UpdateOverlayView() const
|
||||||
{
|
{
|
||||||
OverlayCookie* overlay = _Overlay();
|
Overlay* overlay = _Overlay();
|
||||||
if (overlay == NULL)
|
if (overlay == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1032,7 +1038,7 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
|||||||
// add the current clipping
|
// add the current clipping
|
||||||
redraw->IntersectWith(effectiveClipping);
|
redraw->IntersectWith(effectiveClipping);
|
||||||
|
|
||||||
OverlayCookie* overlayCookie = _Overlay();
|
Overlay* overlayCookie = _Overlay();
|
||||||
|
|
||||||
if (fViewBitmap != NULL && overlayCookie == NULL) {
|
if (fViewBitmap != NULL && overlayCookie == NULL) {
|
||||||
// draw view bitmap
|
// draw view bitmap
|
||||||
@@ -1214,7 +1220,7 @@ ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
|||||||
|
|
||||||
// overlay handling
|
// overlay handling
|
||||||
|
|
||||||
OverlayCookie* overlay = _Overlay();
|
Overlay* overlay = _Overlay();
|
||||||
if (overlay == NULL)
|
if (overlay == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace BPrivate {
|
|||||||
|
|
||||||
class DrawState;
|
class DrawState;
|
||||||
class DrawingEngine;
|
class DrawingEngine;
|
||||||
class OverlayCookie;
|
class Overlay;
|
||||||
class WindowLayer;
|
class WindowLayer;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
@@ -209,7 +209,7 @@ class ViewLayer {
|
|||||||
protected:
|
protected:
|
||||||
void _MoveScreenClipping(int32 x, int32 y,
|
void _MoveScreenClipping(int32 x, int32 y,
|
||||||
bool deep);
|
bool deep);
|
||||||
OverlayCookie* _Overlay() const;
|
Overlay* _Overlay() const;
|
||||||
void _UpdateOverlayView() const;
|
void _UpdateOverlayView() const;
|
||||||
|
|
||||||
BString fName;
|
BString fName;
|
||||||
|
|||||||
@@ -10,28 +10,29 @@
|
|||||||
|
|
||||||
/** Accelerant based HWInterface implementation */
|
/** Accelerant based HWInterface implementation */
|
||||||
|
|
||||||
#include <new>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <Cursor.h>
|
#include "AccelerantHWInterface.h"
|
||||||
|
|
||||||
#include <Accelerant.h>
|
|
||||||
#include <graphic_driver.h>
|
|
||||||
#include <FindDirectory.h>
|
|
||||||
#include <image.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
|
#include "AccelerantBuffer.h"
|
||||||
|
#include "MallocBuffer.h"
|
||||||
|
#include "Overlay.h"
|
||||||
#include "RGBColor.h"
|
#include "RGBColor.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
|
|
||||||
#include "AccelerantHWInterface.h"
|
#include <Accelerant.h>
|
||||||
#include "AccelerantBuffer.h"
|
#include <Cursor.h>
|
||||||
#include "MallocBuffer.h"
|
#include <FindDirectory.h>
|
||||||
|
#include <graphic_driver.h>
|
||||||
|
#include <image.h>
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <new>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
@@ -762,21 +763,21 @@ AccelerantHWInterface::FreeOverlayBuffer(const overlay_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccelerantHWInterface::ShowOverlay(OverlayCookie* overlay)
|
AccelerantHWInterface::ShowOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
UpdateOverlay(overlay);
|
UpdateOverlay(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccelerantHWInterface::HideOverlay(OverlayCookie* overlay)
|
AccelerantHWInterface::HideOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
fAccConfigureOverlay(overlay->OverlayToken(), overlay->OverlayBuffer(), NULL, NULL);
|
fAccConfigureOverlay(overlay->OverlayToken(), overlay->OverlayBuffer(), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccelerantHWInterface::UpdateOverlay(OverlayCookie* overlay)
|
AccelerantHWInterface::UpdateOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
const overlay_buffer* buffer = overlay->OverlayBuffer();
|
const overlay_buffer* buffer = overlay->OverlayBuffer();
|
||||||
|
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ public:
|
|||||||
color_space space);
|
color_space space);
|
||||||
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
|
||||||
|
|
||||||
virtual void ShowOverlay(OverlayCookie* overlay);
|
virtual void ShowOverlay(Overlay* overlay);
|
||||||
virtual void HideOverlay(OverlayCookie* overlay);
|
virtual void HideOverlay(Overlay* overlay);
|
||||||
virtual void UpdateOverlay(OverlayCookie* 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,19 +336,19 @@ HWInterface::FreeOverlayBuffer(const overlay_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HWInterface::ShowOverlay(OverlayCookie* overlay)
|
HWInterface::ShowOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HWInterface::HideOverlay(OverlayCookie* overlay)
|
HWInterface::HideOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HWInterface::UpdateOverlay(OverlayCookie* overlay)
|
HWInterface::UpdateOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
|
|
||||||
|
|
||||||
class OverlayCookie;
|
class Overlay;
|
||||||
class RenderingBuffer;
|
class RenderingBuffer;
|
||||||
class RGBColor;
|
class RGBColor;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
@@ -107,9 +107,9 @@ 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(OverlayCookie* overlay);
|
virtual void ShowOverlay(Overlay* overlay);
|
||||||
virtual void HideOverlay(OverlayCookie* overlay);
|
virtual void HideOverlay(Overlay* overlay);
|
||||||
virtual void UpdateOverlay(OverlayCookie* 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;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ StaticLibrary libasdrawing.a :
|
|||||||
MallocBuffer.cpp
|
MallocBuffer.cpp
|
||||||
UpdateQueue.cpp
|
UpdateQueue.cpp
|
||||||
PatternHandler.cpp
|
PatternHandler.cpp
|
||||||
|
Overlay.cpp
|
||||||
|
|
||||||
BitmapHWInterface.cpp
|
BitmapHWInterface.cpp
|
||||||
BBitmapBuffer.cpp
|
BBitmapBuffer.cpp
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "HWInterface.h"
|
||||||
|
#include "Overlay.h"
|
||||||
|
|
||||||
|
#include <BitmapPrivate.h>
|
||||||
|
|
||||||
|
|
||||||
|
Overlay::Overlay(HWInterface& interface)
|
||||||
|
:
|
||||||
|
fHWInterface(interface),
|
||||||
|
fOverlayBuffer(NULL),
|
||||||
|
fClientData(NULL),
|
||||||
|
fOverlayToken(NULL)
|
||||||
|
{
|
||||||
|
fSemaphore = create_sem(1, "overlay lock");
|
||||||
|
fColor.SetColor(21, 16, 21, 16);
|
||||||
|
// TODO: whatever fine color we want to use here...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Overlay::~Overlay()
|
||||||
|
{
|
||||||
|
fHWInterface.ReleaseOverlayChannel(fOverlayToken);
|
||||||
|
fHWInterface.FreeOverlayBuffer(fOverlayBuffer);
|
||||||
|
|
||||||
|
delete_sem(fSemaphore);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Overlay::InitCheck() const
|
||||||
|
{
|
||||||
|
return fSemaphore >= B_OK ? B_OK : fSemaphore;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Overlay::SetOverlayData(const overlay_buffer* overlayBuffer,
|
||||||
|
overlay_token token, overlay_client_data* clientData)
|
||||||
|
{
|
||||||
|
fOverlayBuffer = overlayBuffer;
|
||||||
|
fOverlayToken = token;
|
||||||
|
|
||||||
|
fClientData = clientData;
|
||||||
|
fClientData->lock = fSemaphore;
|
||||||
|
fClientData->buffer = (uint8*)fOverlayBuffer->buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Overlay::TakeOverToken(Overlay* other)
|
||||||
|
{
|
||||||
|
overlay_token token = other->OverlayToken();
|
||||||
|
if (token == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fOverlayToken = token;
|
||||||
|
//other->fOverlayToken = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const overlay_buffer*
|
||||||
|
Overlay::OverlayBuffer() const
|
||||||
|
{
|
||||||
|
return fOverlayBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
overlay_client_data*
|
||||||
|
Overlay::ClientData() const
|
||||||
|
{
|
||||||
|
return fClientData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
overlay_token
|
||||||
|
Overlay::OverlayToken() const
|
||||||
|
{
|
||||||
|
return fOverlayToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Overlay::Show()
|
||||||
|
{
|
||||||
|
if (fOverlayToken == NULL) {
|
||||||
|
fOverlayToken = fHWInterface.AcquireOverlayChannel();
|
||||||
|
if (fOverlayToken == NULL)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fHWInterface.ShowOverlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Overlay::Hide()
|
||||||
|
{
|
||||||
|
if (fOverlayToken == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fHWInterface.HideOverlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Overlay::SetView(const BRect& source, const BRect& destination)
|
||||||
|
{
|
||||||
|
fSource = source;
|
||||||
|
fDestination = destination;
|
||||||
|
|
||||||
|
if (fOverlayToken == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fHWInterface.UpdateOverlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
|
*/
|
||||||
|
#ifndef OVERLAY_H
|
||||||
|
#define OVERLAY_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "RGBColor.h"
|
||||||
|
|
||||||
|
#include <video_overlay.h>
|
||||||
|
|
||||||
|
//#include <GraphicsDefs.h>
|
||||||
|
//#include <Rect.h>
|
||||||
|
//#include <OS.h>
|
||||||
|
|
||||||
|
|
||||||
|
class HWInterface;
|
||||||
|
struct overlay_client_data;
|
||||||
|
|
||||||
|
|
||||||
|
class Overlay {
|
||||||
|
public:
|
||||||
|
Overlay(HWInterface& interface);
|
||||||
|
~Overlay();
|
||||||
|
|
||||||
|
status_t InitCheck() const;
|
||||||
|
|
||||||
|
void SetOverlayData(const overlay_buffer* overlayBuffer,
|
||||||
|
overlay_token token, overlay_client_data* clientData);
|
||||||
|
void TakeOverToken(Overlay* other);
|
||||||
|
|
||||||
|
const overlay_buffer* OverlayBuffer() const;
|
||||||
|
overlay_client_data* ClientData() const;
|
||||||
|
overlay_token OverlayToken() const;
|
||||||
|
|
||||||
|
sem_id Semaphore() const
|
||||||
|
{ return fSemaphore; }
|
||||||
|
|
||||||
|
const RGBColor& Color() const
|
||||||
|
{ return fColor; }
|
||||||
|
|
||||||
|
void SetVisible(bool visible)
|
||||||
|
{ fVisible = visible; }
|
||||||
|
bool IsVisible() const
|
||||||
|
{ return fVisible; }
|
||||||
|
|
||||||
|
void SetView(const BRect& source, const BRect& destination);
|
||||||
|
const BRect& Source() const
|
||||||
|
{ return fSource; }
|
||||||
|
const BRect& Destination() const
|
||||||
|
{ return fDestination; }
|
||||||
|
|
||||||
|
void Show();
|
||||||
|
void Hide();
|
||||||
|
|
||||||
|
private:
|
||||||
|
HWInterface& fHWInterface;
|
||||||
|
const overlay_buffer* fOverlayBuffer;
|
||||||
|
overlay_client_data* fClientData;
|
||||||
|
overlay_token fOverlayToken;
|
||||||
|
sem_id fSemaphore;
|
||||||
|
RGBColor fColor;
|
||||||
|
BRect fSource;
|
||||||
|
BRect fDestination;
|
||||||
|
bool fVisible;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OVERLAY_H
|
||||||
@@ -62,6 +62,7 @@ SharedLibrary libhaikuappserver.so :
|
|||||||
FontManager.cpp
|
FontManager.cpp
|
||||||
HashTable.cpp
|
HashTable.cpp
|
||||||
MultiLocker.cpp
|
MultiLocker.cpp
|
||||||
|
Overlay.cpp
|
||||||
RGBColor.cpp
|
RGBColor.cpp
|
||||||
ServerBitmap.cpp
|
ServerBitmap.cpp
|
||||||
ServerCursor.cpp
|
ServerCursor.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user