* Changed the way the overlay_view|window is maintained - it's now in Overlay.
* The overlay options as part of BView::SetViewOverlay() are now passed over to the graphics driver - looks like the color key stuff cannot be turned off (at least not via the Be API). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17323 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1532,8 +1532,10 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
fWindowLayer->InvalidateView(fCurrentLayer, dirty);
|
fWindowLayer->InvalidateView(fCurrentLayer, dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitmap != NULL && bitmap->Overlay() != NULL)
|
if (bitmap != NULL && bitmap->Overlay() != NULL) {
|
||||||
|
bitmap->Overlay()->SetFlags(options);
|
||||||
colorKey = bitmap->Overlay()->Color().GetColor32();
|
colorKey = bitmap->Overlay()->Color().GetColor32();
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
status = B_BAD_VALUE;
|
status = B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -374,6 +374,12 @@ AccelerantHWInterface::SetMode(const display_mode &mode)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some safety checks
|
||||||
|
// TODO: more of those!
|
||||||
|
if (fDisplayMode.virtual_width < 320
|
||||||
|
|| fDisplayMode.virtual_height < 200)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
// just try to set the mode - we let the graphics driver
|
// just try to set the mode - we let the graphics driver
|
||||||
// approve or deny the request, as it should know best
|
// approve or deny the request, as it should know best
|
||||||
|
|
||||||
@@ -790,59 +796,11 @@ AccelerantHWInterface::HideOverlay(Overlay* overlay)
|
|||||||
void
|
void
|
||||||
AccelerantHWInterface::UpdateOverlay(Overlay* overlay)
|
AccelerantHWInterface::UpdateOverlay(Overlay* overlay)
|
||||||
{
|
{
|
||||||
const overlay_buffer* buffer = overlay->OverlayBuffer();
|
// TODO: this only needs to be done on mode changes!
|
||||||
|
overlay->SetColorSpace(fDisplayMode.space);
|
||||||
|
|
||||||
overlay_view view;
|
fAccConfigureOverlay(overlay->OverlayToken(), overlay->OverlayBuffer(),
|
||||||
view.h_start = (uint16)overlay->Source().left;
|
overlay->OverlayWindow(), overlay->OverlayView());
|
||||||
view.v_start = (uint16)overlay->Source().top;
|
|
||||||
view.width = (uint16)overlay->Source().IntegerWidth() + 1;
|
|
||||||
view.height = (uint16)overlay->Source().IntegerHeight() + 1;
|
|
||||||
|
|
||||||
overlay_window window;
|
|
||||||
window.h_start = (int16)overlay->Destination().left;
|
|
||||||
window.v_start = (int16)overlay->Destination().top;
|
|
||||||
window.width = (uint16)overlay->Destination().IntegerWidth() + 1;
|
|
||||||
window.height = (uint16)overlay->Destination().IntegerHeight() + 1;
|
|
||||||
|
|
||||||
window.offset_top = 0;
|
|
||||||
window.offset_left = 0;
|
|
||||||
window.offset_right = 0;
|
|
||||||
window.offset_bottom = 0;
|
|
||||||
|
|
||||||
// TODO: for now, this should be done somewhere else, ideally
|
|
||||||
rgb_color colorKey = overlay->Color().GetColor32();
|
|
||||||
uint8 colorShift = 0, greenShift = 0, alphaShift = 0;
|
|
||||||
switch (fDisplayMode.space) {
|
|
||||||
case B_CMAP8:
|
|
||||||
colorKey.red = 0xff;
|
|
||||||
colorKey.green = 0xff;
|
|
||||||
colorKey.blue = 0xff;
|
|
||||||
colorKey.alpha = 0xff;
|
|
||||||
break;
|
|
||||||
case B_RGB15:
|
|
||||||
greenShift = colorShift = 3;
|
|
||||||
alphaShift = 7;
|
|
||||||
break;
|
|
||||||
case B_RGB16:
|
|
||||||
colorShift = 3;
|
|
||||||
greenShift = 2;
|
|
||||||
alphaShift = 8;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
window.red.value = colorKey.red >> colorShift;
|
|
||||||
window.green.value = colorKey.green >> greenShift;
|
|
||||||
window.blue.value = colorKey.blue >> colorShift;
|
|
||||||
window.alpha.value = colorKey.alpha >> alphaShift;
|
|
||||||
window.red.mask = 0xff >> colorShift;
|
|
||||||
window.green.mask = 0xff >> greenShift;
|
|
||||||
window.blue.mask = 0xff >> colorShift;
|
|
||||||
window.alpha.mask = 0xff >> alphaShift;
|
|
||||||
// TODO: we need the 'uint32 options' from BView::SetViewOverlay() here
|
|
||||||
// for now using commonly used settings (should be 'safe')
|
|
||||||
window.flags =
|
|
||||||
B_OVERLAY_COLOR_KEY | B_OVERLAY_VERTICAL_FILTERING | B_OVERLAY_HORIZONTAL_FILTERING;
|
|
||||||
|
|
||||||
fAccConfigureOverlay(overlay->OverlayToken(), buffer, &window, &view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
#include <BitmapPrivate.h>
|
#include <BitmapPrivate.h>
|
||||||
|
|
||||||
|
#include <InterfaceDefs.h>
|
||||||
|
|
||||||
|
|
||||||
Overlay::Overlay(HWInterface& interface)
|
Overlay::Overlay(HWInterface& interface)
|
||||||
:
|
:
|
||||||
@@ -23,6 +25,13 @@ Overlay::Overlay(HWInterface& interface)
|
|||||||
fSemaphore = create_sem(1, "overlay lock");
|
fSemaphore = create_sem(1, "overlay lock");
|
||||||
fColor.SetColor(21, 16, 21, 16);
|
fColor.SetColor(21, 16, 21, 16);
|
||||||
// TODO: whatever fine color we want to use here...
|
// TODO: whatever fine color we want to use here...
|
||||||
|
|
||||||
|
fWindow.offset_top = 0;
|
||||||
|
fWindow.offset_left = 0;
|
||||||
|
fWindow.offset_right = 0;
|
||||||
|
fWindow.offset_bottom = 0;
|
||||||
|
|
||||||
|
fWindow.flags = B_OVERLAY_COLOR_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,6 +64,18 @@ Overlay::SetOverlayData(const overlay_buffer* overlayBuffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Overlay::SetFlags(uint32 flags)
|
||||||
|
{
|
||||||
|
if (flags & B_OVERLAY_FILTER_HORIZONTAL)
|
||||||
|
fWindow.flags |= B_OVERLAY_HORIZONTAL_FILTERING;
|
||||||
|
if (flags & B_OVERLAY_FILTER_VERTICAL)
|
||||||
|
fWindow.flags |= B_OVERLAY_VERTICAL_FILTERING;
|
||||||
|
if (flags & B_OVERLAY_MIRROR)
|
||||||
|
fWindow.flags |= B_OVERLAY_HORIZONTAL_MIRRORING;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Overlay::TakeOverToken(Overlay* other)
|
Overlay::TakeOverToken(Overlay* other)
|
||||||
{
|
{
|
||||||
@@ -111,15 +132,60 @@ Overlay::Hide()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Overlay::SetColorSpace(uint32 colorSpace)
|
||||||
|
{
|
||||||
|
if ((fWindow.flags & B_OVERLAY_COLOR_KEY) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8 colorShift = 0, greenShift = 0, alphaShift = 0;
|
||||||
|
rgb_color colorKey = fColor.GetColor32();
|
||||||
|
|
||||||
|
switch (colorSpace) {
|
||||||
|
case B_CMAP8:
|
||||||
|
colorKey.red = 0xff;
|
||||||
|
colorKey.green = 0xff;
|
||||||
|
colorKey.blue = 0xff;
|
||||||
|
colorKey.alpha = 0xff;
|
||||||
|
break;
|
||||||
|
case B_RGB15:
|
||||||
|
greenShift = colorShift = 3;
|
||||||
|
alphaShift = 7;
|
||||||
|
break;
|
||||||
|
case B_RGB16:
|
||||||
|
colorShift = 3;
|
||||||
|
greenShift = 2;
|
||||||
|
alphaShift = 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
fWindow.red.value = colorKey.red >> colorShift;
|
||||||
|
fWindow.green.value = colorKey.green >> greenShift;
|
||||||
|
fWindow.blue.value = colorKey.blue >> colorShift;
|
||||||
|
fWindow.alpha.value = colorKey.alpha >> alphaShift;
|
||||||
|
fWindow.red.mask = 0xff >> colorShift;
|
||||||
|
fWindow.green.mask = 0xff >> greenShift;
|
||||||
|
fWindow.blue.mask = 0xff >> colorShift;
|
||||||
|
fWindow.alpha.mask = 0xff >> alphaShift;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Overlay::SetView(const BRect& source, const BRect& destination)
|
Overlay::SetView(const BRect& source, const BRect& destination)
|
||||||
{
|
{
|
||||||
fSource = source;
|
|
||||||
fDestination = destination;
|
|
||||||
|
|
||||||
if (fOverlayToken == NULL)
|
if (fOverlayToken == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
fView.h_start = (uint16)source.left;
|
||||||
|
fView.v_start = (uint16)source.top;
|
||||||
|
fView.width = (uint16)source.IntegerWidth() + 1;
|
||||||
|
fView.height = (uint16)source.IntegerHeight() + 1;
|
||||||
|
|
||||||
|
fWindow.h_start = (int16)destination.left;
|
||||||
|
fWindow.v_start = (int16)destination.top;
|
||||||
|
fWindow.width = (uint16)destination.IntegerWidth() + 1;
|
||||||
|
fWindow.height = (uint16)destination.IntegerHeight() + 1;
|
||||||
|
|
||||||
fHWInterface.UpdateOverlay(this);
|
fHWInterface.UpdateOverlay(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
|
|
||||||
#include <video_overlay.h>
|
#include <video_overlay.h>
|
||||||
|
|
||||||
//#include <GraphicsDefs.h>
|
|
||||||
//#include <Rect.h>
|
|
||||||
//#include <OS.h>
|
|
||||||
|
|
||||||
|
|
||||||
class HWInterface;
|
class HWInterface;
|
||||||
struct overlay_client_data;
|
struct overlay_client_data;
|
||||||
@@ -31,12 +27,20 @@ class Overlay {
|
|||||||
|
|
||||||
void SetOverlayData(const overlay_buffer* overlayBuffer,
|
void SetOverlayData(const overlay_buffer* overlayBuffer,
|
||||||
overlay_token token, overlay_client_data* clientData);
|
overlay_token token, overlay_client_data* clientData);
|
||||||
|
void SetFlags(uint32 flags);
|
||||||
void TakeOverToken(Overlay* other);
|
void TakeOverToken(Overlay* other);
|
||||||
|
|
||||||
const overlay_buffer* OverlayBuffer() const;
|
const overlay_buffer* OverlayBuffer() const;
|
||||||
overlay_client_data* ClientData() const;
|
overlay_client_data* ClientData() const;
|
||||||
overlay_token OverlayToken() const;
|
overlay_token OverlayToken() const;
|
||||||
|
|
||||||
|
void SetColorSpace(uint32 colorSpace);
|
||||||
|
|
||||||
|
const overlay_window* OverlayWindow() const
|
||||||
|
{ return &fWindow; }
|
||||||
|
const overlay_view* OverlayView() const
|
||||||
|
{ return &fView; }
|
||||||
|
|
||||||
sem_id Semaphore() const
|
sem_id Semaphore() const
|
||||||
{ return fSemaphore; }
|
{ return fSemaphore; }
|
||||||
|
|
||||||
@@ -49,10 +53,6 @@ class Overlay {
|
|||||||
{ return fVisible; }
|
{ return fVisible; }
|
||||||
|
|
||||||
void SetView(const BRect& source, const BRect& destination);
|
void SetView(const BRect& source, const BRect& destination);
|
||||||
const BRect& Source() const
|
|
||||||
{ return fSource; }
|
|
||||||
const BRect& Destination() const
|
|
||||||
{ return fDestination; }
|
|
||||||
|
|
||||||
void Show();
|
void Show();
|
||||||
void Hide();
|
void Hide();
|
||||||
@@ -62,10 +62,10 @@ class Overlay {
|
|||||||
const overlay_buffer* fOverlayBuffer;
|
const overlay_buffer* fOverlayBuffer;
|
||||||
overlay_client_data* fClientData;
|
overlay_client_data* fClientData;
|
||||||
overlay_token fOverlayToken;
|
overlay_token fOverlayToken;
|
||||||
|
overlay_view fView;
|
||||||
|
overlay_window fWindow;
|
||||||
sem_id fSemaphore;
|
sem_id fSemaphore;
|
||||||
RGBColor fColor;
|
RGBColor fColor;
|
||||||
BRect fSource;
|
|
||||||
BRect fDestination;
|
|
||||||
bool fVisible;
|
bool fVisible;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user