Wait for the vertical retrace before blitting a bitmap,

should avoid tearing in the video on supported graphics
drivers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39094 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-10-23 20:57:25 +00:00
parent bda76e2de0
commit 550cf8fa5c
2 changed files with 22 additions and 2 deletions
+18 -2
View File
@@ -8,10 +8,10 @@
#include <stdio.h>
#include <Bitmap.h>
#include <Application.h>
#include <Bitmap.h>
#include <Region.h>
#include <Screen.h>
#include <WindowScreen.h>
#include "Settings.h"
@@ -39,6 +39,8 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
fHasSubtitle(false),
fSubtitleChanged(false),
fScreen(NULL),
fGlobalSettingsListener(this)
{
SetViewColor(B_TRANSPARENT_COLOR);
@@ -63,6 +65,15 @@ VideoView::~VideoView()
{
Settings::Default()->RemoveListener(&fGlobalSettingsListener);
delete fSubtitleBitmap;
delete fScreen;
}
void
VideoView::AttachedToWindow()
{
delete fScreen;
fScreen = new BScreen(Window());
}
@@ -367,6 +378,11 @@ 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();
DrawBitmapAsync(bitmap, bitmap->Bounds(), fVideoFrame, options);
}
+4
View File
@@ -17,6 +17,7 @@ enum {
};
class BScreen;
class SubtitleBitmap;
@@ -27,6 +28,7 @@ public:
virtual ~VideoView();
// BView interface
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message);
virtual void Pulse();
@@ -76,6 +78,8 @@ private:
bool fHasSubtitle;
bool fSubtitleChanged;
BScreen* fScreen;
// Settings values:
ListenerAdapter fGlobalSettingsListener;
bool fUseOverlays;