Merge "Adding support for multiple images in AnimatedImageVisual" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / image / image-visual.cpp
index dc16aac..7ce2f23 100644 (file)
@@ -24,7 +24,6 @@
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/images/native-image.h>
 #include <dali/devel-api/images/texture-set-image.h>
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
 #include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/devel-api/scripting/enum-helper.h>
 #include <dali/devel-api/scripting/scripting.h>
@@ -471,6 +470,7 @@ void ImageVisual::DoSetProperty( Property::Index index, const Property::Value& v
     {
       bool atlasing = false;
       mAttemptAtlasing = value.Get( atlasing );
+      break;
     }
 
     case Toolkit::DevelImageVisual::Property::ALPHA_MASK_URL:
@@ -480,6 +480,7 @@ void ImageVisual::DoSetProperty( Property::Index index, const Property::Value& v
       {
         mAlphaMaskUrl = VisualUrl( alphaUrl );
       }
+      break;
     }
   }
 }
@@ -552,7 +553,10 @@ void ImageVisual::CreateRenderer( TextureSet& textureSet )
     }
   }
 
-  shader.RegisterProperty( PIXEL_ALIGNED_UNIFORM_NAME, PIXEL_ALIGN_ON ); // Set default to align
+  // Set pixel align off as default.
+  // ToDo: Pixel align causes issues such as rattling image animation.
+  // We should trun it off until issues are resolved
+  shader.RegisterProperty( PIXEL_ALIGNED_UNIFORM_NAME, PIXEL_ALIGN_OFF );
 
   mImpl->mRenderer = Renderer::New( geometry, shader );
   if( textureSet )
@@ -629,9 +633,12 @@ void ImageVisual::LoadResourceSynchronously()
 {
   if( mImageUrl.IsValid() )
   {
-    BitmapLoader loader = BitmapLoader::New( mImageUrl.GetUrl(), mDesiredSize, mFittingMode, mSamplingMode );
-    loader.Load();
-    mPixels = loader.GetPixelData();
+    Devel::PixelBuffer pixelBuffer = LoadImageFromFile( mImageUrl.GetUrl(), mDesiredSize, mFittingMode, mSamplingMode );
+
+    if( pixelBuffer )
+    {
+      mPixels = Devel::PixelBuffer::Convert(pixelBuffer); // takes ownership of buffer
+    }
     mTextureLoading = false;
   }
 }
@@ -955,7 +962,7 @@ void ImageVisual::UploadCompleted()
 }
 
 // From Texture Manager
-void ImageVisual::UploadComplete( bool loadingSuccess, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle )
+void ImageVisual::UploadComplete( bool loadingSuccess, int32_t textureId, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle )
 {
   Actor actor = mPlacementActor.GetHandle();
   if( actor )