Some groundwork for overlay support. If someone wants to finish this, feel
free to continue (it would be nice to be notified before, though, in case I get to it again in the next weeks). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16561 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5891e232e2
commit
f19839c230
@ -22,6 +22,9 @@
|
||||
# define SERVER_INPUT_PORT "OBinputport"
|
||||
#endif
|
||||
|
||||
#define AS_REQUEST_COLOR_KEY 0x00010000
|
||||
// additional option for AS_LAYER_SET_VIEW_BITMAP
|
||||
|
||||
enum {
|
||||
// Used for quick replies from the app_server
|
||||
SERVER_TRUE = B_OK,
|
||||
@ -53,6 +56,7 @@ enum {
|
||||
AS_DELETE_WINDOW,
|
||||
AS_CREATE_BITMAP,
|
||||
AS_DELETE_BITMAP,
|
||||
AS_GET_BITMAP_OVERLAY_RESTRICTIONS,
|
||||
|
||||
AS_ACQUIRE_SERVERMEM,
|
||||
AS_RELEASE_SERVERMEM,
|
||||
|
@ -1998,17 +1998,28 @@ BBitmap::ImportBits(const BBitmap *bitmap)
|
||||
return error;
|
||||
}
|
||||
|
||||
// GetOverlayRestrictions
|
||||
/*! \brief ???
|
||||
|
||||
/*! \brief Returns the overlay_restrictions structure for this bitmap
|
||||
*/
|
||||
status_t
|
||||
BBitmap::GetOverlayRestrictions(overlay_restrictions *restrictions) const
|
||||
{
|
||||
// TODO: Implement
|
||||
if ((fFlags & B_BITMAP_WILL_OVERLAY) == 0)
|
||||
return B_BAD_TYPE;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_GET_BITMAP_OVERLAY_RESTRICTIONS);
|
||||
link.Attach<int32>(fServerToken);
|
||||
|
||||
status_t status;
|
||||
if (link.FlushWithReply(status) < B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// AddChild
|
||||
|
||||
/*! \brief Adds a BView to the bitmap's view hierarchy.
|
||||
|
||||
The bitmap must accept views and the supplied view must not be child of
|
||||
|
@ -3085,15 +3085,17 @@ status_t
|
||||
BView::SetViewOverlay(const BBitmap *overlay, BRect srcRect, BRect dstRect,
|
||||
rgb_color *colorKey, uint32 followFlags, uint32 options)
|
||||
{
|
||||
status_t err = _SetViewBitmap(overlay, srcRect, dstRect, followFlags,
|
||||
options | 0x4);
|
||||
|
||||
// TODO: Incomplete?
|
||||
if ((overlay->fFlags & B_BITMAP_WILL_OVERLAY) == 0)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
status_t status = _SetViewBitmap(overlay, srcRect, dstRect, followFlags,
|
||||
options | AS_REQUEST_COLOR_KEY);
|
||||
if (status == B_OK) {
|
||||
// read the color that will be treated as transparent
|
||||
fOwner->fLink->Read<rgb_color>(colorKey);
|
||||
}
|
||||
|
||||
return err;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@ -3102,20 +3104,12 @@ BView::SetViewOverlay(const BBitmap *overlay, rgb_color *colorKey,
|
||||
uint32 followFlags, uint32 options)
|
||||
{
|
||||
BRect rect;
|
||||
if (overlay)
|
||||
if (overlay != NULL) {
|
||||
rect = overlay->Bounds();
|
||||
rect.OffsetTo(B_ORIGIN);
|
||||
}
|
||||
|
||||
rect.OffsetTo(0, 0);
|
||||
|
||||
status_t err = _SetViewBitmap(overlay, rect, rect, followFlags,
|
||||
options | 0x4);
|
||||
|
||||
// TODO: Incomplete?
|
||||
|
||||
// read the color that will be treated as transparent
|
||||
fOwner->fLink->Read<rgb_color>(colorKey);
|
||||
|
||||
return err;
|
||||
return SetViewOverlay(overlay, rect, rect, colorKey, followFlags, options);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@ SubDir HAIKU_TOP src servers app ;
|
||||
AddResources app_server : app_server.rdef ;
|
||||
|
||||
UseLibraryHeaders png zlib ;
|
||||
UsePrivateHeaders app input interface shared [ FDirName servers app ] ;
|
||||
UsePrivateHeaders app graphics input interface shared [ FDirName servers app ] ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ;
|
||||
UseFreeTypeHeaders ;
|
||||
|
@ -715,14 +715,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
STRACE(("ServerApp %s: Create Bitmap (%.1fx%.1f)\n",
|
||||
Signature(), frame.Width(), frame.Height()));
|
||||
|
||||
if (bitmap && fBitmapList.AddItem((void*)bitmap)) {
|
||||
if (bitmap != NULL && fBitmapList.AddItem(bitmap)) {
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<int32>(bitmap->Token());
|
||||
fLink.Attach<area_id>(bitmap->Area());
|
||||
fLink.Attach<int32>(bitmap->AreaOffset());
|
||||
} else {
|
||||
} else
|
||||
fLink.StartMessage(B_NO_MEMORY);
|
||||
}
|
||||
|
||||
fLink.Flush();
|
||||
break;
|
||||
@ -734,17 +733,41 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
|
||||
// Attached Data:
|
||||
// 1) int32 token
|
||||
int32 id;
|
||||
link.Read<int32>(&id);
|
||||
int32 token;
|
||||
link.Read<int32>(&token);
|
||||
|
||||
ServerBitmap *bitmap = FindBitmap(id);
|
||||
if (bitmap && fBitmapList.RemoveItem((void*)bitmap)) {
|
||||
STRACE(("ServerApp %s: Deleting Bitmap %ld\n", Signature(), id));
|
||||
ServerBitmap *bitmap = FindBitmap(token);
|
||||
if (bitmap && fBitmapList.RemoveItem(bitmap)) {
|
||||
STRACE(("ServerApp %s: Deleting Bitmap %ld\n", Signature(), token));
|
||||
|
||||
gBitmapManager->DeleteBitmap(bitmap);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AS_GET_BITMAP_OVERLAY_RESTRICTIONS:
|
||||
{
|
||||
overlay_restrictions overlayRestrictions;
|
||||
status_t status = B_ERROR;
|
||||
|
||||
int32 token;
|
||||
if (link.Read<int32>(&token) != B_OK)
|
||||
break;
|
||||
|
||||
ServerBitmap *bitmap = FindBitmap(token);
|
||||
if (bitmap != NULL) {
|
||||
STRACE(("ServerApp %s: Get overlay restrictions for bitmap %ld\n",
|
||||
Signature(), token));
|
||||
|
||||
// TODO: fill overlay restrictions
|
||||
}
|
||||
|
||||
fLink.StartMessage(status);
|
||||
if (status == B_OK)
|
||||
fLink.Attach(&overlayRestrictions, sizeof(overlay_restrictions));
|
||||
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_CREATE_PICTURE:
|
||||
{
|
||||
|
@ -1484,6 +1484,13 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
||||
}
|
||||
|
||||
fLink.StartMessage(status);
|
||||
if (status == B_OK && (options & AS_REQUEST_COLOR_KEY) != 0) {
|
||||
// Attach color key for the overlay bitmap
|
||||
// TODO: get color key from the accelerant
|
||||
rgb_color colorKey = {40, 40, 40, 255};
|
||||
fLink.Attach<rgb_color>(colorKey);
|
||||
}
|
||||
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
|
@ -309,6 +309,17 @@ AccelerantHWInterface::_SetupDefaultHooks()
|
||||
fAccDPMSMode = (dpms_mode)fAccelerantHook(B_DPMS_MODE, NULL);
|
||||
fAccSetDPMSMode = (set_dpms_mode)fAccelerantHook(B_SET_DPMS_MODE, NULL);
|
||||
|
||||
// overlay
|
||||
fAccOverlayCount = (overlay_count)fAccelerantHook(B_OVERLAY_COUNT, NULL);
|
||||
fAccOverlaySupportedSpaces = (overlay_supported_spaces)fAccelerantHook(B_OVERLAY_SUPPORTED_SPACES, NULL);
|
||||
fAccOverlaySupportedFeatures = (overlay_supported_features)fAccelerantHook(B_OVERLAY_SUPPORTED_FEATURES, NULL);
|
||||
fAccAllocateOverlayBuffer = (allocate_overlay_buffer)fAccelerantHook(B_ALLOCATE_OVERLAY_BUFFER, NULL);
|
||||
fAccReleaseOverlayBuffer = (release_overlay_buffer)fAccelerantHook(B_RELEASE_OVERLAY_BUFFER, NULL);
|
||||
fAccGetOverlayConstraints = (get_overlay_constraints)fAccelerantHook(B_GET_OVERLAY_CONSTRAINTS, NULL);
|
||||
fAccAllocateOverlay = (allocate_overlay)fAccelerantHook(B_ALLOCATE_OVERLAY, NULL);
|
||||
fReleaseOverlay = (release_overlay)fAccelerantHook(B_RELEASE_OVERLAY, NULL);
|
||||
fConfigureOverlay = (configure_overlay)fAccelerantHook(B_CONFIGURE_OVERLAY, NULL);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -508,6 +519,7 @@ AccelerantHWInterface::GetModeList(display_mode** modes, uint32 *count)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
|
||||
{
|
||||
@ -519,6 +531,7 @@ AccelerantHWInterface::GetPixelClockLimits(display_mode *mode, uint32 *low, uint
|
||||
return fAccGetPixelClockLimits(mode, low, high);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::GetTimingConstraints(display_timing_constraints *dtc)
|
||||
{
|
||||
@ -533,6 +546,7 @@ AccelerantHWInterface::GetTimingConstraints(display_timing_constraints *dtc)
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high)
|
||||
{
|
||||
@ -552,7 +566,7 @@ AccelerantHWInterface::ProposeMode(display_mode *candidate, const display_mode *
|
||||
return fAccProposeDisplayMode(candidate, &this_low, &this_high);
|
||||
}
|
||||
|
||||
// RetraceSemaphore
|
||||
|
||||
sem_id
|
||||
AccelerantHWInterface::RetraceSemaphore()
|
||||
{
|
||||
@ -563,7 +577,7 @@ AccelerantHWInterface::RetraceSemaphore()
|
||||
return AccelerantRetraceSemaphore();
|
||||
}
|
||||
|
||||
// WaitForRetrace
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::WaitForRetrace(bigtime_t timeout)
|
||||
{
|
||||
@ -580,7 +594,7 @@ AccelerantHWInterface::WaitForRetrace(bigtime_t timeout)
|
||||
return acquire_sem_etc(sem, 1, B_RELATIVE_TIMEOUT, timeout);
|
||||
}
|
||||
|
||||
// SetDPMSMode
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::SetDPMSMode(const uint32 &state)
|
||||
{
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
|
||||
#include "HWInterface.h"
|
||||
|
||||
#include <image.h>
|
||||
#include <video_overlay.h>
|
||||
|
||||
class MallocBuffer;
|
||||
class AccelerantBuffer;
|
||||
@ -117,15 +119,24 @@ private:
|
||||
dpms_mode fAccDPMSMode;
|
||||
set_dpms_mode fAccSetDPMSMode;
|
||||
|
||||
// overlay hooks
|
||||
overlay_count fAccOverlayCount;
|
||||
overlay_supported_spaces fAccOverlaySupportedSpaces;
|
||||
overlay_supported_features fAccOverlaySupportedFeatures;
|
||||
allocate_overlay_buffer fAccAllocateOverlayBuffer;
|
||||
release_overlay_buffer fAccReleaseOverlayBuffer;
|
||||
get_overlay_constraints fAccGetOverlayConstraints;
|
||||
allocate_overlay fAccAllocateOverlay;
|
||||
release_overlay fReleaseOverlay;
|
||||
configure_overlay fConfigureOverlay;
|
||||
|
||||
frame_buffer_config fFrameBufferConfig;
|
||||
int fModeCount;
|
||||
display_mode *fModeList;
|
||||
|
||||
|
||||
MallocBuffer *fBackBuffer;
|
||||
AccelerantBuffer *fFrontBuffer;
|
||||
|
||||
|
||||
display_mode fDisplayMode;
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
SubDir HAIKU_TOP src servers app drawing ;
|
||||
|
||||
UseLibraryHeaders agg ;
|
||||
UsePrivateHeaders app interface shared [ FDirName servers app ] ;
|
||||
UsePrivateHeaders app graphics interface shared [ FDirName servers app ] ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ;
|
||||
|
@ -6,7 +6,7 @@ SetSubDirSupportedPlatforms libbe_test ;
|
||||
if $(TARGET_PLATFORM) = libbe_test {
|
||||
|
||||
UseLibraryHeaders agg png zlib ;
|
||||
UsePrivateHeaders app input interface shared [ FDirName servers app ] ;
|
||||
UsePrivateHeaders app graphics input interface shared [ FDirName servers app ] ;
|
||||
|
||||
local appServerDir = [ FDirName $(HAIKU_TOP) src servers app ] ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user