From e2693621b6e93462629d439effd550df7f64ac49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 30 Sep 2007 16:03:53 +0000 Subject: [PATCH] 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 --- src/kits/interface/Bitmap.cpp | 5 ++-- src/servers/app/ServerApp.cpp | 7 +++-- .../app/drawing/AccelerantHWInterface.cpp | 28 +++++++++++++++++++ .../app/drawing/AccelerantHWInterface.h | 10 ++++--- src/servers/app/drawing/HWInterface.cpp | 11 +++++++- src/servers/app/drawing/HWInterface.h | 2 ++ 6 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index fff0748599..b0e43c1c98 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -754,9 +754,10 @@ BBitmap::GetOverlayRestrictions(overlay_restrictions *restrictions) const status_t status; if (link.FlushWithReply(status) < B_OK) - return B_ERROR; + return status; - return status; + link.Read(restrictions, sizeof(overlay_restrictions)); + return B_OK; } diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index bb71be987c..4113885f5b 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -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; diff --git a/src/servers/app/drawing/AccelerantHWInterface.cpp b/src/servers/app/drawing/AccelerantHWInterface.cpp index bb90ed10e0..dcf4a1d89b 100644 --- a/src/servers/app/drawing/AccelerantHWInterface.cpp +++ b/src/servers/app/drawing/AccelerantHWInterface.cpp @@ -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) diff --git a/src/servers/app/drawing/AccelerantHWInterface.h b/src/servers/app/drawing/AccelerantHWInterface.h index 4ab00ebaf8..7fe65380ac 100644 --- a/src/servers/app/drawing/AccelerantHWInterface.h +++ b/src/servers/app/drawing/AccelerantHWInterface.h @@ -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); diff --git a/src/servers/app/drawing/HWInterface.cpp b/src/servers/app/drawing/HWInterface.cpp index 868ae4346b..6133670c73 100644 --- a/src/servers/app/drawing/HWInterface.cpp +++ b/src/servers/app/drawing/HWInterface.cpp @@ -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; } diff --git a/src/servers/app/drawing/HWInterface.h b/src/servers/app/drawing/HWInterface.h index 67997eb25d..928c4f32e6 100644 --- a/src/servers/app/drawing/HWInterface.h +++ b/src/servers/app/drawing/HWInterface.h @@ -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,