Fix a custom shader issue
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / texture-manager-impl.cpp
index 39e180b..1ea95a9 100644 (file)
@@ -115,6 +115,8 @@ TextureManager::MaskingData::MaskingData()
 TextureManager::TextureManager()
 : mAsyncLocalLoaders( GetNumberOfLocalLoaderThreads(), [&]() { return AsyncLoadingHelper(*this); } ),
   mAsyncRemoteLoaders( GetNumberOfRemoteLoaderThreads(), [&]() { return AsyncLoadingHelper(*this); } ),
+  mExternalTextures(),
+  mLifecycleObservers(),
   mBrokenImageUrl(""),
   mCurrentTextureId( 0 )
 {
@@ -129,13 +131,13 @@ TextureManager::~TextureManager()
 }
 
 TextureSet TextureManager::LoadTexture(
-    const VisualUrl& url, Dali::ImageDimensions desiredSize, Dali::FittingMode::Type fittingMode,
-    Dali::SamplingMode::Type samplingMode, const MaskingDataPointer& maskInfo,
-    bool synchronousLoading, TextureManager::TextureId& textureId, Vector4& textureRect,
-    bool& atlasingStatus, bool& loadingStatus, Dali::WrapMode::Type wrapModeU,
-    Dali::WrapMode::Type wrapModeV, TextureUploadObserver* textureObserver,
-    AtlasUploadObserver* atlasObserver, ImageAtlasManagerPtr imageAtlasManager, bool orientationCorrection,
-    TextureManager::ReloadPolicy reloadPolicy, TextureManager::MultiplyOnLoad& preMultiplyOnLoad )
+  const VisualUrl& url, Dali::ImageDimensions desiredSize, Dali::FittingMode::Type fittingMode,
+  Dali::SamplingMode::Type samplingMode, const MaskingDataPointer& maskInfo,
+  bool synchronousLoading, TextureManager::TextureId& textureId, Vector4& textureRect,
+  Dali::ImageDimensions& textureRectSize, bool& atlasingStatus, bool& loadingStatus,
+  Dali::WrapMode::Type wrapModeU, Dali::WrapMode::Type wrapModeV, TextureUploadObserver* textureObserver,
+  AtlasUploadObserver* atlasObserver, ImageAtlasManagerPtr imageAtlasManager, bool orientationCorrection,
+  TextureManager::ReloadPolicy reloadPolicy, TextureManager::MultiplyOnLoad& preMultiplyOnLoad )
 {
   TextureSet textureSet;
 
@@ -203,6 +205,11 @@ TextureSet TextureManager::LoadTexture(
         textureSet = TextureSet::New();
         textureSet.SetTexture( 0u, texture );
       }
+      else
+      {
+        textureRectSize.SetWidth(data.GetWidth());
+        textureRectSize.SetHeight(data.GetHeight());
+      }
     }
   }
   else
@@ -210,7 +217,7 @@ TextureSet TextureManager::LoadTexture(
     loadingStatus = true;
     if( atlasingStatus )
     {
-      textureSet = imageAtlasManager->Add( textureRect, url.GetUrl(), desiredSize, fittingMode, true, atlasObserver );
+      textureSet = imageAtlasManager->Add( textureRect, url.GetUrl(), desiredSize, fittingMode, true, atlasObserver);
     }
     if( !textureSet ) // big image, no atlasing or atlasing failed
     {
@@ -243,6 +250,10 @@ TextureSet TextureManager::LoadTexture(
         textureSet = GetTextureSet( textureId );
       }
     }
+    else
+    {
+      textureRectSize = desiredSize;
+    }
   }
 
   if( ! atlasingStatus && textureSet )
@@ -921,8 +932,21 @@ TextureManager::TextureHash TextureManager::GenerateHash(
   {
     // We are not including sizing information, but we still need an extra byte for atlasing.
     hashTarget.resize( urlLength + 1u );
+
     // Add the atlasing to the hash input.
-    hashTarget[ urlLength ] = useAtlas;
+    switch( useAtlas )
+    {
+      case UseAtlas::NO_ATLAS:
+      {
+        hashTarget[ urlLength ] = 'f';
+        break;
+      }
+      case UseAtlas::USE_ATLAS:
+      {
+        hashTarget[ urlLength ] = 't';
+        break;
+      }
+    }
   }
 
   if( maskTextureId != INVALID_TEXTURE_ID )