From 70f4f74e110b7cdeb2c50306851b0478d19168d8 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Wed, 25 Jul 2018 00:00:35 +0200 Subject: [PATCH] Draw the wide background with win movies --- src/movie.cxx | 39 +++++++++++++++++++++++++++++++++------ src/movie.h | 1 + 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/movie.cxx b/src/movie.cxx index 5d841f0..e3bbaad 100644 --- a/src/movie.cxx +++ b/src/movie.cxx @@ -26,6 +26,7 @@ #include "blupi.h" #include "def.h" +#include "display.h" #include "event.h" #include "misc.h" #include "movie.h" @@ -129,13 +130,23 @@ CMovie::fileOpenMovie (const std::string & pFilename) m_audioDev = SDL_OpenAudioDevice (nullptr, 0, &wanted_spec, &audio_spec, 0); SDL_PauseAudioDevice (m_audioDev, 0); + if (g_bFullScreen && g_zoom == 1) + SDL_SetHint (SDL_HINT_RENDER_SCALE_QUALITY, "best"); m_videoTex = SDL_CreateTexture ( g_renderer, info.video.output.format, SDL_TEXTUREACCESS_TARGET, info.video.output.width, info.video.output.height); + if (g_bFullScreen && g_zoom == 1) + SDL_SetHint (SDL_HINT_RENDER_SCALE_QUALITY, "nearset"); if (m_videoTex == nullptr) return false; + if (Display::getDisplay ().isWide ()) + { + if (path.rfind ("win005.mkv") != std::string::npos) + this->chBackWide = CHBACKWIN0; + } + return true; } else @@ -177,6 +188,9 @@ CMovie::CMovie (CPixmap * pixmap) memset (m_audiobuf, 0, sizeof (m_audiobuf)); + this->chBackWide = CHNONE; + this->rw_ops = nullptr; + m_ret = 0; } @@ -284,16 +298,29 @@ CMovie::Render () SDL_PauseAudioDevice (m_audioDev, 0); } - // Clear screen with black - SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255); - SDL_RenderClear (g_renderer); - if (this->starting) { - SDL_SetRenderTarget (g_renderer, m_videoTex); + // Clear screen with black SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255); SDL_RenderClear (g_renderer); - SDL_SetRenderTarget (g_renderer, nullptr); + + if (this->chBackWide == CHNONE) + { + SDL_SetRenderTarget (g_renderer, m_videoTex); + SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255); + SDL_RenderClear (g_renderer); + SDL_SetRenderTarget (g_renderer, nullptr); + } + else + { + SDL_Rect rect; + rect.x = 0; + rect.y = 0; + rect.w = LXIMAGE (); + rect.h = LYIMAGE (); + auto texture = this->pixmap->getTexture (chBackWide); + SDL_RenderCopy (g_renderer, texture, &rect, nullptr); + } this->starting = false; } diff --git a/src/movie.h b/src/movie.h index 86dc21c..6c2a5b1 100644 --- a/src/movie.h +++ b/src/movie.h @@ -60,6 +60,7 @@ protected: Sint32 m_ret; SDL_AudioDeviceID m_audioDev; SDL_RWops * rw_ops; + int chBackWide; char m_audiobuf[AUDIOBUFFER_SIZE]; bool m_bEnable;