From 76d9e05341c5ad13dbb0a799ab7463b6639a9a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 23 Oct 2010 22:22:45 +0000 Subject: [PATCH] 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 --- headers/os/interface/InterfaceDefs.h | 9 +++++---- src/apps/mediaplayer/VideoView.cpp | 19 +++---------------- src/apps/mediaplayer/VideoView.h | 4 ---- src/servers/app/ServerWindow.cpp | 5 ++++- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/headers/os/interface/InterfaceDefs.h b/headers/os/interface/InterfaceDefs.h index 7f5a84a8b8..1e5a401096 100644 --- a/headers/os/interface/InterfaceDefs.h +++ b/headers/os/interface/InterfaceDefs.h @@ -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 { diff --git a/src/apps/mediaplayer/VideoView.cpp b/src/apps/mediaplayer/VideoView.cpp index 876cd31423..2adf60e8a3 100644 --- a/src/apps/mediaplayer/VideoView.cpp +++ b/src/apps/mediaplayer/VideoView.cpp @@ -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); } diff --git a/src/apps/mediaplayer/VideoView.h b/src/apps/mediaplayer/VideoView.h index 35a207ec25..4eb7372c79 100644 --- a/src/apps/mediaplayer/VideoView.h +++ b/src/apps/mediaplayer/VideoView.h @@ -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; diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index a74514c3f7..a2d57fa78c 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -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);