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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user