Skip to content

Commit

Permalink
Issue #499 - Fixed to show empty space when image/artwork fails to load
Browse files Browse the repository at this point in the history
Recent changes inadvertently introduced this bug.  Committing this in
prep for a patch release 2.5.1
  • Loading branch information
mickelson committed Nov 13, 2018
1 parent 03b95ef commit b263963
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/fe_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ bool FeTextureContainer::load_with_ffmpeg(
clear();

if ( !file_exists( path ) )
{
m_texture = sf::Texture();
return false;
}

m_movie = new FeMedia( FeMedia::AudioVideo );
res = m_movie->open( path, filename, &m_texture );
Expand All @@ -330,7 +333,10 @@ bool FeTextureContainer::load_with_ffmpeg(
clear();

if ( !file_exists( loaded_name ) )
{
m_texture = sf::Texture();
return false;
}

m_movie = new FeMedia( FeMedia::AudioVideo );
res = m_movie->open( "", loaded_name, &m_texture );
Expand Down Expand Up @@ -386,7 +392,10 @@ bool FeTextureContainer::try_to_load(
clear();

if ( !file_exists( path ) )
{
m_texture = sf::Texture();
return false;
}

m_swf = new FeSwf();

Expand All @@ -410,7 +419,10 @@ bool FeTextureContainer::try_to_load(
clear();

if ( !file_exists( loaded_name ) )
{
m_texture = sf::Texture();
return false;
}

m_swf = new FeSwf();
if (!m_swf->open_from_file( loaded_name ))
Expand Down Expand Up @@ -444,7 +456,10 @@ bool FeTextureContainer::try_to_load(
clear();

if ( !file_exists( path ) )
{
m_texture = sf::Texture();
return false;
}

FeZipStream zs( path );
if ( !zs.open( filename ) )
Expand Down Expand Up @@ -478,7 +493,10 @@ bool FeTextureContainer::try_to_load(
clear();

if ( !file_exists( loaded_name ) )
{
m_texture = sf::Texture();
return false;
}

FeFileInputStream filestream( loaded_name );
if ( load_to_texture( filestream ) )
Expand Down Expand Up @@ -681,7 +699,10 @@ void FeTextureContainer::internal_update_selection( FeSettings *feSettings )
if ( !loaded )
{
if ( image_list.empty() )
{
clear();
m_texture = sf::Texture();
}
else
{
for ( itr=image_list.begin();
Expand Down Expand Up @@ -927,6 +948,7 @@ void FeTextureContainer::load_from_archive( const char *a, const char *n )
if ( filename.empty() )
{
clear();
m_texture = sf::Texture();
notify_texture_change();
return;
}
Expand Down

3 comments on commit b263963

@oomek
Copy link
Collaborator

@oomek oomek commented on b263963 Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one problem that did not exist before. Every time when you call m_texture = sf::Texture() you loose smoothing and it needs to be set again, so now on navigation the smoothing is reset when no texture is found. Also SWF files do not react to changes to smoothing property and they are always pixelated. Since AM do not store the smoothing in any variable, it just sets the setSmooth() once I think it's neccessary to store the smoothing state in m_smooth and reapply it every time you load a new texture or swf.

@oomek
Copy link
Collaborator

@oomek oomek commented on b263963 Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides now when you pass the non existing texture to the shader with set_texture_param() you have undefined behaviour in the shader. My PR #503 fixes that, but for some reason you have decided not to include it.

@oomek
Copy link
Collaborator

@oomek oomek commented on b263963 Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoothing fixed in PR #506

Please sign in to comment.