Skip to content

Commit

Permalink
Merge branch 'oomek-swf-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
mickelson committed Nov 13, 2018
2 parents 2287571 + 24bd1dc commit 03b95ef
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/fe_image.cpp
Expand Up @@ -154,6 +154,11 @@ bool FeBaseTextureContainer::get_mipmap() const
return false;
}

bool FeBaseTextureContainer::is_swf() const
{
return false;
}

void FeBaseTextureContainer::transition_swap( FeBaseTextureContainer *o )
{
//
Expand Down Expand Up @@ -1026,6 +1031,11 @@ bool FeTextureContainer::get_mipmap() const
return m_mipmap;
}

bool FeTextureContainer::is_swf() const
{
return m_swf;
}

void FeTextureContainer::release_audio( bool state )
{
#ifndef NO_MOVIE
Expand Down Expand Up @@ -1219,7 +1229,10 @@ void FeImage::draw(sf::RenderTarget& target, sf::RenderStates states) const
else
states.shader = FeBlend::get_default_shader( m_blend_mode );

states.blendMode = FeBlend::get_blend_mode( m_blend_mode );
if (( m_tex->is_swf() ) && ( m_blend_mode == FeBlend::Alpha ))
states.blendMode = FeBlend::get_blend_mode( FeBlend::Premultiplied );
else
states.blendMode = FeBlend::get_blend_mode( m_blend_mode );

target.draw( m_sprite, states );
}
Expand Down
2 changes: 2 additions & 0 deletions src/fe_image.hpp
Expand Up @@ -86,6 +86,7 @@ class FeBaseTextureContainer

virtual void set_mipmap( bool )=0;
virtual bool get_mipmap() const=0;
virtual bool is_swf() const;

// function for use with surface objects
//
Expand Down Expand Up @@ -159,6 +160,7 @@ class FeTextureContainer : public FeBaseTextureContainer

void set_mipmap( bool );
bool get_mipmap() const;
bool is_swf() const;

protected:
FeTextureContainer *get_derived_texture_container();
Expand Down
5 changes: 5 additions & 0 deletions src/swf.cpp
Expand Up @@ -180,6 +180,9 @@ bool FeSwf::open_from_file( const std::string &file )
m_texture.create( m_imp->root->get_movie_width(),
m_imp->root->get_movie_height() );

m_texture.setSmooth( true );

m_context.setActive( true );
m_texture.setActive();

// alpha blending
Expand Down Expand Up @@ -226,6 +229,7 @@ const sf::Texture &FeSwf::get_texture() const

bool FeSwf::tick()
{
m_context.setActive( true );
return do_frame( true );
}

Expand All @@ -252,6 +256,7 @@ bool FeSwf::do_frame( bool is_tick )
}

m_texture.display();
m_context.setActive( false );

return ( m_imp->root != NULL );
}
Expand Down
1 change: 1 addition & 0 deletions src/swf.hpp
Expand Up @@ -52,6 +52,7 @@ class FeSwf

FeSwfState *m_imp;
sf::RenderTexture m_texture;
sf::Context m_context;
};

#endif

0 comments on commit 03b95ef

Please sign in to comment.