Correctly implemented the missing BBitmap::GetOverlayRestrictions() on the

client and the server. This should fix bug #1490, but I haven't tested it yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22388 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-09-30 16:03:53 +00:00
parent bfd9a59f77
commit e2693621b6
6 changed files with 53 additions and 10 deletions

View File

@ -754,9 +754,10 @@ BBitmap::GetOverlayRestrictions(overlay_restrictions *restrictions) const
status_t status;
if (link.FlushWithReply(status) < B_OK)
return B_ERROR;
return status;
link.Read(restrictions, sizeof(overlay_restrictions));
return B_OK;
}

View File

@ -665,7 +665,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
}
case AS_GET_BITMAP_OVERLAY_RESTRICTIONS:
{
overlay_restrictions overlayRestrictions;
overlay_restrictions restrictions;
status_t status = B_ERROR;
int32 token;
@ -677,12 +677,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
STRACE(("ServerApp %s: Get overlay restrictions for bitmap %ld\n",
Signature(), token));
// TODO: fill overlay restrictions
status = fDesktop->HWInterface()->GetOverlayRestrictions(
bitmap->Overlay(), &restrictions);
}
fLink.StartMessage(status);
if (status == B_OK)
fLink.Attach(&overlayRestrictions, sizeof(overlay_restrictions));
fLink.Attach(&restrictions, sizeof(overlay_restrictions));
fLink.Flush();
break;

View File

@ -856,6 +856,34 @@ AccelerantHWInterface::ReleaseOverlayChannel(overlay_token token)
}
status_t
AccelerantHWInterface::GetOverlayRestrictions(const Overlay* overlay,
overlay_restrictions* restrictions)
{
if (overlay == NULL || restrictions == NULL)
return B_BAD_VALUE;
if (fAccGetOverlayConstraints == NULL)
return B_NOT_SUPPORTED;
overlay_constraints constraints;
status_t status = fAccGetOverlayConstraints(&fDisplayMode,
overlay->OverlayBuffer(), &constraints);
if (status < B_OK)
return status;
memset(restrictions, 0, sizeof(overlay_restrictions));
memcpy(&restrictions->source, &constraints.view, sizeof(overlay_limits));
memcpy(&restrictions->destination, &constraints.window,
sizeof(overlay_limits));
restrictions->min_width_scale = constraints.h_scale.min;
restrictions->max_width_scale = constraints.h_scale.max;
restrictions->min_height_scale = constraints.v_scale.min;
restrictions->max_height_scale = constraints.v_scale.max;
return B_OK;
}
bool
AccelerantHWInterface::CheckOverlayRestrictions(int32 width, int32 height,
color_space colorSpace)

View File

@ -59,10 +59,12 @@ public:
virtual overlay_token AcquireOverlayChannel();
virtual void ReleaseOverlayChannel(overlay_token token);
virtual bool CheckOverlayRestrictions(int32 width, int32 height,
color_space colorSpace);
virtual const overlay_buffer* AllocateOverlayBuffer(int32 width, int32 height,
color_space space);
virtual status_t GetOverlayRestrictions(const Overlay* overlay,
overlay_restrictions* restrictions);
virtual bool CheckOverlayRestrictions(int32 width,
int32 height, color_space colorSpace);
virtual const overlay_buffer* AllocateOverlayBuffer(int32 width,
int32 height, color_space space);
virtual void FreeOverlayBuffer(const overlay_buffer* buffer);
virtual void ConfigureOverlay(Overlay* overlay);

View File

@ -344,8 +344,17 @@ HWInterface::ReleaseOverlayChannel(overlay_token token)
}
status_t
HWInterface::GetOverlayRestrictions(const Overlay* overlay,
overlay_restrictions* restrictions)
{
return B_NOT_SUPPORTED;
}
bool
HWInterface::CheckOverlayRestrictions(int32 width, int32 height, color_space colorSpace)
HWInterface::CheckOverlayRestrictions(int32 width, int32 height,
color_space colorSpace)
{
return false;
}

View File

@ -120,6 +120,8 @@ class HWInterface : protected MultiLocker {
virtual overlay_token AcquireOverlayChannel();
virtual void ReleaseOverlayChannel(overlay_token token);
virtual status_t GetOverlayRestrictions(const Overlay* overlay,
overlay_restrictions* restrictions);
virtual bool CheckOverlayRestrictions(int32 width, int32 height,
color_space colorSpace);
virtual const overlay_buffer* AllocateOverlayBuffer(int32 width, int32 height,