Introduce a new flag for drawing BBitmaps, B_WAIT_FOR_RETRACE

which triggers waiting on the retrace semaphore in app_server
just before drawing the bitmap. This potentially removes any
additional delay when doing this client side. Completely untested. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39097 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-10-23 22:22:45 +00:00
parent ed55cb5a22
commit 76d9e05341
4 changed files with 12 additions and 25 deletions

View File

@ -260,12 +260,13 @@ enum overlay_options {
B_OVERLAY_TRANSFER_CHANNEL = 0x00080000
};
enum bitmap_filtering {
B_FILTER_BITMAP_BILINEAR = 0x00000100
// TODO: Make this simply "SMOOTH_SCALE" and use
// better quality methods the faster the computer?
enum bitmap_drawing_options {
B_FILTER_BITMAP_BILINEAR = 0x00000100,
B_WAIT_FOR_RETRACE = 0x00000800
};
// Default UI Colors
enum color_which {

View File

@ -39,8 +39,6 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
fHasSubtitle(false),
fSubtitleChanged(false),
fScreen(NULL),
fGlobalSettingsListener(this)
{
SetViewColor(B_TRANSPARENT_COLOR);
@ -65,15 +63,6 @@ VideoView::~VideoView()
{
Settings::Default()->RemoveListener(&fGlobalSettingsListener);
delete fSubtitleBitmap;
delete fScreen;
}
void
VideoView::AttachedToWindow()
{
delete fScreen;
fScreen = new BScreen(Window());
}
@ -377,11 +366,9 @@ void
VideoView::_DrawBitmap(const BBitmap* bitmap)
{
SetDrawingMode(B_OP_COPY);
uint32 options = fUseBilinearScaling ? B_FILTER_BITMAP_BILINEAR : 0;
// We don't care if the graphics driver actually supports this.
// On supported graphics hardware, this should avoid tearing.
fScreen->WaitForRetrace();
uint32 options = B_WAIT_FOR_RETRACE;
if (fUseBilinearScaling)
options |= B_FILTER_BITMAP_BILINEAR;
DrawBitmapAsync(bitmap, bitmap->Bounds(), fVideoFrame, options);
}

View File

@ -17,7 +17,6 @@ enum {
};
class BScreen;
class SubtitleBitmap;
@ -28,7 +27,6 @@ public:
virtual ~VideoView();
// BView interface
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message);
virtual void Pulse();
@ -78,8 +76,6 @@ private:
bool fHasSubtitle;
bool fSubtitleChanged;
BScreen* fScreen;
// Settings values:
ListenerAdapter fGlobalSettingsListener;
bool fUseOverlays;

View File

@ -2278,7 +2278,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
#if 0
if (strcmp(fServerApp->SignatureLeaf(), "x-vnd.videolan-vlc") == 0)
options |= B_FILTER_BITMAP_BILINEAR;
info.options |= B_FILTER_BITMAP_BILINEAR;
#endif
ServerBitmap* bitmap = fServerApp->GetBitmap(info.bitmapToken);
@ -2296,6 +2296,9 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
fCurrentView->ConvertToScreenForDrawing(&info.viewRect);
if ((info.options & B_WAIT_FOR_RETRACE) != 0)
fDesktop->HWInterface()->WaitForRetrace(20000);
drawingEngine->DrawBitmap(bitmap, info.bitmapRect,
info.viewRect, info.options);