Merge "Adding TextField Popup behaviour to (Programming) Guide" into devel/master
authorPaul Wisbey <p.wisbey@samsung.com>
Tue, 17 Nov 2015 17:36:54 +0000 (09:36 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 17 Nov 2015 17:36:54 +0000 (09:36 -0800)
16 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
automated-tests/src/dali-toolkit/utc-Dali-RendererFactory.cpp
automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp
dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h
dali-toolkit/devel-api/shader-effects/image-region-effect.h
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
dali-toolkit/internal/controls/buttons/check-box-button-impl.h
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/image-view/image-view-impl.cpp
dali-toolkit/internal/controls/image-view/image-view-impl.h
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/renderers/image/image-renderer.cpp
dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/styles/images-common/keyboard_focus.9.png [moved from dali-toolkit/styles/images-common/keyboard_focus.png with 85% similarity]

index 1e56f8d..973f24a 100644 (file)
@@ -188,7 +188,7 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
   {
     case SuspendFunc:                         return mTrace.FindMethod("Suspend");
     case ResumeFunc:                          return mTrace.FindMethod("Resume");
-    case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource");
+    case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource") || mTrace.FindMethod("LoadResourceSynchronously");
     case LoadFileFunc:                        return mTrace.FindMethod("LoadFile");
     case LoadShaderBinaryFileFunc:            return mTrace.FindMethod("LoadShaderBinaryFile");
     case SaveShaderBinaryFileFunc:            return mTrace.FindMethod("SaveShaderBinaryFile");
index d052c63..374ec6a 100644 (file)
@@ -165,8 +165,19 @@ Integration::ResourcePointer CustomizeNinePatch( TestApplication& application,
   return resourcePtr;
 }
 
-void TestControlRendererRender( ToolkitTestApplication& application, Actor& actor, ControlRenderer& controlRenderer, Integration::ResourcePointer resourcePtr = Integration::ResourcePointer(), std::size_t expectedSamplers = 0)
+void TestControlRendererRender( ToolkitTestApplication& application,
+                                Actor& actor,
+                                ControlRenderer& controlRenderer,
+                                std::size_t expectedSamplers = 0,
+                                ImageDimensions imageDimensions = ImageDimensions(),
+                                Integration::ResourcePointer resourcePtr = Integration::ResourcePointer())
 {
+  if( resourcePtr )
+  {
+    // set the image size, for test case, this needs to be set before loading started
+    application.GetPlatform().SetClosestImageSize(  Vector2(imageDimensions.GetWidth(), imageDimensions.GetHeight()) );
+  }
+
   actor.SetSize( 200.f, 200.f );
   Stage::GetCurrent().Add( actor );
   controlRenderer.SetSize( Vector2(200.f, 200.f) );
@@ -434,7 +445,7 @@ int UtcDaliRendererFactoryGetLinearGradientRenderer(void)
 
   // A lookup texture is generated and pass to shader as sampler
   Actor actor = Actor::New();
-  TestControlRendererRender( application, actor, controlRenderer, Integration::ResourcePointer(), 1u );
+  TestControlRendererRender( application, actor, controlRenderer, 1u );
 
   controlRenderer.SetOffStage( actor );
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
@@ -474,7 +485,7 @@ int UtcDaliRendererFactoryGetRadialGradientRenderer(void)
 
   // A lookup texture is generated and pass to shader as sampler
   Actor actor = Actor::New();
-  TestControlRendererRender( application, actor, controlRenderer, Integration::ResourcePointer(), 1u );
+  TestControlRendererRender( application, actor, controlRenderer, 1u );
 
   Matrix3 alignMatrix( radius, 0.f, 0.f, 0.f, radius, 0.f, center.x, center.y, 1.f );
   alignMatrix.Invert();
@@ -503,7 +514,11 @@ int UtcDaliRendererFactoryGetImageRenderer1(void)
   DALI_TEST_CHECK( controlRenderer );
 
   Actor actor = Actor::New();
-  TestControlRendererRender( application, actor, controlRenderer, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)), 1u );
+  // 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.
+  TestControlRendererRender( application, actor, controlRenderer, 1u,
+                             ImageDimensions(512, 513),
+                             Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)));
 
   TestGlAbstraction& gl = application.GetGlAbstraction();
   int textureUnit = -1;
@@ -528,7 +543,11 @@ int UtcDaliRendererFactoryGetImageRenderer2(void)
   ControlRenderer controlRenderer = factory.GetControlRenderer( image );
 
   Actor actor = Actor::New();
-  TestControlRendererRender( application, actor, controlRenderer, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)), 1u );
+  // 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.
+  TestControlRendererRender( application, actor, controlRenderer, 1u,
+                             ImageDimensions(512, 513),
+                             Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)) );
 
   TestGlAbstraction& gl = application.GetGlAbstraction();
   int textureUnit = -1;
@@ -563,7 +582,9 @@ int UtcDaliRendererFactoryGetNPatchRenderer1(void)
     DALI_TEST_CHECK( controlRenderer );
 
     Actor actor = Actor::New();
-    TestControlRendererRender( application, actor, controlRenderer, ninePatchResource, 1u );
+    TestControlRendererRender( application, actor, controlRenderer, 1u,
+                               ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
+                               ninePatchResource );
 
     TestGlAbstraction& gl = application.GetGlAbstraction();
     int textureUnit = -1;
@@ -578,7 +599,9 @@ int UtcDaliRendererFactoryGetNPatchRenderer1(void)
     DALI_TEST_CHECK( controlRenderer );
 
     Actor actor = Actor::New();
-    TestControlRendererRender( application, actor, controlRenderer, ninePatchResource, 1u );
+    TestControlRendererRender( application, actor, controlRenderer, 1u,
+                               ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
+                               ninePatchResource );
 
     TestGlAbstraction& gl = application.GetGlAbstraction();
     int textureUnit = -1;
@@ -618,7 +641,9 @@ int UtcDaliRendererFactoryGetNPatchRenderer2(void)
     DALI_TEST_CHECK( controlRenderer );
 
     Actor actor = Actor::New();
-    TestControlRendererRender( application, actor, controlRenderer, ninePatchResource, 1u );
+    TestControlRendererRender( application, actor, controlRenderer, 1u,
+                               ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
+                               ninePatchResource );
 
     TestGlAbstraction& gl = application.GetGlAbstraction();
     int textureUnit = -1;
@@ -636,7 +661,9 @@ int UtcDaliRendererFactoryGetNPatchRenderer2(void)
     DALI_TEST_CHECK( controlRenderer );
 
     Actor actor = Actor::New();
-    TestControlRendererRender( application, actor, controlRenderer, ninePatchResource, 1u );
+    TestControlRendererRender( application, actor, controlRenderer, 1u,
+                               ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
+                               ninePatchResource );
 
     TestGlAbstraction& gl = application.GetGlAbstraction();
     int textureUnit = -1;
@@ -670,7 +697,9 @@ int UtcDaliRendererFactoryGetNPatchRenderer3(void)
   DALI_TEST_CHECK( controlRenderer );
 
   Actor actor = Actor::New();
-  TestControlRendererRender( application, actor, controlRenderer, ninePatchResource, 1u );
+  TestControlRendererRender( application, actor, controlRenderer, 1u,
+                             ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
+                             ninePatchResource );
 
   TestGlAbstraction& gl = application.GetGlAbstraction();
   int textureUnit = -1;
@@ -705,7 +734,9 @@ int UtcDaliRendererFactoryGetNPatchRenderer4(void)
   DALI_TEST_CHECK( controlRenderer );
 
   Actor actor = Actor::New();
-  TestControlRendererRender( application, actor, controlRenderer, ninePatchResource, 1u );
+  TestControlRendererRender( application, actor, controlRenderer, 1u,
+                             ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
+                             ninePatchResource );
 
   TestGlAbstraction& gl = application.GetGlAbstraction();
   int textureUnit = -1;
@@ -730,7 +761,9 @@ int UtcDaliRendererFactoryGetNPatchRendererN1(void)
 
   Actor actor = Actor::New();
   //The testkit still has to load a bitmap for the broken renderer image
-  TestControlRendererRender( application, actor, controlRenderer, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)), 1u );
+  TestControlRendererRender( application, actor, controlRenderer, 1u,
+                             ImageDimensions(),
+                             Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)) );
 
   TestGlAbstraction& gl = application.GetGlAbstraction();
   int textureUnit = -1;
@@ -759,7 +792,9 @@ int UtcDaliRendererFactoryGetNPatchRendererN2(void)
 
   Actor actor = Actor::New();
   //The testkit still has to load a bitmap for the broken renderer image
-  TestControlRendererRender( application, actor, controlRenderer, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)), 1u );
+  TestControlRendererRender( application, actor, controlRenderer, 1u,
+                             ImageDimensions(),
+                             Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)) );
 
   TestGlAbstraction& gl = application.GetGlAbstraction();
   int textureUnit = -1;
index 1870b9e..5c2d497 100644 (file)
@@ -51,8 +51,33 @@ int UtcDaliCreateAlphaDiscardEffect(void)
 {
   ToolkitTestApplication application;
 
-  ShaderEffect effect = Toolkit::CreateAlphaDiscardEffect();
-  DALI_TEST_CHECK( effect );
+  Property::Map effect = Toolkit::CreateAlphaDiscardEffect();
+  DALI_TEST_CHECK( !effect.Empty() );
+
+  Property::Value* customShaderValue = effect.Find( "shader" );
+  DALI_TEST_CHECK( customShaderValue );
+
+  Property::Map customShader;
+  DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
+
+  Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+  DALI_TEST_CHECK( !vertexShaderValue );
+
+  Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+  DALI_TEST_CHECK( fragmentShaderValue );
+
+  std::string fragmentShader;
+  DALI_TEST_CHECK( fragmentShaderValue->Get( fragmentShader ) );
+  DALI_TEST_CHECK( !fragmentShader.empty() );
+
+  Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+  DALI_TEST_CHECK( !gridXValue );
+
+  Property::Value* gridYValue = customShader.Find( "subdivideGridY" );
+  DALI_TEST_CHECK( !gridYValue );
+
+  Property::Value* hintsValue = customShader.Find( "hints" );
+  DALI_TEST_CHECK( !hintsValue );
 
   END_TEST;
 }
@@ -237,8 +262,33 @@ int UtcDaliCreateImageRegionEffect(void)
 {
   ToolkitTestApplication application;
 
-  ShaderEffect effect = Toolkit::CreateImageRegionEffect();
-  DALI_TEST_CHECK( effect );
+  Property::Map effect = Toolkit::CreateImageRegionEffect();
+  DALI_TEST_CHECK( !effect.Empty() );
+
+  Property::Value* customShaderValue = effect.Find( "shader" );
+  DALI_TEST_CHECK( customShaderValue );
+
+  Property::Map customShader;
+  DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
+
+  Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+  DALI_TEST_CHECK( vertexShaderValue );
+
+  std::string vertexShader;
+  DALI_TEST_CHECK( vertexShaderValue->Get( vertexShader ) );
+  DALI_TEST_CHECK( !vertexShader.empty() );
+
+  Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+  DALI_TEST_CHECK( !fragmentShaderValue );
+
+  Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+  DALI_TEST_CHECK( !gridXValue );
+
+  Property::Value* gridYValue = customShader.Find( "subdivideGridY" );
+  DALI_TEST_CHECK( !gridYValue );
+
+  Property::Value* hintsValue = customShader.Find( "hints" );
+  DALI_TEST_CHECK( !hintsValue );
 
   END_TEST;
 }
index 4d1e40a..0b557a0 100644 (file)
@@ -35,15 +35,19 @@ namespace Toolkit
  *
  * Usage example:
  *
- *   ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) );
- *   ShaderEffect alphaDiscardEffect = CreateAlphaDiscardEffect();
- *   actor.SetShaderEffect( alphaDiscardEffect );
+ *   ImageView actor = ImageView::New( EXAMPLE_IMAGE_PATH );
+ *   Property::Map alphaDiscardEffect = CreateAlphaDiscardEffect();
+ *   actor.SetProperty( ImageView::Property::IMAGE, alphaDiscardEffect );
  *
  * @return A handle to a newly allocated ShaderEffect.
  */
-inline ShaderEffect CreateAlphaDiscardEffect()
+inline Property::Map CreateAlphaDiscardEffect()
 {
   const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE =
+      "varying mediump vec2 vTexCoord;                                \n"
+      "                                                               \n"
+      "uniform sampler2D sTexture;                                    \n"
+      "uniform lowp vec4 uColor;                                      \n"
       "void main()                                                    \n"
       "{                                                              \n"
       "  mediump vec4 color = texture2D( sTexture, vTexCoord );       \n"
@@ -54,9 +58,13 @@ inline ShaderEffect CreateAlphaDiscardEffect()
       "  gl_FragColor = color * uColor;                               \n"
       "}                                                              \n";
 
-  return ShaderEffect::New( "", // Use default
-                            ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE );
-}
+  Property::Map map;
+
+  Property::Map customShader;
+  customShader[ "fragmentShader" ] = ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE;
+
+  map[ "shader" ] = customShader;
+  return map;}
 
 } // namespace Toolkit
 
index 2bce6b3..7d263d9 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/object/property-map.h>
 
 namespace Dali
 {
@@ -40,14 +40,23 @@ namespace Toolkit
  *
  * @return A handle to a newly allocated ShaderEffect
  */
-inline ShaderEffect CreateImageRegionEffect()
+inline Property::Map CreateImageRegionEffect()
 {
   std::string vertexShader(
+      "attribute mediump vec2 aPosition;\n"
+      "\n"
+      "uniform mediump mat4 uMvpMatrix;\n"
+      "uniform vec3 uSize;\n"
+      "uniform vec4 uTextureRect;"
+      "\n"
+      "varying vec2 vTexCoord;\n"
+
       "uniform mediump vec2 uTopLeft;\n"
       "uniform mediump vec2 uBottomRight;\n"
       "void main()\n"
       "{\n"
-      "  mediump vec4 position = vec4(aPosition,1.0);\n"
+      "  mediump vec4 position = vec4(aPosition, 0.0, 1.0);\n"
+      "  position.xyz *= uSize;\n"
       "  gl_Position = uMvpMatrix * position;\n"
       // The line below is doing the same as the following commented lines:
       //"  vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n"
@@ -55,15 +64,19 @@ inline ShaderEffect CreateImageRegionEffect()
       //"  vec2 bottomRight = sTextureRect.xy + uBottomRight * imageSize;\n"
       //"  vec2 texCoord = (aTexCoord - sTextureRect.xy) / imageSize;\n"
       //"  vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n"
-      "  vTexCoord = sTextureRect.xy + uTopLeft * ( sTextureRect.zw - sTextureRect.xy ) + ( aTexCoord - sTextureRect.xy ) * ( uBottomRight - uTopLeft );\n"
+
+      "  vec2 texCoord = aPosition + vec2(0.5);\n"
+      "  vTexCoord = uTextureRect.xy + uTopLeft * ( uTextureRect.zw - uTextureRect.xy ) + ( texCoord - uTextureRect.xy ) * ( uBottomRight - uTopLeft );\n"
       "}\n"
   );
 
-  Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, "" );
-  shaderEffect.SetUniform( "uTopLeft", Vector2( 0.f, 0.f ) );
-  shaderEffect.SetUniform( "uBottomRight", Vector2( 1.f, 1.f ) );
+  Property::Map map;
+
+  Property::Map customShader;
+  customShader[ "vertexShader" ] = vertexShader;
 
-  return shaderEffect;
+  map[ "shader" ] = customShader;
+  return map;
 }
 
 } // namespace Toolkit
index 4548ac9..f8b0fb2 100644 (file)
@@ -30,6 +30,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 
 /**
  * Button states and contents
@@ -574,18 +575,14 @@ const Vector4 Button::GetSelectedColor() const
 
 void Button::SetUnselectedImage( const std::string& filename )
 {
-  ImageActor newContent;
+  Toolkit::ImageView newContent;
   if( !filename.empty() )
   {
-    Image resourceimage = Dali::ResourceImage::New( filename );
-    if( resourceimage )
-    {
-      newContent = ImageActor::New( resourceimage );
-    }
+    newContent = Toolkit::ImageView::New( filename );
   }
   else
   {
-    newContent = ImageActor::New();
+    newContent = Toolkit::ImageView::New();
   }
 
   if( newContent )
@@ -606,18 +603,14 @@ Actor& Button::GetUnselectedImage()
 
 void Button::SetSelectedImage( const std::string& filename )
 {
-  ImageActor newContent;
+  Toolkit::ImageView newContent;
   if( !filename.empty() )
   {
-    Image resourceimage = Dali::ResourceImage::New( filename );
-    if( resourceimage )
-    {
-      newContent = ImageActor::New( resourceimage );
-    }
+   newContent = Toolkit::ImageView::New( filename );
   }
   else
   {
-    newContent = ImageActor::New();
+    newContent = Toolkit::ImageView::New();
   }
 
   if( newContent )
@@ -638,14 +631,10 @@ Actor& Button::GetSelectedImage()
 
 void Button::SetBackgroundImage( const std::string& filename )
 {
-  Image resourceimage = Dali::ResourceImage::New( filename );
-  if( resourceimage )
-  {
-    SetupContent( mBackgroundContent, ImageActor::New( resourceimage ) );
+  SetupContent( mBackgroundContent, Toolkit::ImageView::New( filename ) );
 
-    OnBackgroundImageSet();
-    RelayoutRequest();
-  }
+  OnBackgroundImageSet();
+  RelayoutRequest();
 }
 
 Actor& Button::GetBackgroundImage()
@@ -655,14 +644,10 @@ Actor& Button::GetBackgroundImage()
 
 void Button::SetSelectedBackgroundImage( const std::string& filename )
 {
-  Image resourceimage = Dali::ResourceImage::New( filename );
-  if( resourceimage )
-  {
-    SetupContent( mSelectedBackgroundContent, ImageActor::New( resourceimage ) );
+  SetupContent( mSelectedBackgroundContent, Toolkit::ImageView::New( filename ) );
 
-    OnSelectedBackgroundImageSet();
-    RelayoutRequest();
-  }
+  OnSelectedBackgroundImageSet();
+  RelayoutRequest();
 }
 
 Actor& Button::GetSelectedBackgroundImage()
@@ -672,14 +657,10 @@ Actor& Button::GetSelectedBackgroundImage()
 
 void Button::SetDisabledImage( const std::string& filename )
 {
-  Image resourceimage = Dali::ResourceImage::New( filename );
-  if( resourceimage )
-  {
-    SetupContent( mDisabledContent, ImageActor::New( resourceimage ) );
+  SetupContent( mDisabledContent, Toolkit::ImageView::New( filename ) );
 
-    OnDisabledImageSet();
-    RelayoutRequest();
-  }
+  OnDisabledImageSet();
+  RelayoutRequest();
 }
 
 Actor& Button::GetDisabledImage()
@@ -689,14 +670,10 @@ Actor& Button::GetDisabledImage()
 
 void Button::SetDisabledSelectedImage( const std::string& filename )
 {
-  Image resourceimage = Dali::ResourceImage::New( filename );
-  if( resourceimage )
-  {
-    SetupContent( mDisabledSelectedContent, ImageActor::New( resourceimage ) );
+  SetupContent( mDisabledSelectedContent, Toolkit::ImageView::New( filename ) );
 
-    OnDisabledSelectedImageSet();
-    RelayoutRequest();
-  }
+  OnDisabledSelectedImageSet();
+  RelayoutRequest();
 }
 
 Actor& Button::GetDisabledSelectedImage()
@@ -706,14 +683,10 @@ Actor& Button::GetDisabledSelectedImage()
 
 void Button::SetDisabledBackgroundImage( const std::string& filename )
 {
-  Image resourceimage = Dali::ResourceImage::New( filename );
-  if( resourceimage )
-  {
-    SetupContent( mDisabledBackgroundContent, ImageActor::New( resourceimage ) );
+  SetupContent( mDisabledBackgroundContent, Toolkit::ImageView::New( filename ) );
 
-    OnDisabledBackgroundImageSet();
-    RelayoutRequest();
-  }
+  OnDisabledBackgroundImageSet();
+  RelayoutRequest();
 }
 
 Actor& Button::GetDisabledBackgroundImage()
@@ -1198,7 +1171,6 @@ void Button::PrepareAddButtonImage( Actor& actor )
 {
   if( actor )
   {
-    actor.Unparent();
     Self().Add( actor );
     PrepareForTranstionOut( actor );
   }
@@ -1221,7 +1193,6 @@ void Button::AddButtonImage( Actor& actor )
 {
   if( actor )
   {
-    actor.Unparent();
     Self().Add( actor );
   }
 }
index e468c0e..44d62a5 100644 (file)
 #include "check-box-button-impl.h"
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/images/resource-image.h>
 
 //INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
+#include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
 #include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
 
 namespace Dali
@@ -40,8 +41,6 @@ namespace
 
 const float DISTANCE_BETWEEN_IMAGE_AND_LABEL( 5.0f );
 const float ANIMATION_TIME( 0.26f );  // EFL checkbox tick time
-// Required for the UV reveal shader to render the tick on top of the rest of the checkbox.
-const float SHADER_DEPTH_OFFSET = 1.0f;
 
 BaseHandle Create()
 {
@@ -83,6 +82,21 @@ CheckBoxButton::~CheckBoxButton()
 {
 }
 
+void CheckBoxButton::SetTickUVEffect()
+{
+  Toolkit::ImageView imageView = Toolkit::ImageView::DownCast( mSelectedImage );
+  if( imageView )
+  {
+    imageView.RegisterProperty( "uTextureRect", Vector4(0.f, 0.f, 1.f, 1.f ) );
+    imageView.RegisterProperty( "uTopLeft", Vector2::ZERO );
+
+    Property::Map shaderMap = CreateImageRegionEffect();
+    imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, shaderMap );
+
+    GetImpl( imageView ).SetDepthIndex( DECORATION_DEPTH_INDEX );
+  }
+}
+
 void CheckBoxButton::OnButtonInitialize()
 {
   // Wrap around all children
@@ -92,6 +106,9 @@ void CheckBoxButton::OnButtonInitialize()
   SetSelectedImage( SELECTED_BUTTON_IMAGE_DIR );
   SetDisabledImage( DISABLED_UNSELECTED_BUTTON_IMAGE_DIR );
   SetDisabledSelectedImage( DISABLED_SELECTED_BUTTON_IMAGE_DIR );
+
+  mSelectedImage = GetSelectedImage();
+  SetTickUVEffect();
 }
 
 void CheckBoxButton::OnLabelSet( bool noPadding )
@@ -163,19 +180,12 @@ void CheckBoxButton::PrepareForTranstionIn( Actor actor )
   if( actor == selectedImage )
   {
     actor.SetScale( Vector3( 0.0f, 1.0f, 1.0f ) );
+    actor.RegisterProperty( "uBottomRight", Vector2( 0.0f, 1.0f ) );
 
-    if( !mTickUVEffect )
+    if( mSelectedImage != selectedImage )
     {
-      mTickUVEffect = CreateImageRegionEffect();
-    }
-    mTickUVEffect.SetUniform( "uBottomRight", Vector2( 0.0f, 1.0f ) );
-
-    ImageActor imageActor = ImageActor::DownCast( actor );
-    if( imageActor )
-    {
-      // Ensure the tick effect is rendered above the reset of the checkbox.
-      imageActor.SetSortModifier( SHADER_DEPTH_OFFSET );
-      imageActor.SetShaderEffect( mTickUVEffect );
+      mSelectedImage = selectedImage;
+      SetTickUVEffect();
     }
   }
 }
@@ -186,17 +196,12 @@ void CheckBoxButton::PrepareForTranstionOut( Actor actor )
   if( actor == selectedImage )
   {
     actor.SetScale( Vector3::ONE );
+    actor.RegisterProperty( "uBottomRight", Vector2::ONE );
 
-    if( !mTickUVEffect )
+    if( mSelectedImage != selectedImage )
     {
-      mTickUVEffect = CreateImageRegionEffect();
-    }
-    mTickUVEffect.SetUniform( "uBottomRight", Vector2::ONE );
-
-    ImageActor imageActor = ImageActor::DownCast( actor );
-    if( imageActor )
-    {
-      imageActor.SetShaderEffect( mTickUVEffect );
+      mSelectedImage = selectedImage;
+      SetTickUVEffect();
     }
   }
 }
@@ -211,12 +216,9 @@ void CheckBoxButton::OnTransitionIn( Actor actor )
       Dali::Animation transitionAnimation = GetTransitionAnimation();
       if( transitionAnimation )
       {
-        DALI_ASSERT_DEBUG( mTickUVEffect );
-        if( mTickUVEffect )
-        {
-          // UV anim
-          transitionAnimation.AnimateTo( Property( mTickUVEffect, "uBottomRight" ), Vector2::ONE );
-        }
+        // UV anim
+        transitionAnimation.AnimateTo( Property( actor, "uBottomRight" ), Vector2::ONE );
+
         // Actor size anim
         transitionAnimation.AnimateTo( Property( actor, Actor::Property::SCALE_X ), 1.0f );
       }
@@ -225,9 +227,9 @@ void CheckBoxButton::OnTransitionIn( Actor actor )
     {
       //explicitly end the swipe animation
       actor.SetScale( Vector3::ONE );
-      if( mTickUVEffect )
+      if( mSelectedImage == selectedImage  )
       {
-        mTickUVEffect.SetUniform( "uBottomRight", Vector2::ONE );
+        actor.RegisterProperty( "uBottomRight", Vector2::ONE );
       }
     }
   }
index 1697001..e80b838 100644 (file)
@@ -64,6 +64,11 @@ private:
    */
   virtual ~CheckBoxButton();
 
+  /**
+   * Setup the ticking effect to the selected image.
+   */
+  void SetTickUVEffect();
+
 private: // From Button
 
 
@@ -106,7 +111,7 @@ private:
   CheckBoxButton& operator=( const CheckBoxButton& );
 
 private:
-  ShaderEffect              mTickUVEffect;         ///< ImageRegionEffect to expand the tick across
+  Actor         mSelectedImage;
 };
 
 } // namespace Internal
index 4331c87..49d84fb 100644 (file)
@@ -26,6 +26,7 @@
 #include <dali/devel-api/scripting/scripting.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 
 namespace Dali
@@ -145,7 +146,7 @@ void PushButton::OnButtonInitialize()
 void PushButton::SetIcon( DecorationState state, const std::string iconFilename )
 {
   mIconName[ state ] = iconFilename;
-  SetDecoration( state, ImageActor::New( Dali::ResourceImage::New( iconFilename ) ) );
+  SetDecoration( state, Toolkit::ImageView::New( iconFilename  ) );
   ConfigureSizeNegotiation();
 }
 
index e47d1cd..714701a 100644 (file)
@@ -92,22 +92,26 @@ void ImageView::SetImage( Property::Map map )
   Actor self = Self();
   Toolkit::RendererFactory::Get().ResetRenderer( mRenderer, self, mPropertyMap );
 
-  int width = 0;
   Property::Value* widthValue = mPropertyMap.Find( "width" );
   if( widthValue )
   {
-    widthValue->Get( width );
+    int width;
+    if( widthValue->Get( width ) )
+    {
+      mImageSize = ImageDimensions( width, mImageSize.GetHeight() );
+    }
   }
 
-  int height = 0;
   Property::Value* heightValue = mPropertyMap.Find( "height" );
   if( heightValue )
   {
-    heightValue->Get( height );
+    int height;
+    if( heightValue->Get( height ) )
+    {
+      mImageSize = ImageDimensions( mImageSize.GetWidth(), height );
+    }
   }
 
-  mImageSize = ImageDimensions( width, height );
-
   RelayoutRequest();
 }
 
@@ -138,6 +142,11 @@ void ImageView::SetImage( const std::string& url, ImageDimensions size )
   }
 }
 
+void ImageView::SetDepthIndex( int depthIndex )
+{
+  mRenderer.SetDepthIndex( depthIndex );
+}
+
 Vector3 ImageView::GetNaturalSize()
 {
   Vector3 size;
index 124ae5f..86437ff 100644 (file)
@@ -94,6 +94,15 @@ public:
    */
   static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
 
+  /**
+   * @brief Set the depth index of this image renderer
+   *
+   * Renderer with higher depth indices are rendered in front of other renderers with smaller values
+   *
+   * @param[in] depthIndex The depth index of this renderer
+   */
+  void SetDepthIndex( int depthIndex );
+
 private: // From Control
 
   /**
index 7a84f4e..66eeca1 100755 (executable)
@@ -37,6 +37,7 @@
 #include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
 
@@ -305,7 +306,7 @@ void Popup::OnInitialize()
   mPopupLayout = Toolkit::TableView::New( 3, 1 );
 
   // Adds the default background image.
-  SetPopupBackgroundImage( ImageActor::New( ResourceImage::New( DEFAULT_BACKGROUND_IMAGE_PATH ) ) );
+  SetPopupBackgroundImage( Toolkit::ImageView::New( ResourceImage::New( DEFAULT_BACKGROUND_IMAGE_PATH ) ) );
 
   mPopupLayout.SetName( "popupLayoutTable" );
   mPopupLayout.SetParentOrigin( ParentOrigin::CENTER );
@@ -849,7 +850,7 @@ void Popup::LayoutTail()
   {
     // Adds the tail actor.
     Image tail = ResourceImage::New( image );
-    mTailImage = ImageActor::New( tail );
+    mTailImage = Toolkit::ImageView::New( tail );
     mTailImage.SetName( "tailImage" );
     const Vector3 anchorPoint = AnchorPoint::BOTTOM_RIGHT - position;
     mTailImage.SetParentOrigin( position );
@@ -1227,7 +1228,7 @@ void Popup::SetProperty( BaseObject* object, Property::Index propertyIndex, cons
           Image image = ResourceImage::New( valueString );
           if( image )
           {
-            ImageActor actor = ImageActor::New( image );
+            Toolkit::ImageView actor = Toolkit::ImageView::New( image );
             popupImpl.SetPopupBackgroundImage( actor );
           }
         }
index f142d59..e781e05 100644 (file)
@@ -312,35 +312,23 @@ void ImageRenderer::DoInitialize( Actor& actor, const Property::Map& propertyMap
     mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
   }
 
+  // remove old renderer if exit
   if( mImpl->mRenderer )
   {
-    //remove old renderer
-    if( actor )
+    if( actor ) //remove old renderer from actor
     {
       actor.RemoveRenderer( mImpl->mRenderer );
     }
-
-    //clean the cache
-    if( !oldImageUrl.empty() )
+    if( !oldImageUrl.empty() ) //clean old renderer from cache
     {
       CleanCache( oldImageUrl );
     }
+  }
 
-    //Initialize the renderer
-    if( !mImageUrl.empty() )
-    {
-      InitializeRenderer( mImageUrl );
-    }
-    else if( mImage )
-    {
-      InitializeRenderer( mImage );
-    }
-
-    //add the new renderer to the actor
-    if( actor && mImpl->mRenderer )
-    {
-      actor.AddRenderer( mImpl->mRenderer );
-    }
+  // if actor is on stage, create new renderer and apply to actor
+  if( actor && actor.OnStage() )
+  {
+    SetOnStage( actor );
   }
 }
 
@@ -414,37 +402,39 @@ Renderer ImageRenderer::CreateRenderer() const
 
 void ImageRenderer::InitializeRenderer( const std::string& imageUrl )
 {
-  if( mImageUrl.empty() )
+  if( imageUrl.empty() )
   {
-    mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
     return;
   }
 
+  mImageUrl = imageUrl;
   mImpl->mRenderer.Reset();
+
   if( !mImpl->mCustomShader )
   {
     mImpl->mRenderer = mFactoryCache.GetRenderer( imageUrl );
     if( !mImpl->mRenderer )
     {
-        Material material = mAtlasManager.Add(mTextureRect, imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
-        if( material )
-        {
-          Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
-          mImpl->mRenderer = Renderer::New( geometry, material );
-          SetTextureRectUniform(mTextureRect);
-        }
-        else // big image, atlasing is not applied
-        {
-          mImpl->mRenderer = CreateRenderer();
-          SetTextureRectUniform(FULL_TEXTURE_RECT);
+      Material material = mAtlasManager.Add(mTextureRect, imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
+      if( material )
+      {
+        Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
+        mImpl->mRenderer = Renderer::New( geometry, material );
+        SetTextureRectUniform(mTextureRect);
+      }
+      else // big image, atlasing is not applied
+      {
+        mImpl->mRenderer = CreateRenderer();
+        mTextureRect = FULL_TEXTURE_RECT;
+        SetTextureRectUniform(mTextureRect);
 
-          ResourceImage image = Dali::ResourceImage::New( imageUrl );
-          image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
-          Material material = mImpl->mRenderer.GetMaterial();
-          material.AddTexture( image, TEXTURE_UNIFORM_NAME );
-        }
+        ResourceImage image = Dali::ResourceImage::New( imageUrl );
+        image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
+        Material material = mImpl->mRenderer.GetMaterial();
+        material.AddTexture( image, TEXTURE_UNIFORM_NAME );
+      }
 
-        mFactoryCache.SaveRenderer( imageUrl, mImpl->mRenderer );
+      mFactoryCache.SaveRenderer( imageUrl, mImpl->mRenderer );
     }
     else
     {
@@ -457,9 +447,16 @@ void ImageRenderer::InitializeRenderer( const std::string& imageUrl )
   {
     mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
     mImpl->mRenderer = CreateRenderer();
-    ResourceImage image = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
-    image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
-    ApplyImageToSampler( image );
+    ResourceImage resourceImage = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
+    resourceImage.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
+    ApplyImageToSampler( resourceImage );
+
+    // custom shader with the default image vertex shader
+    if( mImpl->mCustomShader->mVertexShader.empty() )
+    {
+      mTextureRect = FULL_TEXTURE_RECT;
+      SetTextureRectUniform( mTextureRect );
+    }
   }
 }
 
@@ -474,7 +471,13 @@ void ImageRenderer::InitializeRenderer( const Image& image )
 
   mImpl->mRenderer = CreateRenderer();
   ApplyImageToSampler( image );
-  SetTextureRectUniform( FULL_TEXTURE_RECT );
+
+  // default shader or custom shader with the default image vertex shader
+  if( !mImpl->mCustomShader || mImpl->mCustomShader->mVertexShader.empty() )
+  {
+    mTextureRect = FULL_TEXTURE_RECT;
+    SetTextureRectUniform( mTextureRect );
+  }
 }
 
 
@@ -488,22 +491,6 @@ void ImageRenderer::DoSetOnStage( Actor& actor )
   {
     InitializeRenderer( mImage );
   }
-
-  if( !GetIsFromCache() )
-  {
-    Image image = mImage;
-    if( !mImageUrl.empty() )
-    {
-      ResourceImage resourceImage = Dali::ResourceImage::New( mImageUrl, mDesiredSize, mFittingMode, mSamplingMode );
-      resourceImage.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
-      image = resourceImage;
-
-      // Set value to the uTextureRect uniform
-      SetTextureRectUniform( FULL_TEXTURE_RECT );
-    }
-
-    ApplyImageToSampler( image );
-  }
 }
 
 void ImageRenderer::DoSetOffStage( Actor& actor )
@@ -632,15 +619,18 @@ Shader ImageRenderer::GetImageShader( RendererFactoryCache& factoryCache )
 
 void ImageRenderer::SetImage( Actor& actor, const std::string& imageUrl, ImageDimensions size, Dali::FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode )
 {
-  mDesiredSize = size;
-  mFittingMode = fittingMode;
-  mSamplingMode = samplingMode;
-
   if( mImageUrl != imageUrl )
   {
+    std::string oldImageUrl = mImageUrl;
+    mImageUrl = imageUrl;
+    mDesiredSize = size;
+    mFittingMode = fittingMode;
+    mSamplingMode = samplingMode;
+    mImage.Reset();
+
     if( mImpl->mRenderer )
     {
-      if( GetIsFromCache() )
+      if( GetIsFromCache() ) // if renderer is from cache, remove the old one
       {
         //remove old renderer
         if( actor )
@@ -649,31 +639,23 @@ void ImageRenderer::SetImage( Actor& actor, const std::string& imageUrl, ImageDi
         }
 
         //clean the cache
-        if( !mImageUrl.empty() )
+        if( !oldImageUrl.empty() )
         {
-          CleanCache(mImageUrl);
+          CleanCache(oldImageUrl);
         }
 
-        //Initialize the renderer
-        InitializeRenderer( imageUrl );
-
-        //add the new renderer to the actor
-        if( actor && mImpl->mRenderer )
+        if( actor && actor.OnStage() ) // if actor on stage, create a new renderer and apply to actor
         {
-          actor.AddRenderer( mImpl->mRenderer );
+          SetOnStage(actor);
         }
       }
-      else
+      else // if renderer is not from cache, reuse the same renderer and only change the texture
       {
         ResourceImage image = Dali::ResourceImage::New( imageUrl, mDesiredSize, mFittingMode, mSamplingMode );
         image.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
         ApplyImageToSampler( image );
       }
     }
-
-    mImageUrl = imageUrl;
-
-    mImage.Reset();
   }
 }
 
@@ -681,9 +663,11 @@ void ImageRenderer::SetImage( Actor& actor, const Image& image )
 {
   if( mImage != image )
   {
+    mImage = image;
+
     if( mImpl->mRenderer )
     {
-      if( GetIsFromCache() )
+      if( GetIsFromCache() ) // if renderer is from cache, remove the old one
       {
         //remove old renderer
         if( actor )
@@ -696,24 +680,19 @@ void ImageRenderer::SetImage( Actor& actor, const Image& image )
         {
           CleanCache(mImageUrl);
         }
+        mImageUrl.clear();
 
-        //Initialize the renderer
-        InitializeRenderer( image );
-
-        //add the new renderer to the actor
-        if( actor && mImpl->mRenderer )
+        if( actor && actor.OnStage() ) // if actor on stage, create a new renderer and apply to actor
         {
-          actor.AddRenderer( mImpl->mRenderer );
+          SetOnStage(actor);
         }
       }
-      else
+      else // if renderer is not from cache, reuse the same renderer and only change the texture
       {
         ApplyImageToSampler( image );
       }
     }
-    SetTextureRectUniform( FULL_TEXTURE_RECT );
 
-    mImage = image;
     mImageUrl.clear();
     mDesiredSize = ImageDimensions();
     mFittingMode = FittingMode::DEFAULT;
index e13e85d..70961ba 100644 (file)
@@ -308,24 +308,53 @@ Geometry NPatchRenderer::CreateGeometry()
 Shader NPatchRenderer::CreateShader()
 {
   Shader shader;
-  if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
+  if( !mImpl->mCustomShader )
   {
-    shader = mFactoryCache.GetShader( RendererFactoryCache::NINE_PATCH_SHADER );
-    if( !shader )
+    if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
+    {
+      shader = mFactoryCache.GetShader( RendererFactoryCache::NINE_PATCH_SHADER );
+      if( !shader )
+      {
+        shader = Shader::New( VERTEX_SHADER_3X3, FRAGMENT_SHADER );
+        mFactoryCache.SaveShader( RendererFactoryCache::NINE_PATCH_SHADER, shader );
+      }
+    }
+    else if( mStretchPixelsX.Size() > 0 || mStretchPixelsY.Size() > 0)
     {
-      shader = Shader::New( VERTEX_SHADER_3X3, FRAGMENT_SHADER );
-      mFactoryCache.SaveShader( RendererFactoryCache::NINE_PATCH_SHADER, shader );
+      std::stringstream vertexShader;
+      vertexShader << "#define FACTOR_SIZE_X " << mStretchPixelsX.Size() + 2 << "\n"
+                   << "#define FACTOR_SIZE_Y " << mStretchPixelsY.Size() + 2 << "\n"
+                   << VERTEX_SHADER;
+
+      shader = Shader::New( vertexShader.str(), FRAGMENT_SHADER );
     }
   }
-  else if( mStretchPixelsX.Size() > 0 || mStretchPixelsY.Size() > 0)
+  else
   {
-    std::stringstream vertexShader;
-    vertexShader << "#define FACTOR_SIZE_X " << mStretchPixelsX.Size() + 2 << "\n"
-                 << "#define FACTOR_SIZE_Y " << mStretchPixelsY.Size() + 2 << "\n"
-                 << VERTEX_SHADER;
+    const char* fragmentShader = FRAGMENT_SHADER;
+    Dali::Shader::ShaderHints hints = Dali::Shader::HINT_NONE;
 
-    shader = Shader::New( vertexShader.str(), FRAGMENT_SHADER );
+    if( !mImpl->mCustomShader->mFragmentShader.empty() )
+    {
+      fragmentShader = mImpl->mCustomShader->mFragmentShader.c_str();
+    }
+    hints = mImpl->mCustomShader->mHints;
+
+    if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
+    {
+      shader = Shader::New( VERTEX_SHADER_3X3, fragmentShader, hints );
+    }
+    else if( mStretchPixelsX.Size() > 0 || mStretchPixelsY.Size() > 0)
+    {
+      std::stringstream vertexShader;
+      vertexShader << "#define FACTOR_SIZE_X " << mStretchPixelsX.Size() + 2 << "\n"
+                   << "#define FACTOR_SIZE_Y " << mStretchPixelsY.Size() + 2 << "\n"
+                   << VERTEX_SHADER;
+
+      shader = Shader::New( vertexShader.str(), fragmentShader, hints );
+    }
   }
+
   return shader;
 }
 
index a950b35..1e55ba0 100644 (file)
@@ -34,6 +34,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 
@@ -55,8 +56,7 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_KEY
 
 const char* const IS_FOCUS_GROUP_PROPERTY_NAME = "isKeyboardFocusGroup"; // This property will be replaced by a flag in Control.
 
-const char* const FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "keyboard_focus.png";
-const Vector4 FOCUS_BORDER_IMAGE_BORDER = Vector4(7.0f, 7.0f, 7.0f, 7.0f);
+const char* const FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "keyboard_focus.9.png";
 
 BaseHandle Create()
 {
@@ -457,12 +457,8 @@ Actor KeyboardFocusManager::GetFocusIndicatorActor()
 void KeyboardFocusManager::CreateDefaultFocusIndicatorActor()
 {
   // Create a focus indicator actor shared by all the keyboard focusable actors
-  Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH);
-
-  ImageActor focusIndicator = ImageActor::New(borderImage);
+  Toolkit::ImageView focusIndicator = Toolkit::ImageView::New(FOCUS_BORDER_IMAGE_PATH);
   focusIndicator.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
-  focusIndicator.SetStyle( ImageActor::STYLE_NINE_PATCH );
-  focusIndicator.SetNinePatchBorder(FOCUS_BORDER_IMAGE_BORDER);
   focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
 
   // Apply size constraint to the focus indicator
similarity index 85%
rename from dali-toolkit/styles/images-common/keyboard_focus.png
rename to dali-toolkit/styles/images-common/keyboard_focus.9.png
index de7e051..5590f15 100644 (file)
Binary files a/dali-toolkit/styles/images-common/keyboard_focus.png and b/dali-toolkit/styles/images-common/keyboard_focus.9.png differ