[planetblupi] 19/61: Clear the texture when the movie is starting
Didier Raboud
odyx at moszumanska.debian.org
Thu Nov 2 19:24:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository planetblupi.
commit c8cf431e389580fd94e7ce7e4c7bcefb265dd93c
Author: Mathieu Schroeter <mathieu at schroetersa.ch>
Date: Sat Oct 21 21:30:26 2017 +0200
Clear the texture when the movie is starting
Otherwise it's possible to see garbage with the first frame.
---
src/movie.cxx | 14 +++++++++++++-
src/movie.h | 1 +
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/movie.cxx b/src/movie.cxx
index 7b22e84..a7172bf 100644
--- a/src/movie.cxx
+++ b/src/movie.cxx
@@ -121,7 +121,7 @@ CMovie::fileOpenMovie (const std::string & pFilename)
SDL_PauseAudioDevice (m_audioDev, 0);
m_videoTex = SDL_CreateTexture (
- g_renderer, info.video.format, SDL_TEXTUREACCESS_STATIC, info.video.width,
+ g_renderer, info.video.format, SDL_TEXTUREACCESS_TARGET, info.video.width,
info.video.height);
if (m_videoTex == nullptr)
@@ -146,7 +146,10 @@ CMovie::playMovie ()
// play/pause the AVI movie
if (m_fPlaying)
+ {
+ this->starting = true;
Kit_PlayerPlay (m_player);
+ }
else
Kit_PlayerPause (m_player);
}
@@ -290,6 +293,15 @@ CMovie::Render ()
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
SDL_RenderClear (g_renderer);
+ if (this->starting)
+ {
+ SDL_SetRenderTarget (g_renderer, m_videoTex);
+ SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
+ SDL_RenderClear (g_renderer);
+ SDL_SetRenderTarget (g_renderer, nullptr);
+ this->starting = false;
+ }
+
// Refresh videotexture and render it
Kit_GetVideoData (m_player, m_videoTex);
SDL_RenderCopy (g_renderer, m_videoTex, nullptr, nullptr);
diff --git a/src/movie.h b/src/movie.h
index 9c2f61d..bd9098f 100644
--- a/src/movie.h
+++ b/src/movie.h
@@ -60,6 +60,7 @@ protected:
char m_audiobuf[AUDIOBUFFER_SIZE];
bool m_bEnable;
+ bool starting;
bool m_fPlaying; // Play flag: true == playing, false == paused
bool m_fMovieOpen; // Open flag: true == movie open, false = none
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git
More information about the Pkg-games-commits
mailing list