Merge "Fixed bug in SetIndexBuffer for v8 plugin" into devel/master
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Fri, 29 Apr 2016 15:03:10 +0000 (08:03 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 29 Apr 2016 15:03:10 +0000 (08:03 -0700)
14 files changed:
automated-tests/src/dali-toolkit/utc-Dali-ImageView.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/model3d-view/model3d-view-impl.cpp
dali-toolkit/internal/controls/model3d-view/obj-loader.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/renderers/control-renderer-data-impl.cpp
dali-toolkit/public-api/controls/image-view/image-view.cpp
dali-toolkit/public-api/controls/image-view/image-view.h
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec
plugins/dali-script-v8/src/animation/animation-api.cpp
plugins/dali-script-v8/src/constants/constants-wrapper.cpp
plugins/dali-script-v8/src/rendering/shader-api.cpp

index 36a42dd..cbba3e0 100644 (file)
@@ -968,3 +968,46 @@ int UtcDaliImageViewSetImageBufferImageWithCustomShaderToNativeImage(void)
 
   END_TEST;
 }
+
+int UtcDaliImageViewGetImageP1(void)
+{
+  ToolkitTestApplication application;
+
+  ImageView imageView = ImageView::New();
+  DALI_TEST_CHECK( ! imageView.GetImage() );
+
+  Image image = CreateBufferImage();
+  imageView.SetImage( image );
+  DALI_TEST_CHECK( imageView.GetImage() == image );
+
+  END_TEST;
+}
+
+int UtcDaliImageViewGetImageP2(void)
+{
+  ToolkitTestApplication application;
+
+  BufferImage image = CreateBufferImage();
+  ImageView imageView = ImageView::New( image );
+  DALI_TEST_CHECK( imageView.GetImage() == image );
+
+  END_TEST;
+}
+
+int UtcDaliImageViewGetImageN(void)
+{
+  ToolkitTestApplication application;
+
+  ImageView imageView = ImageView::New( TEST_IMAGE_FILE_NAME );
+  DALI_TEST_CHECK( ! imageView.GetImage() );
+
+  Image image = CreateBufferImage();
+  imageView.SetImage( image );
+  DALI_TEST_CHECK( imageView.GetImage() == image );
+
+  imageView.SetImage( TEST_IMAGE_FILE_NAME );
+  DALI_TEST_CHECK( ! imageView.GetImage() );
+
+  END_TEST;
+}
+
index 3eb0144..5843804 100644 (file)
@@ -142,6 +142,11 @@ void ImageView::SetImage( const std::string& url, ImageDimensions size )
   }
 }
 
+Image ImageView::GetImage() const
+{
+  return mImage;
+}
+
 void ImageView::EnablePreMultipliedAlpha( bool preMultipled )
 {
   if( mRenderer )
index b517994..c598c26 100644 (file)
@@ -76,6 +76,11 @@ public:
   void SetImage( const std::string& imageUrl, ImageDimensions size );
 
   /**
+   * @copydoc Dali::Toolkit::GetImage
+   */
+  Image GetImage() const;
+
+  /**
    * @brief Set whether the Pre-multiplied Alpha Blending is required
    *
    * @param[in] preMultipled whether alpha is pre-multiplied.
index 6d05a50..5e6340f 100644 (file)
@@ -448,7 +448,7 @@ void Model3dView::OnInitialize()
 {
   //Create empty versions of the geometry and material so we always have a Renderer
   Geometry mesh = Geometry::New();
-  Shader shader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
+  Shader shader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER );
   mRenderer = Renderer::New( mesh, shader );
 
 }
@@ -525,6 +525,7 @@ void Model3dView::CreateGeometry()
     if( mRenderer )
     {
       mRenderer.SetGeometry( mMesh );
+      mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, Renderer::DEPTH_WRITE_ON );
     }
   }
 }
@@ -557,20 +558,20 @@ void Model3dView::CreateMaterial()
   {
     if( (mTexture2Url != "") && (mTexture1Url != "") && (mIlluminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP) && mObjLoader.IsNormalMapPresent() )
     {
-      mShader = Shader::New( NRMMAP_VERTEX_SHADER, NRMMAP_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
+      mShader = Shader::New( NRMMAP_VERTEX_SHADER, NRMMAP_FRAGMENT_SHADER );
     }
     else if( mIlluminationType == Toolkit::Model3dView::DIFFUSE_WITH_TEXTURE )
     {
-      mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
+      mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
     }
     else
     {
-      mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
+      mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER );
     }
   }
   else
   {
-    mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER, (Shader::ShaderHints)(Shader::HINT_REQUIRES_SELF_DEPTH_TEST | Shader::HINT_MODIFIES_GEOMETRY) );
+    mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER );
   }
 
   mTextureSet = TextureSet::New();
@@ -579,7 +580,7 @@ void Model3dView::CreateMaterial()
   {
     mRenderer.SetTextures( mTextureSet );
     mRenderer.SetShader( mShader );
-    mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::NONE);
+    mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::CULL_NONE);
   }
 
   UpdateShaderUniforms();
index dd9c25d..857032a 100644 (file)
@@ -589,8 +589,6 @@ Geometry ObjLoader::CreateGeometry( Toolkit::Model3dView::IlluminationType illum
     surface.SetIndexBuffer ( &indices[0], indices.Size() );
   }
 
-  surface.SetRequiresDepthTesting( true );
-
   vertices.Clear();
   verticesExt.Clear();
   indices.Clear();
index 2fea479..a0d5d9f 100644 (file)
@@ -320,6 +320,7 @@ void PageTurnView::Page::UseEffect(Shader newShader, Geometry geometry)
     }
 
     renderer.SetTextures( textureSet );
+    renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, Renderer::DEPTH_WRITE_ON );
     actor.AddRenderer( renderer );
   }
 }
@@ -393,7 +394,6 @@ void PageTurnView::OnInitialize()
   uint16_t width = static_cast<uint16_t>(mPageSize.width / DEFAULT_GRID_DENSITY + 0.5f);
   uint16_t height = static_cast<uint16_t>(mPageSize.height / DEFAULT_GRID_DENSITY + 0.5f);
   mGeometry = RendererFactoryCache::CreateGridGeometry( Uint16Pair( width, height ) );
-  mGeometry.SetRequiresDepthTesting( true );
 
   mPages.reserve( NUMBER_OF_CACHED_PAGES );
   for( int i = 0; i < NUMBER_OF_CACHED_PAGES; i++ )
index 9992bf5..df5a006 100644 (file)
@@ -47,9 +47,7 @@ const char * const CUSTOM_SHADER_HINTS( "hints" ); ///< type STRING for a hint f
 /**
  * where hints should be contain strings of the following shader hints:
  *   "none"                    | corresponds to HINT_NONE
- *   "requiresSelfDepthTest"   | corresponds to HINT_REQUIRES_SELF_DEPTH_TEST
  *   "outputIsTransparent"     | corresponds to HINT_OUTPUT_IS_TRANSPARENT
- *   "outputIsOpaque"          | corresponds to HINT_OUTPUT_IS_OPAQUE
  *   "modifiesGeometry"        | corresponds to HINT_MODIFIES_GEOMETRY
  */
 
@@ -59,18 +57,10 @@ Shader::ShaderHints HintFromString( std::string hintString )
   {
     return Shader::HINT_NONE;
   }
-  else if( hintString == "requiresSelfDepthTest" )
-  {
-    return Shader::HINT_REQUIRES_SELF_DEPTH_TEST;
-  }
   else if( hintString == "outputIsTransparent" )
   {
     return Shader::HINT_OUTPUT_IS_TRANSPARENT;
   }
-  else if( hintString == "outputIsOpaque" )
-  {
-    return Shader::HINT_OUTPUT_IS_OPAQUE;
-  }
   else if( hintString == "modifiesGeometry" )
   {
     return Shader::HINT_MODIFIES_GEOMETRY;
index 3333289..2726af5 100644 (file)
@@ -101,7 +101,7 @@ void ImageView::SetImage( const std::string& url, ImageDimensions size )
 
 Image ImageView::GetImage() const
 {
-  return Image();
+  return Dali::Toolkit::GetImpl( *this ).GetImage();
 }
 
 ImageView::ImageView( Internal::ImageView& implementation )
index 370579a..14e3427 100644 (file)
@@ -40,13 +40,17 @@ class ImageView;
  */
 
 /**
- * @brief ImageView is a class for displaying an Image.
+ * @brief ImageView is a class for displaying an image resource.
+ *
+ * An instance of ImageView can be created using a URL or an Image instance.
+ *
  * @SINCE_1_0.0
  *
  */
 class DALI_IMPORT_API ImageView : public Control
 {
 public:
+
   /**
    * @brief The start and end property ranges for this control.
    * @SINCE_1_0.0
@@ -76,11 +80,13 @@ public:
        * @SINCE_1_0.0
        */
       RESOURCE_URL = PROPERTY_START_INDEX,
+
       /**
        * @brief name "image", type string if it is a url, map otherwise
        * @SINCE_1_0.0
        */
       IMAGE,
+
       /**
        * @brief name "preMultipliedAlpha", type Boolean
        * @SINCE_1_1.18
@@ -90,7 +96,6 @@ public:
 
       // Animatable properties
 
-
       /**
        * @brief name "pixelArea", type Vector4
        * @details Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
@@ -119,18 +124,18 @@ public:
   static ImageView New();
 
   /**
-   * @brief Create an initialized ImageView from an Image.
+   * @brief Create an initialized ImageView from an Image instance.
    *
    * If the handle is empty, ImageView will not display anything.
    *
    * @SINCE_1_0.0
-   * @param[in] image The Image to display.
+   * @param[in] image The Image instance to display.
    * @return A handle to a newly allocated ImageView.
    */
   static ImageView New( Image image );
 
   /**
-   * @brief Create an initialized ImageView from an Image resource URL
+   * @brief Create an initialized ImageView from an URL to an image resource.
    *
    * If the string is empty, ImageView will not display anything.
    *
@@ -141,13 +146,13 @@ public:
   static ImageView New( const std::string& url );
 
   /**
-   * @brief Create an initialized ImageView from an Image resource URL
+   * @brief Create an initialized ImageView from a URL to an image resource.
    *
    * If the string is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.10
    * @param[in] url The url of the image resource to display.
-   * @param [in] size The width and height to fit the loaded image to.
+   * @param [in] size The width and height to which to fit the loaded image.
    * @return A handle to a newly allocated ImageView.
    *
    * @note A valid size is preferable for efficiency.
@@ -194,42 +199,43 @@ public:
   static ImageView DownCast( BaseHandle handle );
 
   /**
-   * @brief Sets this ImageView from an Image
+   * @brief Sets this ImageView from an Image instance.
    *
    * If the handle is empty, ImageView will display nothing
    * @SINCE_1_0.0
-   * @param[in] image The Image to display.
+   * @param[in] image The Image instance to display.
    */
   void SetImage( Image image );
 
   /**
-   * @brief Sets this ImageView from an Image URL
+   * @brief Sets this ImageView from the given URL.
    *
    * If the URL is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.4
-   * @param[in] url The Image resource to display.
+   * @param[in] url The URL to the image resource to display.
    */
   void SetImage( const std::string& url );
 
   /**
-   * @brief Sets this ImageView from an Image URL
+   * @brief Sets this ImageView from the given URL.
    *
    * If the URL is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.10
-   * @param[in] url A URL to the image resource to display.
+   * @param[in] url The URL to the image resource to display.
    * @param [in] size The width and height to fit the loaded image to.
    */
   void SetImage( const std::string& url, ImageDimensions size );
 
   /**
    * @DEPRECATED_1_1.4
-   * @brief Gets the Image
+   * @brief Gets the Image instance handle used by the ImageView.
+   *
+   * A valid handle will be returned only if this instance was created with New(Image) or SetImage(Image) was called.
    *
    * @SINCE_1_0.0
-   * @remarks Calls to this method should be avoided as this may return an empty handle if the image has not been created yet.
-   * @return The Image currently set to this ImageView
+   * @return The Image instance currently used by the ImageView.
    */
   Image GetImage() const;
 
index f0197f0..bf1d3b1 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 = 31;
+const unsigned int TOOLKIT_MICRO_VERSION = 32;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index da2e8eb..c9a388b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.1.31
+Version:    1.1.32
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT
index e20e656..3a63034 100644 (file)
@@ -825,7 +825,7 @@ void AnimationApi::Animate( const v8::FunctionCallbackInfo<v8::Value>& args )
  *
  *     // animation x position
  *     var anim = new dali.Animation( 1 );
- *     anim.animateBy( imageActor,"positionX", 30 );
+ *     anim.animateBy( actor,"positionX", 30 );
  *     anim.play();
  *
  *     // animate x,y,z position with the optional animation options
@@ -835,7 +835,7 @@ void AnimationApi::Animate( const v8::FunctionCallbackInfo<v8::Value>& args )
  *        alpha:"easeInOutSine"   // Speeds up and slows to a gradual stop
  *     }
  *
- *     anim.animateBy( imageActor,"position", [100,200,0], options );
+ *     anim.animateBy( actor,"position", [100,200,0], options );
  *
  */
 void AnimationApi::AnimateBy( const v8::FunctionCallbackInfo<v8::Value>& args )
@@ -886,7 +886,7 @@ void AnimationApi::AnimateBy( const v8::FunctionCallbackInfo<v8::Value>& args )
  * @example
  *
  *     var anim = new dali.Animation( 1 );
- *     anim.animateTo( imageActor,"positionX", 30 );
+ *     anim.animateTo( actor,"positionX", 30 );
  *     anim.play();
  *
  *
@@ -897,7 +897,7 @@ void AnimationApi::AnimateBy( const v8::FunctionCallbackInfo<v8::Value>& args )
  *        alpha:"easeInOutSine"   // Speeds up and slows to a gradual stop
  *     }
  *
- *     anim.animateTo( imageActor,"position", [100,200,0], options );
+ *     anim.animateTo( actor,"position", [100,200,0], options );
  *
  */
 void AnimationApi::AnimateTo( const v8::FunctionCallbackInfo< v8::Value >& args )
@@ -977,7 +977,7 @@ void AnimationApi::AnimateTo( const v8::FunctionCallbackInfo< v8::Value >& args
  *     } ];
  *
  *
- *     anim.animateBetween( imageActor,"position", keyframes );
+ *     anim.animateBetween( actor,"position", keyframes );
  *
  */
 void AnimationApi::AnimateBetween( const v8::FunctionCallbackInfo< v8::Value >& args )
index 1311506..1c3b826 100644 (file)
@@ -217,10 +217,14 @@ const IntegerPair EnumTable[] =
     { "WRAP_MODE_REPEAT",                     WrapMode::REPEAT           },
     { "WRAP_MODE_MIRRORED_REPEAT",            WrapMode::MIRRORED_REPEAT  },
 
-    { "MATERIAL_NONE",                        Renderer::NONE                      },
-    { "MATERIAL_CULL_BACK",                   Renderer::CULL_BACK                 },
-    { "MATERIAL_CULL_FRONT",                  Renderer::CULL_FRONT                },
-    { "MATERIAL_CULL_BACK_AND_FRONT",         Renderer::CULL_BACK_AND_FRONT       },
+    { "RENDERER_CULL_NONE",                   Renderer::CULL_NONE                 },
+    { "RENDERER_CULL_BACK",                   Renderer::CULL_BACK                 },
+    { "RENDERER_CULL_FRONT",                  Renderer::CULL_FRONT                },
+    { "RENDERER_CULL_BACK_AND_FRONT",         Renderer::CULL_BACK_AND_FRONT       },
+
+    { "RENDERER_DEPTH_WRITE_OFF",             Renderer::DEPTH_WRITE_OFF   },
+    { "RENDERER_DEPTH_WRITE_AUTO",            Renderer::DEPTH_WRITE_AUTO  },
+    { "RENDERER_DEPTH_WRITE_ON",              Renderer::DEPTH_WRITE_ON    },
 
     { "GEOMETRY_POINTS",                      Geometry::POINTS          },
     { "GEOMETRY_LINES",                       Geometry::LINES           },
index 6080bd2..2e08977 100644 (file)
@@ -74,9 +74,7 @@ struct ShaderHintPair
 
 const ShaderHintPair ShaderHintTable[]=
 {
-    {"requiresSelfDepthTest",  Shader::HINT_REQUIRES_SELF_DEPTH_TEST },
     {"outputIsTransparent",    Shader::HINT_OUTPUT_IS_TRANSPARENT },
-    {"outputIsOpaque",         Shader::HINT_OUTPUT_IS_OPAQUE   },
     {"modifiesGeometry",       Shader::HINT_MODIFIES_GEOMETRY },
 };