Add using UPDATE_SIZE_HINT for some demos with custom shaders. 49/234649/5
authorAnton Obzhirov <a.obzhirov@samsung.com>
Wed, 27 May 2020 16:24:43 +0000 (17:24 +0100)
committerAnton Obzhirov <a.obzhirov@samsung.com>
Fri, 19 Jun 2020 15:34:26 +0000 (16:34 +0100)
Change-Id: Id25354481d3b0c8e88741e523425a7e7501cbf6f

examples/line-mesh/line-mesh-example.cpp
examples/mesh-morph/mesh-morph-example.cpp
examples/motion-blur/motion-blur-example.cpp
examples/motion-stretch/motion-stretch-example.cpp

index b4fd114..1d845af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -16,6 +16,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
 #include <dali-toolkit/dali-toolkit.h>
 
 // INTERNAL INCLUDES
@@ -195,6 +196,7 @@ public:
     mMeshActor = Actor::New();
     mMeshActor.AddRenderer( mRenderer );
     mMeshActor.SetProperty( Actor::Property::SIZE, Vector2(200, 200) );
+    mMeshActor.SetProperty( DevelActor::Property::UPDATE_SIZE_HINT, Vector2(400, 400) );
 
     Property::Index morphAmountIndex = mMeshActor.RegisterProperty( "uMorphAmount", 0.0f );
 
index e2d0773..655545a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -16,6 +16,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
 #include <dali-toolkit/dali-toolkit.h>
 
 // INTERNAL INCLUDES
@@ -297,6 +298,7 @@ public:
     mMeshActor = Actor::New();
     mMeshActor.AddRenderer( mRenderer );
     mMeshActor.SetProperty( Actor::Property::SIZE, Vector2(400, 400) );
+    mMeshActor.SetProperty( DevelActor::Property::UPDATE_SIZE_HINT, Vector2(480, 700) );
 
     Property::Index morphDeltaIndex = mMeshActor.RegisterProperty( "uDelta", 0.f );
 
index e8f034e..6fa3778 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "shared/view.h"
 #include <dali/dali.h>
+#include <dali/devel-api/actors/actor-devel.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h>
 
@@ -204,13 +205,15 @@ public:
 
     // Scale down actor to fit on very low resolution screens with space to interact:
     mMotionBlurActorSize = Size( std::min( stageSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( stageSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) );
+    mMotionBlurActorUpdateSize = Size( std::max( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::max( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) );
     mMotionBlurActorSize = Size( std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) );
 
     mMotionBlurEffect = CreateMotionBlurEffect();
     mMotionBlurImageView = ImageView::New();
     SetImageFittedInBox( mMotionBlurImageView, mMotionBlurEffect, MOTION_BLUR_ACTOR_IMAGE1, mMotionBlurActorSize.x, mMotionBlurActorSize.y );
     mMotionBlurImageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    mMotionBlurImageView.SetProperty( Actor::Property::SIZE, Vector2(mMotionBlurActorSize.x, mMotionBlurActorSize.y) );
+    mMotionBlurImageView.SetProperty( Actor::Property::SIZE, mMotionBlurActorUpdateSize );
+    mMotionBlurImageView.SetProperty( DevelActor::Property::UPDATE_SIZE_HINT, mMotionBlurActorUpdateSize );
 
     mContentLayer.Add( mMotionBlurImageView );
 
@@ -437,6 +440,7 @@ private:
   Property::Map mMotionBlurEffect;
   ImageView mMotionBlurImageView;
   Size mMotionBlurActorSize;
+  Size mMotionBlurActorUpdateSize;
 
   // animate actor to position where user taps screen
   Animation mActorTapMovementAnimation;
index 0dc404d..c579e5a 100644 (file)
@@ -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.
@@ -20,6 +20,7 @@
 
 #include "shared/view.h"
 #include <dali/dali.h>
+#include <dali/devel-api/actors/actor-devel.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h>
 
@@ -188,6 +189,8 @@ public:
     mMotionStretchImageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     mMotionStretchImageView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     mMotionStretchImageView.SetProperty( Actor::Property::SIZE, Vector2( MOTION_STRETCH_ACTOR_WIDTH, MOTION_STRETCH_ACTOR_HEIGHT ) );
+    // Add stretch padding
+    mMotionStretchImageView.SetProperty( DevelActor::Property::UPDATE_SIZE_HINT, Vector2( MOTION_STRETCH_ACTOR_WIDTH+32, MOTION_STRETCH_ACTOR_HEIGHT+32 ) );
 
     mContentLayer.Add( mMotionStretchImageView );