Remove 20k of unnecessary binary bloat by removing dummy constant property values 97/49897/1
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 21 Oct 2015 09:11:39 +0000 (10:11 +0100)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 21 Oct 2015 09:11:39 +0000 (10:11 +0100)
Change-Id: Ic417769cb08d670ec57112e00884244db343a712

dali/internal/event/common/property-input-impl.h
dali/internal/update/common/inherited-property.h

index 1778b54..970f18b 100644 (file)
@@ -38,19 +38,6 @@ namespace Internal
 {
 
 /**
- * These dummy values are used to handle PropertyInputImpl errors
- */
-static const bool DUMMY_BOOLEAN_VALUE( false );
-static const float DUMMY_FLOAT_VALUE( 0.0f );
-static const int DUMMY_INTEGER_VALUE( 0 );
-static const Vector2 DUMMY_VECTOR2_VALUE( 0.0f, 0.0f );
-static const Vector3 DUMMY_VECTOR3_VALUE( 0.0f, 0.0f, 0.0f );
-static const Vector4 DUMMY_VECTOR4_VALUE( 0.0f, 0.0f, 0.0f, 0.0f );
-static const Matrix3 DUMMY_MATRIX3_VALUE;
-static const Matrix DUMMY_MATRIX_VALUE;
-static const Quaternion DUMMY_QUATERNION_VALUE( 1.0f, 0.0f, 0.0f, 0.0f );
-
-/**
  * An abstract interface for receiving property values, and for querying whether
  * a property value has changed i.e. whether a constraint needs to be reapplied.
  */
@@ -92,7 +79,8 @@ public:
   virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_BOOLEAN_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const bool&>(*this);
   }
 
   /**
@@ -104,7 +92,8 @@ public:
   virtual const int& GetInteger( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_INTEGER_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const int&>(*this);
   }
 
   /**
@@ -116,7 +105,8 @@ public:
   virtual const float& GetFloat( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_FLOAT_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const float&>(*this);
   }
 
   /**
@@ -128,7 +118,8 @@ public:
   virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_VECTOR2_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const Vector2&>(*this);
   }
 
   /**
@@ -140,7 +131,8 @@ public:
   virtual const Vector3& GetVector3( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_VECTOR3_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const Vector3&>(*this);
   }
 
   /**
@@ -152,7 +144,8 @@ public:
   virtual const Vector4& GetVector4( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_VECTOR4_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const Vector4&>(*this);
   }
 
   /**
@@ -164,7 +157,8 @@ public:
   virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_QUATERNION_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const Quaternion&>(*this);
   }
 
   /**
@@ -176,7 +170,8 @@ public:
   virtual const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_MATRIX3_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const Matrix3&>(*this);
   }
 
   /**
@@ -188,7 +183,8 @@ public:
   virtual const Matrix& GetMatrix( BufferIndex bufferIndex ) const
   {
     DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_MATRIX_VALUE;
+    // the return will never be executed due to assert above so just keep the compiler happy
+    return reinterpret_cast<const Matrix&>(*this);
   }
 
   // Accessors for Constraint functions
index ca50648..9e09a11 100644 (file)
@@ -610,24 +610,6 @@ public:
   }
 
   /**
-   * @copydoc Dali::PropertyInput::GetQuaternion()
-   */
-  virtual const Quaternion& GetQuaternion() const
-  {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_QUATERNION_VALUE;
-  }
-
-  /**
-   * @copydoc Dali::PropertyInput::GetQuaternion()
-   */
-  virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const
-  {
-    DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
-    return DUMMY_QUATERNION_VALUE;
-  }
-
-  /**
    * Set the property value. This will only persist for the current frame; the property
    * will be reset with the base value, at the beginning of the next frame.
    * @param[in] bufferIndex The buffer to write.