Remove Image Usage from ImageVisual & WebView 80/236380/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 16 Jun 2020 13:49:55 +0000 (14:49 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 16 Jun 2020 13:59:51 +0000 (14:59 +0100)
Change-Id: Id91a3dd6a1cc079c83f1e0822992bcd26e8ab01f

automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp [changed mode: 0755->0644]
automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
dali-toolkit/devel-api/visual-factory/visual-factory.cpp
dali-toolkit/devel-api/visual-factory/visual-factory.h
dali-toolkit/internal/controls/web-view/web-view-impl.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/image/image-visual.h
dali-toolkit/internal/visuals/visual-factory-impl.cpp
dali-toolkit/internal/visuals/visual-factory-impl.h

old mode 100755 (executable)
new mode 100644 (file)
index 8b119d4..fb8287a
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -233,8 +233,10 @@ int UtcDaliDebugRenderingGetVisual2(void)
   TestDebugVisual( borderVisual, Visual::BORDER, Vector2::ZERO );
 
   // Test that image visual is replaced with debug visual
   TestDebugVisual( borderVisual, Visual::BORDER, Vector2::ZERO );
 
   // Test that image visual is replaced with debug visual
-  Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
-  Visual::Base imageVisual = factory.CreateVisual( image );
+  map.Clear();
+  map[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
+  map[ ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME;
+  Visual::Base imageVisual = factory.CreateVisual( map );
   DALI_TEST_CHECK( imageVisual );
   TestDebugVisual( imageVisual, Visual::IMAGE, Vector2::ZERO);
 
   DALI_TEST_CHECK( imageVisual );
   TestDebugVisual( imageVisual, Visual::IMAGE, Vector2::ZERO);
 
index 0bd2225..4ce6929 100644 (file)
@@ -570,39 +570,6 @@ int UtcDaliImageVisualTextureReuse2(void)
 }
 
 
 }
 
 
-int UtcDaliImageVisualImageHandle(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "Request image visual with an image handle" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
-  Visual::Base visual = factory.CreateVisual( image );
-
-  // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
-  // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
-
-  const int width=512;
-  const int height=513;
-
-  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
-  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = gl.GetTextureTrace();
-  textureTrace.Enable(true);
-
-  DummyControl actor = DummyControl::New();
-  TestVisualRender( application, actor, visual, 1u,
-                    ImageDimensions(width, height),
-                    Integration::ResourcePointer(bitmap) );
-
-  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
-  END_TEST;
-}
-
 int UtcDaliImageVisualCustomWrapModePixelArea(void)
 {
   ToolkitTestApplication application;
 int UtcDaliImageVisualCustomWrapModePixelArea(void)
 {
   ToolkitTestApplication application;
index 59c34fa..79aec89 100644 (file)
@@ -140,20 +140,6 @@ bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Ma
   return true;
 }
 
   return true;
 }
 
-void PrepareResourceImage( ToolkitTestApplication& application, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat )
-{
-  TestPlatformAbstraction& platform = application.GetPlatform();
-  platform.SetClosestImageSize(Vector2( imageWidth, imageHeight));
-
-  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
-  Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight );
-  unsigned int bytesPerPixel = GetBytesPerPixel(  pixelFormat );
-  unsigned int initialColor = 0xFF;
-  memset( pixbuffer, initialColor, imageHeight*imageWidth*bytesPerPixel);
-
-  Integration::ResourcePointer resourcePtr(bitmap);
-  platform.SetSynchronouslyLoadedResource( resourcePtr );
-}
 } //namespace
 
 void dali_visual_startup(void)
 } //namespace
 
 void dali_visual_startup(void)
@@ -297,9 +283,12 @@ int UtcDaliVisualSize(void)
   DALI_TEST_EQUALS( naturalSize, Vector2::ZERO, TEST_LOCATION );
 
   // image visual
   DALI_TEST_EQUALS( naturalSize, Vector2::ZERO, TEST_LOCATION );
 
   // image visual
-  PrepareResourceImage( application, 100u, 200u, Pixel::RGBA8888 );
-  Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
-  Visual::Base imageVisual = factory.CreateVisual( image );
+  map.Clear();
+  map[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::IMAGE;
+  map[Toolkit::ImageVisual::Property::URL] = TEST_IMAGE_FILE_NAME;
+  map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = 100.0f;
+  map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = 200.0f;
+  Visual::Base imageVisual = factory.CreateVisual( map );
   imageVisual.SetTransformAndSize(DefaultTransform(), controlSize );
 
   imageVisual.GetNaturalSize(naturalSize);
   imageVisual.SetTransformAndSize(DefaultTransform(), controlSize );
 
   imageVisual.GetNaturalSize(naturalSize);
@@ -844,52 +833,6 @@ int UtcDaliVisualGetPropertyMap5(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<bool>() == true );
 
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<bool>() == true );
 
-  // Get an image visual with an image handle, and test the default property values
-  PrepareResourceImage( application, 100u, 200u, Pixel::RGBA8888 );
-  Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
-  imageVisual = factory.CreateVisual(image);
-  imageVisual.CreatePropertyMap( resultMap );
-
-  value = resultMap.Find( Toolkit::Visual::Property::TYPE,  Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
-
-  value = resultMap.Find( ImageVisual::Property::URL,  Property::STRING );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
-
-  value = resultMap.Find( ImageVisual::Property::FITTING_MODE,   Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == FittingMode::DEFAULT );
-
-  value = resultMap.Find( ImageVisual::Property::SAMPLING_MODE,   Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == SamplingMode::BOX );
-
-  value = resultMap.Find( ImageVisual::Property::DESIRED_WIDTH,   Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == 100 );
-
-  value = resultMap.Find( ImageVisual::Property::DESIRED_HEIGHT,   Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == 200 );
-
-  value = resultMap.Find( ImageVisual::Property::PIXEL_AREA, Property::VECTOR4 );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_EQUALS( value->Get<Vector4>(), Vector4( 0.f, 0.f, 1.f, 1.f ), Math::MACHINE_EPSILON_100, TEST_LOCATION );
-
-  value = resultMap.Find( ImageVisual::Property::WRAP_MODE_U, Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK(  value->Get<int>() == WrapMode::DEFAULT);
-
-  value = resultMap.Find( ImageVisual::Property::WRAP_MODE_V, Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK(  value->Get<int>() == WrapMode::DEFAULT);
-
-  value = resultMap.Find( "synchronousLoading",   Property::BOOLEAN );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<bool>() == false );
-
   END_TEST;
 }
 
   END_TEST;
 }
 
@@ -2980,20 +2923,6 @@ int UtcDaliVisualSetTransform4(void)
 int UtcDaliVisualSetTransform5(void)
 {
   ToolkitTestApplication application;
 int UtcDaliVisualSetTransform5(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualSetTransform: ImageVisual from Image" );
-
-  VisualFactory factory = VisualFactory::Get();
-  Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
-  Visual::Base visual = factory.CreateVisual(image);
-  TestTransform( application, visual );
-  TestMixColor( visual, Visual::Property::MIX_COLOR, Color::WHITE );
-
-  END_TEST;
-}
-
-int UtcDaliVisualSetTransform6(void)
-{
-  ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualSetTransform: ImageVisual for URL " );
 
   VisualFactory factory = VisualFactory::Get();
   tet_infoline( "UtcDaliVisualSetTransform: ImageVisual for URL " );
 
   VisualFactory factory = VisualFactory::Get();
@@ -3013,7 +2942,7 @@ int UtcDaliVisualSetTransform6(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliVisualSetTransform7(void)
+int UtcDaliVisualSetTransform6(void)
 {
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualSetTransform: NPatch visual" );
 {
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualSetTransform: NPatch visual" );
index b24adbb..46cbbac 100644 (file)
@@ -1,5 +1,5 @@
  /*
  /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -99,11 +99,6 @@ Visual::Base VisualFactory::CreateVisual( const Property::Map& propertyMap )
   return GetImplementation( *this ).CreateVisual( propertyMap );
 }
 
   return GetImplementation( *this ).CreateVisual( propertyMap );
 }
 
-Visual::Base VisualFactory::CreateVisual( const Image& image )
-{
-  return GetImplementation( *this ).CreateVisual( image );
-}
-
 Visual::Base VisualFactory::CreateVisual( const std::string& url, ImageDimensions size )
 {
   return GetImplementation( *this ).CreateVisual( url, size );
 Visual::Base VisualFactory::CreateVisual( const std::string& url, ImageDimensions size )
 {
   return GetImplementation( *this ).CreateVisual( url, size );
index 0a86754..26f6df3 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_VISUAL_FACTORY_H
 
 /*
 #define DALI_TOOLKIT_VISUAL_FACTORY_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -101,14 +101,6 @@ public:
   Visual::Base CreateVisual( const Property::Map& propertyMap  );
 
   /**
   Visual::Base CreateVisual( const Property::Map& propertyMap  );
 
   /**
-   * @brief Request the visual to render the image.
-   *
-   * @param[in] image The image to be rendered.
-   * @return The pointer pointing to the visual
-   */
-  Visual::Base CreateVisual( const Image& image );
-
-  /**
    * @brief Request the visual to render the given resource at the url.
    *
    * @param[in] url The URL to the resource to be rendered.
    * @brief Request the visual to render the given resource at the url.
    *
    * @param[in] url The URL to the resource to be rendered.
index b0d81de..42139f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
 
 namespace Dali
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
 
 namespace Dali
@@ -152,8 +153,11 @@ void WebView::LoadUrl( const std::string& url )
   mUrl = url;
   if( mWebEngine )
   {
   mUrl = url;
   if( mWebEngine )
   {
-    Dali::Image image = Dali::NativeImage::New( *mWebEngine.GetNativeImageSource() );
-    mVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
+    Texture texture = Dali::Texture::New( *mWebEngine.GetNativeImageSource() );
+        const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture( texture );
+    mVisual = Toolkit::VisualFactory::Get().CreateVisual(
+      { { Toolkit::Visual::Property::TYPE,  Toolkit::Visual::IMAGE } ,
+        { Toolkit::ImageVisual::Property::URL, nativeImageUrl } } );
 
     if( mVisual )
     {
 
     if( mVisual )
     {
@@ -168,8 +172,12 @@ void WebView::LoadHTMLString( const std::string& htmlString )
 {
   if( mWebEngine )
   {
 {
   if( mWebEngine )
   {
-    Dali::Image image = Dali::NativeImage::New( *mWebEngine.GetNativeImageSource() );
-    mVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
+    Texture texture = Dali::Texture::New( *mWebEngine.GetNativeImageSource() );
+    const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture( texture );
+
+    mVisual = Toolkit::VisualFactory::Get().CreateVisual(
+      { { Toolkit::Visual::Property::TYPE,  Toolkit::Visual::IMAGE } ,
+        { Toolkit::ImageVisual::Property::URL, nativeImageUrl } } );
 
     if( mVisual )
     {
 
     if( mVisual )
     {
index eb5713e..16038b4 100644 (file)
@@ -22,8 +22,6 @@
 #include <cstring> // for strlen()
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
 #include <cstring> // for strlen()
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
-#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/image-loading.h>
 #include <dali/devel-api/scripting/enum-helper.h>
 #include <dali/devel-api/images/texture-set-image.h>
 #include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/devel-api/scripting/enum-helper.h>
@@ -99,8 +97,6 @@ DALI_ENUM_TO_STRING_TABLE_END( RELEASE_POLICY )
 
 const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
 
 
 const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
 
-const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
-
 const float PIXEL_ALIGN_ON = 1.0f;
 const float PIXEL_ALIGN_OFF = 0.0f;
 
 const float PIXEL_ALIGN_ON = 1.0f;
 const float PIXEL_ALIGN_OFF = 0.0f;
 
@@ -146,11 +142,6 @@ ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
   return new ImageVisual( factoryCache, shaderFactory, imageUrl, size, fittingMode, samplingMode );
 }
 
   return new ImageVisual( factoryCache, shaderFactory, imageUrl, size, fittingMode, samplingMode );
 }
 
-ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Image& image )
-{
-  return new ImageVisual( factoryCache, shaderFactory, image );
-}
-
 ImageVisual::ImageVisual( VisualFactoryCache& factoryCache,
                           ImageVisualShaderFactory& shaderFactory,
                           const VisualUrl& imageUrl,
 ImageVisual::ImageVisual( VisualFactoryCache& factoryCache,
                           ImageVisualShaderFactory& shaderFactory,
                           const VisualUrl& imageUrl,
@@ -158,7 +149,6 @@ ImageVisual::ImageVisual( VisualFactoryCache& factoryCache,
                           FittingMode::Type fittingMode,
                           Dali::SamplingMode::Type samplingMode )
 : Visual::Base( factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::IMAGE ),
                           FittingMode::Type fittingMode,
                           Dali::SamplingMode::Type samplingMode )
 : Visual::Base( factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::IMAGE ),
-  mImage(),
   mPixelArea( FULL_TEXTURE_RECT ),
   mPlacementActor(),
   mImageUrl( imageUrl ),
   mPixelArea( FULL_TEXTURE_RECT ),
   mPlacementActor(),
   mImageUrl( imageUrl ),
@@ -182,32 +172,6 @@ ImageVisual::ImageVisual( VisualFactoryCache& factoryCache,
   EnablePreMultipliedAlpha( mFactoryCache.GetPreMultiplyOnLoad() );
 }
 
   EnablePreMultipliedAlpha( mFactoryCache.GetPreMultiplyOnLoad() );
 }
 
-ImageVisual::ImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Image& image )
-: Visual::Base( factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::IMAGE ),
-  mImage( image ),
-  mPixelArea( FULL_TEXTURE_RECT ),
-  mPlacementActor(),
-  mImageUrl(),
-  mMaskingData( ),
-  mDesiredSize(),
-  mTextureId( TextureManager::INVALID_TEXTURE_ID ),
-  mTextures(),
-  mImageVisualShaderFactory( shaderFactory ),
-  mFittingMode( FittingMode::DEFAULT ),
-  mSamplingMode( SamplingMode::DEFAULT ),
-  mWrapModeU( WrapMode::DEFAULT ),
-  mWrapModeV( WrapMode::DEFAULT ),
-  mLoadPolicy( Toolkit::ImageVisual::LoadPolicy::ATTACHED ),
-  mReleasePolicy( Toolkit::ImageVisual::ReleasePolicy::DESTROYED ),
-  mAtlasRect( 0.0f, 0.0f, 0.0f, 0.0f ),
-  mAttemptAtlasing( false ),
-  mLoading( false ),
-  mOrientationCorrection( true )
-{
-  // PreMultiplied alpha should be disabled when the Image is used.
-  EnablePreMultipliedAlpha( false );
-}
-
 ImageVisual::~ImageVisual()
 {
   if( Stage::IsInstalled() )
 ImageVisual::~ImageVisual()
 {
   if( Stage::IsInstalled() )
@@ -482,13 +446,7 @@ void ImageVisual::AllocateMaskData()
 
 void ImageVisual::GetNaturalSize( Vector2& naturalSize )
 {
 
 void ImageVisual::GetNaturalSize( Vector2& naturalSize )
 {
-  if(mImage)
-  {
-    naturalSize.x = mImage.GetWidth();
-    naturalSize.y = mImage.GetHeight();
-    return;
-  }
-  else if( mDesiredSize.GetWidth()>0 && mDesiredSize.GetHeight()>0)
+  if( mDesiredSize.GetWidth()>0 && mDesiredSize.GetHeight()>0)
   {
     naturalSize.x = mDesiredSize.GetWidth();
     naturalSize.y = mDesiredSize.GetHeight();
   {
     naturalSize.x = mDesiredSize.GetWidth();
     naturalSize.y = mDesiredSize.GetHeight();
@@ -604,60 +562,6 @@ void ImageVisual::CreateRenderer( TextureSet& textureSet )
   EnablePreMultipliedAlpha( IsPreMultipliedAlphaEnabled() );
 }
 
   EnablePreMultipliedAlpha( IsPreMultipliedAlphaEnabled() );
 }
 
-void ImageVisual::CreateNativeImageRenderer( NativeImage& nativeImage )
-{
-  Geometry geometry;
-  Shader shader;
-
-  std::string fragmentShader;
-  const char* fragmentPreFix = nativeImage.GetCustomFragmentPreFix();
-  const char* customSamplerTypename = nativeImage.GetCustomSamplerTypename();
-
-  if( fragmentPreFix )
-  {
-    fragmentShader = fragmentPreFix;
-    fragmentShader += "\n";
-  }
-
-  if( mImpl->mCustomShader && !mImpl->mCustomShader->mFragmentShader.empty() )
-  {
-    fragmentShader += mImpl->mCustomShader->mFragmentShader;
-  }
-  else
-  {
-    fragmentShader += mImageVisualShaderFactory.GetFragmentShaderSource();
-  }
-
-  if( customSamplerTypename )
-  {
-    fragmentShader.replace( fragmentShader.find( DEFAULT_SAMPLER_TYPENAME ), strlen( DEFAULT_SAMPLER_TYPENAME ), customSamplerTypename );
-  }
-
-  if( !mImpl->mCustomShader )
-  {
-    geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
-
-    shader  = Shader::New( mImageVisualShaderFactory.GetVertexShaderSource(), fragmentShader );
-    shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
-  }
-  else
-  {
-    geometry = CreateGeometry( mFactoryCache, mImpl->mCustomShader->mGridSize );
-    shader  = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource() : mImpl->mCustomShader->mVertexShader,
-                           fragmentShader,
-                           mImpl->mCustomShader->mHints );
-    if( mImpl->mCustomShader->mVertexShader.empty() )
-    {
-      shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
-    }
-  }
-
-  mImpl->mRenderer = Renderer::New( geometry, shader );
-
-  //Register transform properties
-  mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
-}
-
 void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection,
                                TextureManager::ReloadPolicy forceReload )
 {
 void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection,
                                TextureManager::ReloadPolicy forceReload )
 {
@@ -733,35 +637,12 @@ void ImageVisual::InitializeRenderer()
   }
 }
 
   }
 }
 
-void ImageVisual::InitializeRenderer( const Image& image )
-{
-  TextureSet textures = TextureSet::New();
-
-  NativeImage nativeImage = NativeImage::DownCast( image );
-  if( nativeImage )
-  {
-    CreateNativeImageRenderer( nativeImage );
-    DALI_ASSERT_DEBUG( textures );
-    mImpl->mRenderer.SetTextures( textures );
-  }
-  else
-  {
-    // reuse existing code for regular images
-    CreateRenderer( textures ); // Textures will be retreived from Image
-  }
-  ApplyImageToSampler( image );
-}
-
 void ImageVisual::DoSetOnStage( Actor& actor )
 {
   if( mImageUrl.IsValid() )
   {
     InitializeRenderer();
   }
 void ImageVisual::DoSetOnStage( Actor& actor )
 {
   if( mImageUrl.IsValid() )
   {
     InitializeRenderer();
   }
-  else if( mImage )
-  {
-    InitializeRenderer( mImage );
-  }
 
   if( !mImpl->mRenderer )
   {
 
   if( !mImpl->mRenderer )
   {
@@ -804,11 +685,6 @@ void ImageVisual::DoSetOffStage( Actor& actor )
     mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING;
   }
 
     mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING;
   }
 
-  if( mImageUrl.IsValid() )
-  {
-    // Legacy support for deprecated Dali::Image
-    mImage.Reset();
-  }
   mLoading = false;
   mImpl->mRenderer.Reset();
   mPlacementActor.Reset();
   mLoading = false;
   mImpl->mRenderer.Reset();
   mPlacementActor.Reset();
@@ -827,17 +703,6 @@ void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
   }
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
   }
-  else if( mImage )
-  {
-    map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, static_cast<int>(mImage.GetWidth()) );
-    map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, static_cast<int>(mImage.GetHeight()) );
-
-    ResourceImage resourceImage = ResourceImage::DownCast(mImage);
-    if( resourceImage )
-    {
-      map.Insert( Toolkit::ImageVisual::Property::URL, resourceImage.GetUrl() );
-    }
-  }
 
   map.Insert( Toolkit::ImageVisual::Property::FITTING_MODE, mFittingMode );
   map.Insert( Toolkit::ImageVisual::Property::SAMPLING_MODE, mSamplingMode );
 
   map.Insert( Toolkit::ImageVisual::Property::FITTING_MODE, mFittingMode );
   map.Insert( Toolkit::ImageVisual::Property::SAMPLING_MODE, mSamplingMode );
@@ -869,11 +734,6 @@ void ImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
   }
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
     map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
   }
-  else if( mImage )
-  {
-    map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, static_cast<int>(mImage.GetWidth()) );
-    map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, static_cast<int>(mImage.GetHeight()) );
-  }
 }
 
 void ImageVisual::OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes )
 }
 
 void ImageVisual::OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes )
@@ -906,20 +766,6 @@ bool ImageVisual::IsResourceReady() const
            mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::FAILED );
 }
 
            mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::FAILED );
 }
 
-void ImageVisual::ApplyImageToSampler( const Image& image )
-{
-  if( image )
-  {
-    TextureSet textureSet = mImpl->mRenderer.GetTextures();
-    DALI_ASSERT_DEBUG( textureSet ); // texture set should always exist by this time
-
-    TextureSetImage( textureSet, 0u, image );
-    Sampler sampler = Sampler::New();
-    sampler.SetWrapMode(  mWrapModeU, mWrapModeV  );
-    textureSet.SetSampler( 0u, sampler );
-  }
-}
-
 // From existing atlas manager
 void ImageVisual::UploadCompleted()
 {
 // From existing atlas manager
 void ImageVisual::UploadCompleted()
 {
@@ -973,8 +819,10 @@ void ImageVisual::UploadComplete( bool loadingSuccess, int32_t textureId, Textur
 
       textureSet = TextureSet::New();
       mImpl->mRenderer.SetTextures( textureSet );
 
       textureSet = TextureSet::New();
       mImpl->mRenderer.SetTextures( textureSet );
-
-      ApplyImageToSampler( brokenImage );
+      TextureSetImage( textureSet, 0u, brokenImage );
+      Sampler sampler = Sampler::New();
+      sampler.SetWrapMode(  mWrapModeU, mWrapModeV  );
+      textureSet.SetSampler( 0u, sampler );
     }
   }
 
     }
   }
 
index 23dee63..46e7bd9 100644 (file)
@@ -158,15 +158,6 @@ public:
                              FittingMode::Type fittingMode = FittingMode::DEFAULT,
                              Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
 
                              FittingMode::Type fittingMode = FittingMode::DEFAULT,
                              Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
 
-  /**
-   * @brief Create a new image visual with an Image type.
-   *
-   * @param[in] factoryCache The VisualFactoryCache object
-   * @param[in] shaderFactory The ImageVisualShaderFactory object
-   * @param[in] image The image to use
-   */
-  static ImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Image& image );
-
 public:  // from Visual
 
   /**
 public:  // from Visual
 
   /**
@@ -211,15 +202,6 @@ protected:
                Dali::SamplingMode::Type samplingMode );
 
   /**
                Dali::SamplingMode::Type samplingMode );
 
   /**
-   * @brief Constructor with an Image type.
-   *
-   * @param[in] factoryCache The VisualFactoryCache object
-   * @param[in] shaderFactory The ImageVisualShaderFactory object
-   * @param[in] image The image to use
-   */
-  ImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Image& image );
-
-  /**
    * @brief A reference counted object may only be deleted by calling Unreference().
    */
   virtual ~ImageVisual();
    * @brief A reference counted object may only be deleted by calling Unreference().
    */
   virtual ~ImageVisual();
@@ -284,13 +266,6 @@ private:
   void AllocateMaskData();
 
   /**
   void AllocateMaskData();
 
   /**
-   * @brief Applies the image to the texture set used for this renderer
-   *
-   * @param[in] image The Image to apply to the texture set used for this renderer
-   */
-  void ApplyImageToSampler( const Image& image );
-
-  /**
    * @brief Load the texture, will try to atlas unless unable or param set to false.
    * @param[in, out] atlasing flag if the image has been put in a atlas (true), passing false will not atlas even if possible.
    * @param[out] atlasRect if atlasing is used this the texture area of the image in the atlas.
    * @brief Load the texture, will try to atlas unless unable or param set to false.
    * @param[in, out] atlasing flag if the image has been put in a atlas (true), passing false will not atlas even if possible.
    * @param[out] atlasRect if atlasing is used this the texture area of the image in the atlas.
@@ -312,25 +287,12 @@ private:
   void InitializeRenderer();
 
   /**
   void InitializeRenderer();
 
   /**
-   * @brief Initializes the Dali::Renderer from an image handle
-   *
-   * @param[in] image The image handle to intialize this ImageVisual from
-   */
-  void InitializeRenderer( const Image& image );
-
-  /**
    * @brief Creates the Dali::Renderer (potentially from the renderer cache), initializing it
    * @param[in] textures to use
    */
   void CreateRenderer( TextureSet& textures );
 
   /**
    * @brief Creates the Dali::Renderer (potentially from the renderer cache), initializing it
    * @param[in] textures to use
    */
   void CreateRenderer( TextureSet& textures );
 
   /**
-   * @brief Creates the Dali::Renderer for NativeImage with custom sampler type and prefix, initializing it
-   * @param NativeImageRenderer
-   */
-  void CreateNativeImageRenderer( NativeImage& nativeImage );
-
-  /**
    * Creates the texture set and adds the texture to it
    * @param[out] textureRect The texture area of the texture in the atlas.
    * @param[in] url The URL of the image resource to use.
    * Creates the texture set and adds the texture to it
    * @param[out] textureRect The texture area of the texture in the atlas.
    * @param[in] url The URL of the image resource to use.
@@ -360,7 +322,6 @@ private:
 
 private:
 
 
 private:
 
-  Image mImage;
   Vector4 mPixelArea;
   WeakHandle<Actor> mPlacementActor;
   VisualUrl mImageUrl;
   Vector4 mPixelArea;
   WeakHandle<Actor> mPlacementActor;
   VisualUrl mImageUrl;
index d3be0b4..3966018 100644 (file)
@@ -314,24 +314,6 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
   return Toolkit::Visual::Base( visualPtr.Get() );
 }
 
   return Toolkit::Visual::Base( visualPtr.Get() );
 }
 
-Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image )
-{
-  Visual::BasePtr visualPtr;
-
-  if( image )
-  {
-    visualPtr = ImageVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), image );
-  }
-
-  if( mDebugEnabled )
-  {
-    //Create a WireframeVisual if we have debug enabled
-    visualPtr = WireframeVisual::New( GetFactoryCache(), visualPtr );
-  }
-
-  return Toolkit::Visual::Base( visualPtr.Get() );
-}
-
 Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, ImageDimensions size )
 {
   Visual::BasePtr visualPtr;
 Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, ImageDimensions size )
 {
   Visual::BasePtr visualPtr;
index 0e4dcb4..10df880 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_VISUAL_FACTORY_IMPL_H
 
 /*
 #define DALI_TOOLKIT_VISUAL_FACTORY_IMPL_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -67,11 +67,6 @@ public:
   Toolkit::Visual::Base CreateVisual( const Property::Map& propertyMap );
 
   /**
   Toolkit::Visual::Base CreateVisual( const Property::Map& propertyMap );
 
   /**
-   * @copydoc Toolkit::VisualFactory::CreateVisual( const Image& )
-   */
-  Toolkit::Visual::Base CreateVisual( const Image& image );
-
-  /**
    * @copydoc Toolkit::VisualFactory::CreateVisual( const std::string&, ImageDimensions )
    */
   Toolkit::Visual::Base CreateVisual( const std::string& image, ImageDimensions size );
    * @copydoc Toolkit::VisualFactory::CreateVisual( const std::string&, ImageDimensions )
    */
   Toolkit::Visual::Base CreateVisual( const std::string& image, ImageDimensions size );