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
+5 -4
View File
@@ -260,12 +260,13 @@ enum overlay_options {
B_OVERLAY_TRANSFER_CHANNEL = 0x00080000 B_OVERLAY_TRANSFER_CHANNEL = 0x00080000
}; };
enum bitmap_filtering { enum bitmap_drawing_options {
B_FILTER_BITMAP_BILINEAR = 0x00000100 B_FILTER_BITMAP_BILINEAR = 0x00000100,
// TODO: Make this simply "SMOOTH_SCALE" and use
// better quality methods the faster the computer? B_WAIT_FOR_RETRACE = 0x00000800
}; };
// Default UI Colors // Default UI Colors
enum color_which { enum color_which {
+3 -16
View File
@@ -39,8 +39,6 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
fHasSubtitle(false), fHasSubtitle(false),
fSubtitleChanged(false), fSubtitleChanged(false),
fScreen(NULL),
fGlobalSettingsListener(this) fGlobalSettingsListener(this)
{ {
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
@@ -65,15 +63,6 @@ VideoView::~VideoView()
{ {
Settings::Default()->RemoveListener(&fGlobalSettingsListener); Settings::Default()->RemoveListener(&fGlobalSettingsListener);
delete fSubtitleBitmap; delete fSubtitleBitmap;
delete fScreen;
}
void
VideoView::AttachedToWindow()
{
delete fScreen;
fScreen = new BScreen(Window());
} }
@@ -377,11 +366,9 @@ void
VideoView::_DrawBitmap(const BBitmap* bitmap) VideoView::_DrawBitmap(const BBitmap* bitmap)
{ {
SetDrawingMode(B_OP_COPY); SetDrawingMode(B_OP_COPY);
uint32 options = fUseBilinearScaling ? B_FILTER_BITMAP_BILINEAR : 0; uint32 options = B_WAIT_FOR_RETRACE;
if (fUseBilinearScaling)
// We don't care if the graphics driver actually supports this. options |= B_FILTER_BITMAP_BILINEAR;
// On supported graphics hardware, this should avoid tearing.
fScreen->WaitForRetrace();
DrawBitmapAsync(bitmap, bitmap->Bounds(), fVideoFrame, options); DrawBitmapAsync(bitmap, bitmap->Bounds(), fVideoFrame, options);
} }
-4
View File
@@ -17,7 +17,6 @@ enum {
}; };
class BScreen;
class SubtitleBitmap; class SubtitleBitmap;
@@ -28,7 +27,6 @@ public:
virtual ~VideoView(); virtual ~VideoView();
// BView interface // BView interface
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void Pulse(); virtual void Pulse();
@@ -78,8 +76,6 @@ private:
bool fHasSubtitle; bool fHasSubtitle;
bool fSubtitleChanged; bool fSubtitleChanged;
BScreen* fScreen;
// Settings values: // Settings values:
ListenerAdapter fGlobalSettingsListener; ListenerAdapter fGlobalSettingsListener;
bool fUseOverlays; bool fUseOverlays;
+4 -1
View File
@@ -2278,7 +2278,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
#if 0 #if 0
if (strcmp(fServerApp->SignatureLeaf(), "x-vnd.videolan-vlc") == 0) if (strcmp(fServerApp->SignatureLeaf(), "x-vnd.videolan-vlc") == 0)
options |= B_FILTER_BITMAP_BILINEAR; info.options |= B_FILTER_BITMAP_BILINEAR;
#endif #endif
ServerBitmap* bitmap = fServerApp->GetBitmap(info.bitmapToken); ServerBitmap* bitmap = fServerApp->GetBitmap(info.bitmapToken);
@@ -2296,6 +2296,9 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
fCurrentView->ConvertToScreenForDrawing(&info.viewRect); fCurrentView->ConvertToScreenForDrawing(&info.viewRect);
if ((info.options & B_WAIT_FOR_RETRACE) != 0)
fDesktop->HWInterface()->WaitForRetrace(20000);
drawingEngine->DrawBitmap(bitmap, info.bitmapRect, drawingEngine->DrawBitmap(bitmap, info.bitmapRect,
info.viewRect, info.options); info.viewRect, info.options);