~ fixed video background playback being broken

~ CTexture should properly pick up the right width and height for animated backgrounds too

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2022-03-01 00:29:26 +01:00
parent 64d2f77d41
commit 34635ba6ac
2 changed files with 10 additions and 6 deletions

View File

@ -227,14 +227,18 @@ int main (int argc, char* argv[])
return 3;
}
// parse the project.json file
auto project = WallpaperEngine::Core::CProject::fromFile ("project.json", containers);
// go to the right folder so the videos will play
if (project->getWallpaper ()->is <WallpaperEngine::Core::CVideo> () == true)
chdir (path.c_str ());
// initialize custom context class
WallpaperEngine::Render::CContext* context = new WallpaperEngine::Render::CContext (screens, window);
// initialize mouse support
context->setMouse (new CMouseInput (window));
// set the default viewport
context->setDefaultViewport ({0, 0, windowWidth, windowHeight});
// parse the project.json file
auto project = WallpaperEngine::Core::CProject::fromFile ("project.json", containers);
// ensure the context knows what wallpaper to render
context->setWallpaper (
WallpaperEngine::Render::CWallpaper::fromWallpaper (project->getWallpaper (), containers, context)

View File

@ -24,8 +24,8 @@ CTexture::CTexture (void* fileData)
{
// set the texture resolution
this->m_resolution = {
this->m_header->textureWidth, this->m_header->textureHeight,
this->m_header->width, this->m_header->height
this->m_header->textureWidth, this->m_header->textureHeight,
this->m_header->width, this->m_header->height
};
}
@ -212,12 +212,12 @@ const uint32_t CTexture::getTextureHeight () const
const uint32_t CTexture::getRealWidth () const
{
return this->getHeader ()->width;
return this->isAnimated () == true ? this->getHeader ()->gifWidth : this->getHeader ()->width;
}
const uint32_t CTexture::getRealHeight () const
{
return this->getHeader ()->height;
return this->isAnimated () == true ? this->getHeader ()->gifHeight : this->getHeader ()->height;
}
const ITexture::TextureFormat CTexture::getFormat () const