Merge "[Tizen] Fix undefined behaviour due to strict-aliasing." into tizen accepted/tizen/common/20170123.182536 accepted/tizen/ivi/20170120.082229 accepted/tizen/mobile/20170120.081947 accepted/tizen/tv/20170120.082054 accepted/tizen/wearable/20170120.082140 submit/tizen/20170120.063242 submit/tizen_common/20170123.022625
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Fri, 20 Jan 2017 05:00:59 +0000 (21:00 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 20 Jan 2017 05:00:59 +0000 (21:00 -0800)
automated-tests/src/dali/utc-Dali-Actor.cpp
dali/devel-api/images/nine-patch-image.h
dali/devel-api/scripting/scripting.h
dali/internal/event/actors/actor-declarations.h
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/animation/animation-impl.h
dali/internal/event/images/image-factory.cpp
dali/internal/update/nodes/node.h
dali/public-api/dali-core-version.cpp
packaging/dali.spec

index 4683448..74be89d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -2864,6 +2864,16 @@ int UtcDaliRelayoutProperties_ResizePolicies(void)
   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), widthPolicy, TEST_LOCATION );
   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), heightPolicy, TEST_LOCATION );
 
+  // Set individual dimensions using enums
+  ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
+  ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
+
+  actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum );
+  actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum );
+
+  DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::WIDTH ) ), static_cast< int >( widthPolicyEnum ), TEST_LOCATION );
+  DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::HEIGHT ) ), static_cast< int >( heightPolicyEnum ), TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -3359,6 +3369,66 @@ int UtcDaliActorDrawModePropertyAsString(void)
   END_TEST;
 }
 
+int UtcDaliActorColorModePropertyAsEnum(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
+  DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
+  DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
+  DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
+  DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliActorPositionInheritancePropertyAsEnum(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  actor.SetProperty( Actor::Property::POSITION_INHERITANCE, INHERIT_PARENT_POSITION );
+  DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION );
+  DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
+  DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::POSITION_INHERITANCE, DONT_INHERIT_POSITION );
+  DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliActorDrawModePropertyAsEnum(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL );
+  DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
+  DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::STENCIL );
+  DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliActorAddRendererP(void)
 {
   tet_infoline("Testing Actor::AddRenderer");
@@ -3659,6 +3729,56 @@ int UtcDaliActorPropertyClippingActor(void)
   END_TEST;
 }
 
+int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
+{
+  // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
+  tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor enable and then disable" );
+  TestApplication application;
+
+  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+  TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
+  TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+  size_t startIndex = 0u;
+
+  // Create a clipping actor.
+  Actor actorDepth1Clip = CreateActorWithContent();
+  actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+  Stage::GetCurrent().Add( actorDepth1Clip );
+
+  // Gather the call trace.
+  GenerateTrace( application, enabledDisableTrace, stencilTrace );
+
+  // Check we are writing to the color buffer.
+  CheckColorMask( glAbstraction, true );
+
+  // Check the stencil buffer was enabled.
+  DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) );                                   // 2960 is GL_STENCIL_TEST
+
+  // Check the stencil buffer was cleared.
+  DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
+
+  // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
+  DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc",  "514, 1, 0", startIndex ) );     // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
+  DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
+  DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
+
+  // Now disable the clipping
+  actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
+
+  // Gather the call trace.
+  GenerateTrace( application, enabledDisableTrace, stencilTrace );
+
+  // Check the stencil buffer was disabled.
+  DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Disable", "2960" ) );                                   // 2960 is GL_STENCIL_TEST
+
+  // Ensure all values in stencil-mask are set to 1.
+  startIndex = 0u;
+  DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "255", startIndex ) );
+
+  END_TEST;
+}
+
+
 int UtcDaliActorPropertyClippingNestedChildren(void)
 {
   // This test checks that a hierarchy of actors are clipped correctly by
index 6f7af80..904ec72 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_NINE_PATCH_IMAGE_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -46,9 +46,7 @@ class NinePatchImage;
  * remove the border from it's bitmap. An API can be used to obtain a BufferImage with
  * the border removed.
  *
- * Adding this image to an ImageActor using an Image handle will automatically convert
- * to use the cropped BufferImage - if you don't retain a handle to this object, it will
- * be automatically destroyed.
+ * If you don't retain a handle to this object, it will be automatically destroyed.
  * @SINCE_1_0.0
  */
 class DALI_IMPORT_API NinePatchImage : public ResourceImage
index 66f4132..3216df4 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCRIPTING_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -281,11 +281,8 @@ DALI_IMPORT_API Image NewImage( const Property::Value& property );
  *                 For example:
  * @code
  * {
- *   "type": "ImageActor",
- *   "image":
- *   {
- *     "filename":"my-image-path.png"
- *   },
+ *   "type": "Actor",
+ *   "position": [ 100, 100, 0 ],
  *   "actors":
  *   [
  *     {
index a4b1e10..00264b4 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_ACTOR_DECLARATIONS_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -30,13 +30,11 @@ namespace Internal
 class Actor;
 class CameraActor;
 class CustomActor;
-class ImageActor;
 class Layer;
 
 typedef IntrusivePtr<Actor>       ActorPtr;
 typedef IntrusivePtr<CameraActor> CameraActorPtr;
 typedef IntrusivePtr<CustomActor> CustomActorPtr;
-typedef IntrusivePtr<ImageActor>  ImageActorPtr;
 typedef IntrusivePtr<Layer>       LayerPtr;
 
 } // namespace Internal
index a3ca220..9a10eab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -2563,8 +2563,8 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 
     case Dali::Actor::Property::COLOR_MODE:
     {
-      ColorMode mode;
-      if ( Scripting::GetEnumeration< ColorMode >( property.Get< std::string >().c_str(), COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode ) )
+      ColorMode mode = mColorMode;
+      if ( Scripting::GetEnumerationProperty< ColorMode >( property, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode ) )
       {
         SetColorMode( mode );
       }
@@ -2573,8 +2573,8 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 
     case Dali::Actor::Property::POSITION_INHERITANCE:
     {
-      PositionInheritanceMode mode;
-      if( Scripting::GetEnumeration< PositionInheritanceMode >( property.Get< std::string >().c_str(), POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT, mode ) )
+      PositionInheritanceMode mode = mPositionInheritanceMode;
+      if( Scripting::GetEnumerationProperty< PositionInheritanceMode >( property, POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT, mode ) )
       {
         SetPositionInheritanceMode( mode );
       }
@@ -2583,8 +2583,8 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 
     case Dali::Actor::Property::DRAW_MODE:
     {
-      DrawMode::Type mode;
-      if( Scripting::GetEnumeration< DrawMode::Type >( property.Get< std::string >().c_str(), DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode ) )
+      DrawMode::Type mode = mDrawMode;
+      if( Scripting::GetEnumerationProperty< DrawMode::Type >( property, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode ) )
       {
         SetDrawMode( mode );
       }
@@ -2599,8 +2599,8 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 
     case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
     {
-      ResizePolicy::Type type;
-      if( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
+      ResizePolicy::Type type = static_cast< ResizePolicy::Type >( -1 ); // Set to invalid number so it definitely gets set.
+      if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
       {
         SetResizePolicy( type, Dimension::WIDTH );
       }
@@ -2609,8 +2609,8 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 
     case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
     {
-      ResizePolicy::Type type;
-      if( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
+      ResizePolicy::Type type = static_cast< ResizePolicy::Type >( -1 ); // Set to invalid number so it definitely gets set.
+      if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
       {
         SetResizePolicy( type, Dimension::HEIGHT );
       }
index 8eb5257..24dc3ff 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_ANIMATION_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -43,7 +43,6 @@ class Actor;
 class Animation;
 class AnimationPlaylist;
 class Object;
-class ShaderEffect;
 
 typedef IntrusivePtr<Animation> AnimationPtr;
 typedef std::vector<AnimationPtr> AnimationContainer;
index 999ba25..88d24a6 100644 (file)
@@ -118,8 +118,6 @@ ResourceTicketPtr ImageFactory::Load( Request& request )
 // new resource of size (96, 96), but reloading Req1 would load a scaled down version
 ResourceTicketPtr ImageFactory::Reload( Request& request )
 {
-  DALI_ASSERT_ALWAYS( &request );
-
   // go through requests, check real size and attributes again. If different, update related ticket.
   ResourceTicketPtr ticket;
 
index 6e3f98d..fab6e7e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_NODE_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -164,6 +164,11 @@ public:
       // clipping enabled flag and set it as the least significant bit.
       mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
     }
+    else
+    {
+      // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
+      mClippingSortModifier = 0u;
+    }
   }
 
   /**
index 398c640..9eb4ba9 100644 (file)
@@ -28,7 +28,7 @@ namespace Dali
 
 const unsigned int CORE_MAJOR_VERSION = 1;
 const unsigned int CORE_MINOR_VERSION = 2;
-const unsigned int CORE_MICRO_VERSION = 20;
+const unsigned int CORE_MICRO_VERSION = 22;
 const char * const CORE_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifndef EMSCRIPTEN
index bfa02ab..68b273d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali
 Summary:    The OpenGLES Canvas Core Library
-Version:    1.2.20
+Version:    1.2.22
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT