Merge "ItemView: Fade off overshoot indicator when moving in opposite direction"...
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 23 Oct 2015 15:09:20 +0000 (08:09 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 23 Oct 2015 15:09:20 +0000 (08:09 -0700)
12 files changed:
dali-toolkit/devel-api/controls/shadow-view/shadow-view.cpp
dali-toolkit/devel-api/controls/shadow-view/shadow-view.h
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h
dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/public-api/controls/control-depth-index-ranges.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index cb7ac5c..5afc638 100644 (file)
@@ -94,9 +94,9 @@ void ShadowView::Remove(Actor child)
   GetImpl(*this).Remove(child);
 }
 
-void ShadowView::SetShadowPlane(ImageActor shadowPlane)
+void ShadowView::SetShadowPlaneBackground(Actor shadowPlaneBackground)
 {
-  GetImpl(*this).SetShadowPlane(shadowPlane);
+  GetImpl(*this).SetShadowPlaneBackground(shadowPlaneBackground);
 }
 
 void ShadowView::SetPointLight(Actor pointLight)
index 63bb089..d6039f2 100644 (file)
@@ -178,15 +178,15 @@ public:
   void Remove(Actor child);
 
   /**
-   * Set the Shadow Plane for the shadow effect.
+   * Set the Shadow Plane Background for the shadow effect.
    *
-   * @param[in] shadowPlane An actor representing the shadow
+   * @param[in] shadowPlaneBackground An actor representing the shadow
    * plane. The position of the actor represents the origin of the
    * plane, and the orientation of the actor represents the direction
    * of the plane normal. Make the plane sufficiently large if the shadows are
    * clipped.
    */
-  void SetShadowPlane(ImageActor shadowPlane);
+  void SetShadowPlaneBackground(Actor shadowPlaneBackground);
 
   /**
    * Set the Point Light for the shadow effect. This is usually NOT a renderable actor.
index 7210e9e..14e8405 100644 (file)
@@ -28,7 +28,6 @@
 #include <dali/public-api/render-tasks/render-task-list.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 #include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
 #include <dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h>
 
@@ -340,11 +339,11 @@ void PageTurnView::SetupShadowView()
   mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f);
   mShadowView.SetShadowColor(DEFAULT_SHADOW_COLOR);
 
-  mShadowPlane = CreateSolidColorActor( Vector4 (0.0f, 0.0f, 0.0f, 0.0f) );
-  mShadowPlane.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
-  mShadowPlane.SetSize( mControlSize );
-  Self().Add( mShadowPlane );
-  mShadowView.SetShadowPlane( mShadowPlane );
+  mShadowPlaneBackground = Actor::New();
+  mShadowPlaneBackground.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
+  mShadowPlaneBackground.SetSize( mControlSize );
+  Self().Add( mShadowPlaneBackground );
+  mShadowView.SetShadowPlaneBackground( mShadowPlaneBackground );
 
   mPointLight = Actor::New();
   mPointLight.SetAnchorPoint( origin );
@@ -370,7 +369,7 @@ void PageTurnView::OnStageDisconnection()
   if(mShadowView)
   {
     mPointLight.Unparent();
-    mShadowPlane.Unparent();
+    mShadowPlaneBackground.Unparent();
     mShadowView.Unparent();
   }
 
@@ -420,9 +419,9 @@ void PageTurnView::SetPageSize( const Vector2& pageSize )
 
   OnPageTurnViewInitialize();
 
-  if( mShadowPlane )
+  if( mShadowPlaneBackground )
   {
-    mShadowPlane.SetSize( mControlSize );
+    mShadowPlaneBackground.SetSize( mControlSize );
   }
 }
 
index 5209f00..5be63cf 100644 (file)
@@ -311,7 +311,7 @@ protected:
   Vector2                        mControlSize;             ///< The size of the control, it is decided by the page size, the SetSize from application can not change it
   Layer                          mTurningPageLayer;        ///< The layer for the turning page, to avoid possible depth conflict
   Toolkit::ShadowView            mShadowView;              ///< The shadow view control for shadow casting
-  ImageActor                     mShadowPlane;             ///< The plane for the shadow to cast on
+  Actor                          mShadowPlaneBackground;   ///< The plane for the shadow to cast on
   Actor                          mPointLight;              ///< The point light used for shadow casting
 
   PageFactory&                   mPageFactory;             ///< The page factory which provides the page actors
index 31174a2..80682f1 100644 (file)
@@ -86,18 +86,30 @@ const char* const BLUR_STRENGTH_PROPERTY_NAME = "BlurStrengthProperty";
 const char* const SHADOW_COLOR_PROPERTY_NAME = "ShadowColorProperty";
 
 const char* const RENDER_SHADOW_VERTEX_SOURCE =
+
+  " attribute mediump vec2 aPosition;\n"
+  " uniform mediump mat4 uMvpMatrix;\n"
+  " uniform mediump mat4 uModelMatrix;\n"
+  " uniform vec3 uSize;\n"
+  " varying vec2 vTexCoord;\n"
+
   " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
   " uniform mediump mat4 uLightCameraViewMatrix;\n"
   "\n"
   "void main()\n"
   "{\n"
-    "  gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
-    "  vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix  * vec4(aPosition,1.0);\n"
+    "  mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n"
+    "  vertexPosition.xyz *= uSize;\n"
+    "  gl_Position = uMvpMatrix * vertexPosition;\n"
+    "  vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix  * vertexPosition;\n"
     "  vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
   "}\n";
 
 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
+  "varying mediump vec2 vTexCoord;\n"
   "uniform lowp vec4 uShadowColor;\n"
+  "uniform sampler2D sTexture;\n"
+
   "void main()\n"
   "{\n"
   "  lowp float alpha;\n"
@@ -149,17 +161,18 @@ void ShadowView::Remove(Actor child)
   mChildrenRoot.Remove(child);
 }
 
-void ShadowView::SetShadowPlane(Actor shadowPlane)
+void ShadowView::SetShadowPlaneBackground(Actor shadowPlaneBackground)
 {
-  mShadowPlaneBg = shadowPlane;
+  mShadowPlaneBg = shadowPlaneBackground;
 
-  mShadowPlane = ImageActor::New();
+  mShadowPlane = Toolkit::ImageView::New();
   mShadowPlane.SetName( "SHADOW_PLANE" );
   mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
   mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER);
 
   mShadowPlane.SetImage(mOutputImage);
-  mShadowPlane.SetShaderEffect(mShadowRenderShader);
+  mShadowPlane.SetProperty( Toolkit::ImageView::Property::IMAGE, mShadowRenderShader );
+  SetShaderConstants();
 
   // Rather than parent the shadow plane drawable and have constraints to move it to the same
   // position, instead parent the shadow plane drawable on the shadow plane passed in.
@@ -193,7 +206,10 @@ void ShadowView::SetShadowColor(Vector4 color)
   mCachedBackgroundColor.g = color.g;
   mCachedBackgroundColor.b = color.b;
 
-  Self().SetProperty( mShadowColorPropertyIndex, mCachedShadowColor );
+  if( mShadowPlane )
+  {
+    mShadowPlane.SetProperty( mShadowColorPropertyIndex, mCachedShadowColor );
+  }
   if(mRenderSceneTask)
   {
     mRenderSceneTask.SetClearColor( mCachedBackgroundColor );
@@ -239,8 +255,17 @@ void ShadowView::OnInitialize()
   mCameraActor.SetOrientation(Radian(Degree(180)), Vector3::YAXIS);
   mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);
 
-  mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE,
-                                           ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ));
+
+  Property::Map customShader;
+  customShader[ "vertex-shader" ] = RENDER_SHADOW_VERTEX_SOURCE;
+  customShader[ "fragment-shader" ] = RENDER_SHADOW_FRAGMENT_SOURCE;
+
+  customShader[ "subdivide-grid-x" ] = 20;
+  customShader[ "subdivide-grid-y" ] = 20;
+
+  customShader[ "hints" ] = "output-is-transparent";
+
+  mShadowRenderShader[ "shader" ] = customShader;
 
   // Create render targets needed for rendering from light's point of view
   mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 );
@@ -273,7 +298,13 @@ void ShadowView::OnInitialize()
   mBlurFilter.SetRootActor(mBlurRootActor);
   mBlurFilter.SetBackgroundColor(Vector4::ZERO);
 
-  SetShaderConstants();
+  CustomActor self = Self();
+  // Register a property that the user can use to control the blur in the internal object
+  mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT);
+
+  Constraint blurStrengthConstraint = Constraint::New<float>( mBlurFilter.GetHandleForAnimateBlurStrength(), mBlurFilter.GetBlurStrengthPropertyIndex(), EqualToConstraint() );
+  blurStrengthConstraint.AddSource( Source( self, mBlurStrengthPropertyIndex) );
+  blurStrengthConstraint.Apply();
 }
 
 void ShadowView::OnSizeSet(const Vector3& targetSize)
@@ -332,38 +363,17 @@ void ShadowView::RemoveRenderTasks()
 
 void ShadowView::SetShaderConstants()
 {
-  CustomActor self = Self();
-
-  mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
-  mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
-  mShadowRenderShader.SetUniform( SHADER_SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor );
-
-  Property::Index lightCameraProjectionMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME);
-  Property::Index lightCameraViewMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME);
-
-  Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowRenderShader, lightCameraProjectionMatrixPropertyIndex, EqualToConstraint() );
+  Property::Index lightCameraProjectionMatrixPropertyIndex = mShadowPlane.RegisterProperty( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
+  Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowPlane, lightCameraProjectionMatrixPropertyIndex, EqualToConstraint() );
   projectionMatrixConstraint.AddSource( Source( mCameraActor, CameraActor::Property::PROJECTION_MATRIX ) );
+  projectionMatrixConstraint.Apply();
 
-  Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowRenderShader, lightCameraViewMatrixPropertyIndex, EqualToConstraint() );
+  Property::Index lightCameraViewMatrixPropertyIndex = mShadowPlane.RegisterProperty( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
+  Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowPlane, lightCameraViewMatrixPropertyIndex, EqualToConstraint() );
   viewMatrixConstraint.AddSource( Source( mCameraActor, CameraActor::Property::VIEW_MATRIX ) );
-
-  projectionMatrixConstraint.Apply();
   viewMatrixConstraint.Apply();
 
-  // Register a property that the user can use to control the blur in the internal object
-  mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT);
-
-  Constraint blurStrengthConstraint = Constraint::New<float>( mBlurFilter.GetHandleForAnimateBlurStrength(), mBlurFilter.GetBlurStrengthPropertyIndex(), EqualToConstraint() );
-  blurStrengthConstraint.AddSource( Source( self, mBlurStrengthPropertyIndex) );
-  blurStrengthConstraint.Apply();
-
-  //  Register a property that the user can use to control the color of the shadow.
-  Property::Index index = mShadowRenderShader.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
-  mShadowColorPropertyIndex = self.RegisterProperty(SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor);
-
-  Constraint shadowRenderShaderConstraint = Constraint::New<Dali::Vector4>( mShadowRenderShader, index, EqualToConstraint() );
-  shadowRenderShaderConstraint.AddSource( Source( self, mShadowColorPropertyIndex ) );
-  shadowRenderShaderConstraint.Apply();
+  mShadowColorPropertyIndex = mShadowPlane.RegisterProperty( SHADER_SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor );
 }
 
 } // namespace Internal
index 5aa3595..68e1c33 100644 (file)
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/render-tasks/render-task.h>
 #include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/object/property-map.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/shadow-view/shadow-view.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
 
@@ -80,9 +82,9 @@ public:
   void Remove(Actor child);
 
   /**
-   * @copydoc Dali::Toolkit::ShadowView::SetShadowPlane(Actor shadowPlane)
+   * @copydoc Dali::Toolkit::ShadowView::SetShadowPlaneBackground(Actor shadowPlaneBackground)
    */
-  void SetShadowPlane(Actor shadowPlane);
+  void SetShadowPlaneBackground(Actor shadowPlaneBackground);
 
   /**
    * @copydoc Dali::Toolkit::ShadowView::SetPointLight(Actor pointLight)
@@ -137,7 +139,7 @@ private:
   void CreateBlurFilter();
 
 private:
-  ImageActor mShadowPlane; // Shadow renders into this actor
+  Toolkit::ImageView mShadowPlane; // Shadow renders into this actor
   Actor mShadowPlaneBg; // mShadowPlane renders directly in front of this actor
   Actor mPointLight;  // Shadow is cast from this point light
 
@@ -148,12 +150,11 @@ private:
 
   Actor mChildrenRoot; // Subtree for all user added child actors that should be rendered normally
   Actor mBlurRootActor; // Root actor for blur filter processing
-  ImageActor mShadowPlaneDrawable; // Positioned on top of mShadowPlane for drawing shadow image
   RenderTask mRenderSceneTask;
 
   CameraActor mCameraActor; // Constrained to same position as mPointLight and pointing at mShadowPlane
 
-  ShaderEffect mShadowRenderShader;
+  Property::Map mShadowRenderShader;
   BlurTwoPassFilter mBlurFilter;
 
   Vector4 mCachedShadowColor;                               ///< Cached Shadow color.
index 9fe5771..5a6ce62 100644 (file)
@@ -28,6 +28,7 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/internal/controls/text-controls/text-font-style.h>
 #include <dali-toolkit/internal/text/rendering/text-backend.h>
@@ -987,7 +988,7 @@ void TextField::RenderText()
   Actor renderableActor;
   if( mRenderer )
   {
-    renderableActor = mRenderer->Render( mController->GetView(), self.GetHierarchyDepth() );
+    renderableActor = mRenderer->Render( mController->GetView(), TEXT_DEPTH_INDEX );
   }
 
   if( renderableActor != mRenderableActor )
index be24d2b..12de684 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/internal/controls/text-controls/text-font-style.h>
 #include <dali-toolkit/internal/text/rendering/text-backend.h>
@@ -518,7 +519,7 @@ void TextLabel::RenderText()
   Actor renderableActor;
   if( mRenderer )
   {
-    renderableActor = mRenderer->Render( mController->GetView(), self.GetHierarchyDepth() );
+    renderableActor = mRenderer->Render( mController->GetView(), TEXT_DEPTH_INDEX );
   }
 
   if( renderableActor != mRenderableActor )
index 5651b04..95e8624 100644 (file)
@@ -30,9 +30,10 @@ namespace Toolkit
 
 enum ControlDepthIndexRanges
 {
-    BACKGROUND_DEPTH_INDEX    = static_cast<int>( -Dali::Layer::TREE_DEPTH_MULTIPLIER * 0.1f ),
+    BACKGROUND_DEPTH_INDEX    = -Dali::Layer::TREE_DEPTH_MULTIPLIER / 10,
     CONTENT_DEPTH_INDEX       = 0,
-    DECORATION_DEPTH_INDEX    = static_cast<int>( Dali::Layer::TREE_DEPTH_MULTIPLIER * 0.1f )
+    TEXT_DEPTH_INDEX          = Dali::Layer::TREE_DEPTH_MULTIPLIER / 100,
+    DECORATION_DEPTH_INDEX    = Dali::Layer::TREE_DEPTH_MULTIPLIER / 10
 };
 
 /**
index c3ca785..a009273 100644 (file)
@@ -810,16 +810,6 @@ void Control::EmitKeyInputFocusSignal( bool focusGained )
 
 void Control::OnStageConnection( int depth )
 {
-  unsigned int controlRendererCount = Self().GetRendererCount();
-  for( unsigned int i(0); i<controlRendererCount; ++i )
-  {
-    Renderer controlRenderer = Self().GetRendererAt(i);
-    if( controlRenderer )
-    {
-      controlRenderer.SetDepthIndex( CONTENT_DEPTH_INDEX+depth );
-    }
-  }
-
   if( mImpl->mBackgroundRenderer)
   {
     mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX );
index 795e9cf..b3b265f 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 6;
+const unsigned int TOOLKIT_MICRO_VERSION = 7;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 9939f2c..8e5b5c9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.1.6
+Version:    1.1.7
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0, BSD-2.0, MIT