From 725b24098dbc007f20561409748efef86173b15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 23 Aug 2008 14:23:22 +0000 Subject: [PATCH] * Fix display update when toggling the scaling mode when the video is paused without disturbing the same thing during normal playback. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27176 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/Controller.cpp | 5 ++++- src/apps/mediaplayer/VideoView.cpp | 15 +++++++++++++++ src/apps/mediaplayer/VideoView.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/apps/mediaplayer/Controller.cpp b/src/apps/mediaplayer/Controller.cpp index f0708f5416..2554c4136c 100644 --- a/src/apps/mediaplayer/Controller.cpp +++ b/src/apps/mediaplayer/Controller.cpp @@ -888,7 +888,10 @@ Controller::_NotifyMutedChanged(bool muted) const void Controller::NotifyPlayModeChanged(int32 mode) const { - _NotifyPlaybackStateChanged(_PlaybackState(mode)); + uint32 state = _PlaybackState(mode); + if (fVideoView) + fVideoView->SetPlaying(state == PLAYBACK_STATE_PLAYING); + _NotifyPlaybackStateChanged(state); } diff --git a/src/apps/mediaplayer/VideoView.cpp b/src/apps/mediaplayer/VideoView.cpp index a608695fde..83bca81968 100644 --- a/src/apps/mediaplayer/VideoView.cpp +++ b/src/apps/mediaplayer/VideoView.cpp @@ -14,6 +14,7 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask) : BView(frame, name, resizeMask, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), fOverlayMode(false), + fIsPlaying(false), fGlobalSettingsListener(this) { SetViewColor(B_TRANSPARENT_COLOR); @@ -21,6 +22,7 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask) SetHighColor(0, 0, 0); // create some hopefully sensible default overlay restrictions + // they will be adjusted when overlays are actually used fOverlayRestrictions.min_width_scale = 0.25; fOverlayRestrictions.max_width_scale = 8.0; fOverlayRestrictions.min_height_scale = 0.25; @@ -61,6 +63,7 @@ VideoView::MessageReceived(BMessage* message) { switch (message->what) { case MSG_OBJECT_CHANGED: + // received from fGlobalSettingsListener // TODO: find out which object, if we ever watch more than // the global settings instance... _AdoptGlobalSettings(); @@ -195,6 +198,14 @@ VideoView::DisableOverlay() } +void +VideoView::SetPlaying(bool playing) +{ + printf("VideoView::SetPlaying(%d)\n", playing); + fIsPlaying = playing; +} + + // #pragma mark - @@ -214,8 +225,12 @@ void VideoView::_AdoptGlobalSettings() { mpSettings settings = Settings::CurrentSettings(); + // thread safe fUseOverlays = settings.useOverlays; fUseBilinearScaling = settings.scaleBilinear; + + if (!fIsPlaying && !fOverlayMode) + Invalidate(); } diff --git a/src/apps/mediaplayer/VideoView.h b/src/apps/mediaplayer/VideoView.h index d68a4ab6fe..de03e912d7 100644 --- a/src/apps/mediaplayer/VideoView.h +++ b/src/apps/mediaplayer/VideoView.h @@ -36,6 +36,8 @@ public: bool IsOverlayActive(); void DisableOverlay(); + void SetPlaying(bool playing); + private: void _DrawBitmap(const BBitmap* bitmap); void _AdoptGlobalSettings(); @@ -43,6 +45,7 @@ private: bool fOverlayMode; overlay_restrictions fOverlayRestrictions; rgb_color fOverlayKeyColor; + bool fIsPlaying; ListenerAdapter fGlobalSettingsListener; bool fUseOverlays;