Revert "visual: Implements rive animation" 69/260069/2
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 18 Jun 2021 05:39:10 +0000 (14:39 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 25 Jun 2021 02:08:37 +0000 (02:08 +0000)
This reverts commit ef1f2122e3825ec5fa1d2d3b568caec69ecd3d0c.

Change-Id: Iea2dcb4faf48c7af5226fc6820f207a998abdec9

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp
dali-toolkit/internal/visuals/visual-factory-impl.cpp
dali-toolkit/internal/visuals/visual-url.cpp
dali-toolkit/internal/visuals/visual-url.h

index 474706f44615b87039ae1616feb18a4f314f4985..33a27b5c45b78eeca5fee0dbc26f8ade9cda651e 100755 (executable)
@@ -71,7 +71,7 @@ public:
   bool Load(const std::string& url)
   {
     mUrl = url;
-    if(mUrl == "invalid.json" || mUrl == "invalid.riv")
+    if(mUrl == "invalid.json")
     {
       return false;
     }
index 6159e717a30e0e5ece06af58611a1b870d72c395..d2be632c667de6b2c93f25d61c16bc123c9cfebb 100644 (file)
@@ -53,9 +53,6 @@ const char* TEST_VECTOR_IMAGE_FILE_NAME =  TEST_RESOURCE_DIR  "/insta_camera.jso
 const char* TEST_VECTOR_IMAGE_FILE_NAME_FRAME_DROP = "framedrop.json";
 const char* TEST_VECTOR_IMAGE_INVALID_FILE_NAME =  "invalid.json";
 
-const char* TEST_VECTOR_IMAGE_RIVE_FILE_NAME =  TEST_RESOURCE_DIR  "/shape.riv";
-const char* TEST_VECTOR_IMAGE_INVALID_RIVE_FILE_NAME = "invalid.riv";
-
 bool gAnimationFinishedSignalFired = false;
 
 void VisualEventSignal( Control control, Dali::Property::Index visualIndex, Dali::Property::Index signalId )
@@ -1616,199 +1613,3 @@ int UtcDaliAnimatedVectorImageVisualFrameDrops(void)
 
   END_TEST;
 }
-
-int UtcDaliAnimatedVectorImageVisualLoadRiveFileP(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliAnimatedVectorImageVisualLoadRiveFile: Request animated vector image visual with a rive url" );
-
-  VisualFactory factory = VisualFactory::Get();
-  Visual::Base visual = factory.CreateVisual( TEST_VECTOR_IMAGE_RIVE_FILE_NAME, ImageDimensions() );
-  DALI_TEST_CHECK( visual );
-
-  DummyControl actor = DummyControl::New( true );
-  DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
-  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
-  actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) );
-  application.GetScene().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  // renderer is added to actor
-  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  Renderer renderer = actor.GetRendererAt( 0u );
-  DALI_TEST_CHECK( renderer );
-
-  // Test SetOffScene().
-  actor.Unparent();
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
-  END_TEST;
-}
-
-int UtcDaliAnimatedVectorImageVisualLoadRiveFileN(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline("Request loading with invalid rive file - should draw broken image");
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = gl.GetTextureTrace();
-  textureTrace.Enable(true);
-
-  Property::Map propertyMap;
-  propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
-             .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_INVALID_RIVE_FILE_NAME);
-
-  Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
-  DALI_TEST_CHECK(visual);
-
-  DummyControl actor = DummyControl::New(true);
-  DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >(actor.GetImplementation());
-  dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
-
-  actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
-
-  application.GetScene().Add(actor);
-
-  application.SendNotification();
-  application.Render();
-
-  // Check resource status
-  Visual::ResourceStatus status = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
-  DALI_TEST_EQUALS(status, Visual::ResourceStatus::FAILED, TEST_LOCATION);
-
-  // The broken image should be shown.
-  DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
-  DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
-
-  END_TEST;
-}
-
-int UtcDaliAnimatedVectorImageVisualPlaybackRiveFile(void)
-{
-  ToolkitTestApplication application;
-
-  tet_infoline( "UtcDaliAnimatedVectorImageVisualPlaybackRiveFile" );
-
-  {
-    // request AnimatedVectorImageVisual for Rive with a property map
-    VisualFactory factory = VisualFactory::Get();
-    Visual::Base visual = factory.CreateVisual(
-      Property::Map()
-      .Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
-      .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_RIVE_FILE_NAME ) );
-
-    DummyControl dummyControl = DummyControl::New( true );
-    Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummyControl.GetImplementation() );
-    dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
-    dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
-    Property::Map attributes;
-    tet_infoline( "Test Play action" );
-    DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
-    application.GetScene().Add( dummyControl );
-    application.SendNotification();
-    application.Render( 16 );
-
-    Property::Map map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
-
-    tet_infoline( "Test Pause action" );
-    DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, attributes );
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PAUSED );
-
-    tet_infoline( "Test Play action" );
-    DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
-
-    tet_infoline( "Test Stop action" );
-    DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
-    tet_infoline( "Test Stop action again" );
-    DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
-    tet_infoline( "Test Play action" );
-    DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
-
-    tet_infoline( "Off stage" );
-    dummyControl.Unparent();
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
-    tet_infoline( "On stage again" );
-    application.GetScene().Add( dummyControl );
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
-    tet_infoline( "Test Play action" );
-    DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
-    application.SendNotification();
-    application.Render(16);
-
-    map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
-    value = map.Find( DevelImageVisual::Property::PLAY_STATE );
-    DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
-
-    // Change Size
-    Vector3 newSize( 100.0f, 100.0f, 0.0f );
-    dummyControl.SetProperty( Actor::Property::SIZE, newSize );
-
-    application.SendNotification();
-    application.Render(16);
-
-    // Size should be changed
-    Vector3 naturalSize = dummyControl.GetNaturalSize();
-    DALI_TEST_CHECK( naturalSize == newSize );
-
-    dummyControl.Unparent();
-  }
-
-  END_TEST;
-}
index 6bbc2dfca4faf6d9204b9adacb0b5e51e1d3b340..8c4b2f8d129a8fec8614eb9a4aa36d8baedd21b2 100644 (file)
@@ -166,7 +166,6 @@ Toolkit::Visual::Base VisualFactory::CreateVisual(const Property::Map& propertyM
                 break;
               }
               case VisualUrl::JSON:
-              case VisualUrl::RIVE:
               {
                 visualPtr = AnimatedVectorImageVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), imageUrl, propertyMap);
                 break;
@@ -331,7 +330,6 @@ Toolkit::Visual::Base VisualFactory::CreateVisual(const std::string& url, ImageD
         break;
       }
       case VisualUrl::JSON:
-      case VisualUrl::RIVE:
       {
         visualPtr = AnimatedVectorImageVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), visualUrl);
         break;
index 97bc9b930031fdba80fdc4321b0334bdb53cb6d2..e49831302a10ffad508b0ae27ebc59ed2f78886b 100644 (file)
@@ -103,12 +103,10 @@ VisualUrl::Type ResolveType(const std::string& url)
     char         GIF[4]    = {'f', 'i', 'g', '.'};
     char         WEBP[5]   = {'p', 'b', 'e', 'w', '.'};
     char         JSON[5]   = {'n', 'o', 's', 'j', '.'};
-    char         RIVE[4]   = {'v', 'i', 'r', '.'};
     unsigned int svgScore  = 0;
     unsigned int gifScore  = 0;
     unsigned int webpScore = 0;
     unsigned int jsonScore = 0;
-    unsigned int riveScore = 0;
     int          index     = count;
     while(--index >= 0)
     {
@@ -146,14 +144,6 @@ VisualUrl::Type ResolveType(const std::string& url)
           return VisualUrl::JSON;
         }
       }
-      if((offsetFromEnd < sizeof(RIVE)) && (currentChar == RIVE[offsetFromEnd]))
-      {
-        // early out if RIVE as can't be used in N patch for now
-        if(++riveScore == sizeof(RIVE))
-        {
-          return VisualUrl::RIVE;
-        }
-      }
       switch(state)
       {
         case SUFFIX:
index 827dfce7989b3387270e6d54b2f5ea1e53016515..8857184e07e05925033a27d1d5ec193453aba7d1 100644 (file)
@@ -38,8 +38,7 @@ public:
     SVG,
     GIF,
     WEBP,
-    JSON,
-    RIVE
+    JSON
   };
 
   enum ProtocolType