Browse Source

Fix some of the Matrix constructors

Michael 7 years ago
parent
commit
0fa99319fe

+ 15 - 15
Include/Rocket/Core/Matrix4.inl

@@ -394,9 +394,9 @@ bool Matrix4< Component, Storage >::operator==(const typename Matrix4< Component
 	typename Matrix4< Component, Storage >::ConstRows rows(vectors);
 	typename Matrix4< Component, Storage >::ConstRows rows(vectors);
 	typename Matrix4< Component, Storage >::ConstRows other_rows(other.vectors);
 	typename Matrix4< Component, Storage >::ConstRows other_rows(other.vectors);
 	return vectors[0] == other.vectors[0]
 	return vectors[0] == other.vectors[0]
-	   and vectors[1] == other.vectors[1]
-	   and vectors[2] == other.vectors[2]
-	   and vectors[3] == other.vectors[3];
+	   && vectors[1] == other.vectors[1]
+	   && vectors[2] == other.vectors[2]
+	   && vectors[3] == other.vectors[3];
 }
 }
 template< typename Component, class Storage>
 template< typename Component, class Storage>
 bool Matrix4< Component, Storage >::operator==(const typename Matrix4< Component, Storage >::TransposeType& other) const throw()
 bool Matrix4< Component, Storage >::operator==(const typename Matrix4< Component, Storage >::TransposeType& other) const throw()
@@ -404,9 +404,9 @@ bool Matrix4< Component, Storage >::operator==(const typename Matrix4< Component
 	typename Matrix4< Component, Storage >::ConstRows rows(vectors);
 	typename Matrix4< Component, Storage >::ConstRows rows(vectors);
 	typename Matrix4< Component, Storage >::ConstRows other_rows(other.vectors);
 	typename Matrix4< Component, Storage >::ConstRows other_rows(other.vectors);
 	return rows[0] == other_rows[0]
 	return rows[0] == other_rows[0]
-	   and rows[1] == other_rows[1]
-	   and rows[2] == other_rows[2]
-	   and rows[3] == other_rows[3];
+	   && rows[1] == other_rows[1]
+	   && rows[2] == other_rows[2]
+	   && rows[3] == other_rows[3];
 }
 }
 
 
 // Inequality operator.
 // Inequality operator.
@@ -414,9 +414,9 @@ template< typename Component, class Storage>
 bool Matrix4< Component, Storage >::operator!=(const typename Matrix4< Component, Storage >::ThisType& other) const throw()
 bool Matrix4< Component, Storage >::operator!=(const typename Matrix4< Component, Storage >::ThisType& other) const throw()
 {
 {
 	return vectors[0] != other.vectors[0]
 	return vectors[0] != other.vectors[0]
-	    or vectors[1] != other.vectors[1]
-	    or vectors[2] != other.vectors[2]
-	    or vectors[3] != other.vectors[3];
+	    || vectors[1] != other.vectors[1]
+	    || vectors[2] != other.vectors[2]
+	    || vectors[3] != other.vectors[3];
 }
 }
 template< typename Component, class Storage>
 template< typename Component, class Storage>
 bool Matrix4< Component, Storage >::operator!=(const typename Matrix4< Component, Storage >::TransposeType& other) const throw()
 bool Matrix4< Component, Storage >::operator!=(const typename Matrix4< Component, Storage >::TransposeType& other) const throw()
@@ -424,9 +424,9 @@ bool Matrix4< Component, Storage >::operator!=(const typename Matrix4< Component
 	typename Matrix4< Component, Storage >::ConstRows rows(vectors);
 	typename Matrix4< Component, Storage >::ConstRows rows(vectors);
 	typename Matrix4< Component, Storage >::ConstRows other_rows(other.vectors);
 	typename Matrix4< Component, Storage >::ConstRows other_rows(other.vectors);
 	return rows[0] != other_rows[0]
 	return rows[0] != other_rows[0]
-	    or rows[1] != other_rows[1]
-	    or rows[2] != other_rows[2]
-	    or rows[3] != other_rows[3];
+	    || rows[1] != other_rows[1]
+	    || rows[2] != other_rows[2]
+	    || rows[3] != other_rows[3];
 }
 }
 
 
 // Return the identity matrix.
 // Return the identity matrix.
@@ -573,7 +573,7 @@ Matrix4< Component, Storage > Matrix4< Component, Storage >::RotateX(Component a
 		Matrix4< Component, Storage >::VectorType(1, 0,    0,   0),
 		Matrix4< Component, Storage >::VectorType(1, 0,    0,   0),
 		Matrix4< Component, Storage >::VectorType(0, Cos, -Sin, 0),
 		Matrix4< Component, Storage >::VectorType(0, Cos, -Sin, 0),
 		Matrix4< Component, Storage >::VectorType(0, Sin,  Cos, 0),
 		Matrix4< Component, Storage >::VectorType(0, Sin,  Cos, 0),
-		Matrix4< Component, Storage >::VectorType(1, 0,    0,   1)
+		Matrix4< Component, Storage >::VectorType(0, 0,    0,   1)
 	);
 	);
 }
 }
 
 
@@ -610,8 +610,8 @@ Matrix4< Component, Storage > Matrix4< Component, Storage >::Skew(Component angl
 	Component SkewX = Math::Tan(Math::DegreesToRadians(angle_x));
 	Component SkewX = Math::Tan(Math::DegreesToRadians(angle_x));
 	Component SkewY = Math::Tan(Math::DegreesToRadians(angle_y));
 	Component SkewY = Math::Tan(Math::DegreesToRadians(angle_y));
 	return Matrix4< Component, Storage >::FromRows(
 	return Matrix4< Component, Storage >::FromRows(
-		Matrix4< Component, Storage >::VectorType(0,     SkewY, 0, 0),
-		Matrix4< Component, Storage >::VectorType(SkewX, 0,     0, 0),
+		Matrix4< Component, Storage >::VectorType(1,     SkewX, 0, 0),
+		Matrix4< Component, Storage >::VectorType(SkewY, 1,     0, 0),
 		Matrix4< Component, Storage >::VectorType( 0,    0,     1, 0),
 		Matrix4< Component, Storage >::VectorType( 0,    0,     1, 0),
 		Matrix4< Component, Storage >::VectorType( 0,    0,     0, 1)
 		Matrix4< Component, Storage >::VectorType( 0,    0,     0, 1)
 	);
 	);

+ 1 - 1
Include/Rocket/Core/Transform.h

@@ -72,7 +72,7 @@ public:
 	void AddPrimitive(const Transforms::Primitive& p);
 	void AddPrimitive(const Transforms::Primitive& p);
 	/// Return the number of Primitives in this Transform
 	/// Return the number of Primitives in this Transform
 	int GetNumPrimitives() const throw()
 	int GetNumPrimitives() const throw()
-		{ return primitives.size(); }
+		{ return (int)primitives.size(); }
 	/// Return the i-th Primitive in this Transform
 	/// Return the i-th Primitive in this Transform
 	const Transforms::Primitive& GetPrimitive(int i) const throw()
 	const Transforms::Primitive& GetPrimitive(int i) const throw()
 		{ return *primitives[i]; }
 		{ return *primitives[i]; }

+ 2 - 2
Source/Core/Decorator.cpp

@@ -114,12 +114,12 @@ float Decorator::ResolveProperty(const PropertyDictionary& properties, const Str
 	}
 	}
 
 
 	// Need to include em!
 	// Need to include em!
-	if (property->unit & Property::RELATIVE_UNIT)
+	if (property->unit & Property::PERCENT)
 		return base_value * property->value.Get< float >() * 0.01f;
 		return base_value * property->value.Get< float >() * 0.01f;
 
 
 	if (property->unit & Property::NUMBER || property->unit & Property::PX)
 	if (property->unit & Property::NUMBER || property->unit & Property::PX)
 		return property->value.Get< float >();
 		return property->value.Get< float >();
-    
+	    
     // Values based on pixels-per-inch.
     // Values based on pixels-per-inch.
 	if (property->unit & Property::PPI_UNIT)
 	if (property->unit & Property::PPI_UNIT)
 	{
 	{

+ 2 - 5
Source/Core/StyleSheetSpecification.cpp

@@ -244,6 +244,7 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(COLOR, "white", true, false).AddParser(COLOR);
 	RegisterProperty(COLOR, "white", true, false).AddParser(COLOR);
 
 
 	RegisterProperty(IMAGE_COLOR, "white", false, false).AddParser(COLOR);
 	RegisterProperty(IMAGE_COLOR, "white", false, false).AddParser(COLOR);
+	RegisterProperty(OPACITY, "1", false, false).AddParser("number");
 
 
 	RegisterProperty(FONT_FAMILY, "", true, true).AddParser("string");
 	RegisterProperty(FONT_FAMILY, "", true, true).AddParser("string");
 	RegisterProperty(FONT_CHARSET, "U+0020-007E", true, false).AddParser("string");
 	RegisterProperty(FONT_CHARSET, "U+0020-007E", true, false).AddParser("string");
@@ -263,8 +264,8 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(DRAG, "none", false, false).AddParser("keyword", "none, drag, drag-drop, block, clone");
 	RegisterProperty(DRAG, "none", false, false).AddParser("keyword", "none, drag, drag-drop, block, clone");
 	RegisterProperty(TAB_INDEX, "none", false, false).AddParser("keyword", "none, auto");
 	RegisterProperty(TAB_INDEX, "none", false, false).AddParser("keyword", "none, auto");
 	RegisterProperty(FOCUS, "auto", true, false).AddParser("keyword", "none, auto");
 	RegisterProperty(FOCUS, "auto", true, false).AddParser("keyword", "none, auto");
-
 	RegisterProperty(SCROLLBAR_MARGIN, "0", false, false).AddParser("length");
 	RegisterProperty(SCROLLBAR_MARGIN, "0", false, false).AddParser("length");
+	RegisterProperty(POINTER_EVENTS, "auto", true, false).AddParser("keyword", "auto, none");
 
 
 	// Perspective and Transform specifications
 	// Perspective and Transform specifications
 	RegisterProperty(PERSPECTIVE, "none", false, false).AddParser("keyword", "none").AddParser("length");
 	RegisterProperty(PERSPECTIVE, "none", false, false).AddParser("keyword", "none").AddParser("length");
@@ -277,10 +278,6 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(TRANSFORM_ORIGIN_Z, "0", false, false).AddParser("length");
 	RegisterProperty(TRANSFORM_ORIGIN_Z, "0", false, false).AddParser("length");
 	RegisterShorthand(TRANSFORM_ORIGIN, "transform-origin-x, transform-origin-y, transform-origin-z");
 	RegisterShorthand(TRANSFORM_ORIGIN, "transform-origin-x, transform-origin-y, transform-origin-z");
 
 
-	RegisterProperty(SCROLLBAR_MARGIN, "0", false, false).AddParser("number");
-	RegisterProperty(OPACITY, "1", false, false).AddParser("number");
-
-	RegisterProperty(POINTER_EVENTS, "auto", true, false).AddParser("keyword", "auto, none");
 }
 }
 
 
 }
 }