@@ -58,11 +58,12 @@ Player::Player(std::shared_ptr<ImageSource> src)
5858 mFramesCache .emplace_back (loadZeroFrame (src.get ()));
5959 mCacheIndex = 0 ;
6060
61- if (auto bmp = mFramesCache [0 ]->page ->getSourceBitmap ()) {
62- if (FreeImage_HasBackgroundColor (bmp)) {
63- FreeImage_GetBackgroundColor (bmp, &mBgColor );
64- }
65- }
61+ // if (auto bmp = mFramesCache[0]->page->getSourceBitmap()) {
62+ // if (FreeImage_HasBackgroundColor(bmp)) {
63+ // FreeImage_GetBackgroundColor(bmp, &mBgColor);
64+ // mBgColor.alpha = mBgColor.alpha ? 255 : 0; // backgroung cannot be semi-transparent
65+ // }
66+ // }
6667 }
6768 catch (...) {
6869 mFramesCache .clear ();
@@ -109,13 +110,14 @@ std::unique_ptr<Player::CacheEntry> Player::loadNextFrame(ImageSource* source, c
109110 const auto & nextAnim = nextEntry->page ->animation ();
110111
111112 UniqueBitmap canvas (nullptr , &::FreeImage_Unload);
112- if ((disposal == DisposalType::eBackground) && (FreeImage_GetImageType (nextBmp) == FIT_BITMAP)) {
113- // animation is usually FIT_BITMAP
114- canvas.reset (FreeImageExt_AllocateLike (nextBmp));
115- if (!FreeImage_FillBackground (canvas.get (), &mBgColor )) {
116- // failed...
117- canvas.reset ();
118- }
113+ // animation is usually FIT_BITMAP
114+ if ((disposal == DisposalType::eBackground)) {
115+ // Background color is not always set correctly.
116+ // Taking frame without any blending is more robust.
117+ // if ((mBgColor.alpha == 255) && (FreeImage_GetImageType(nextBmp) == FIT_BITMAP)) {
118+ // canvas.reset(FreeImageExt_AllocateLike(nextBmp));
119+ // FreeImage_FillBackground(canvas.get(), &mBgColor);
120+ // }
119121 }
120122 else {
121123 // by default DisposalType::eLeave
0 commit comments