OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 // If all points on the quad had w < 0, then the entire quad would not be | 861 // If all points on the quad had w < 0, then the entire quad would not be |
862 // visible to the projected surface. | 862 // visible to the projected surface. |
863 bool everything_was_clipped = clamped1 && clamped2 && clamped3 && clamped4; | 863 bool everything_was_clipped = clamped1 && clamped2 && clamped3 && clamped4; |
864 if (everything_was_clipped) | 864 if (everything_was_clipped) |
865 return FloatQuad(); | 865 return FloatQuad(); |
866 | 866 |
867 return projected_quad; | 867 return projected_quad; |
868 } | 868 } |
869 | 869 |
870 static float ClampEdgeValue(float f) { | 870 static float ClampEdgeValue(float f) { |
871 ASSERT(!std::isnan(f)); | 871 DCHECK(!std::isnan(f)); |
872 return clampTo(f, (-LayoutUnit::Max() / 2).ToFloat(), | 872 return clampTo(f, (-LayoutUnit::Max() / 2).ToFloat(), |
873 (LayoutUnit::Max() / 2).ToFloat()); | 873 (LayoutUnit::Max() / 2).ToFloat()); |
874 } | 874 } |
875 | 875 |
876 LayoutRect TransformationMatrix::ClampedBoundsOfProjectedQuad( | 876 LayoutRect TransformationMatrix::ClampedBoundsOfProjectedQuad( |
877 const FloatQuad& q) const { | 877 const FloatQuad& q) const { |
878 FloatRect mapped_quad_bounds = ProjectQuad(q).BoundingBox(); | 878 FloatRect mapped_quad_bounds = ProjectQuad(q).BoundingBox(); |
879 | 879 |
880 float left = ClampEdgeValue(floorf(mapped_quad_bounds.X())); | 880 float left = ClampEdgeValue(floorf(mapped_quad_bounds.X())); |
881 float top = ClampEdgeValue(floorf(mapped_quad_bounds.Y())); | 881 float top = ClampEdgeValue(floorf(mapped_quad_bounds.Y())); |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 | 1828 |
1829 // Check for non-integer translate X/Y. | 1829 // Check for non-integer translate X/Y. |
1830 if (static_cast<int>(matrix_[3][0]) != matrix_[3][0] || | 1830 if (static_cast<int>(matrix_[3][0]) != matrix_[3][0] || |
1831 static_cast<int>(matrix_[3][1]) != matrix_[3][1]) | 1831 static_cast<int>(matrix_[3][1]) != matrix_[3][1]) |
1832 return false; | 1832 return false; |
1833 | 1833 |
1834 return true; | 1834 return true; |
1835 } | 1835 } |
1836 | 1836 |
1837 FloatSize TransformationMatrix::To2DTranslation() const { | 1837 FloatSize TransformationMatrix::To2DTranslation() const { |
1838 ASSERT(IsIdentityOr2DTranslation()); | 1838 DCHECK(IsIdentityOr2DTranslation()); |
1839 return FloatSize(matrix_[3][0], matrix_[3][1]); | 1839 return FloatSize(matrix_[3][0], matrix_[3][1]); |
1840 } | 1840 } |
1841 | 1841 |
1842 void TransformationMatrix::ToColumnMajorFloatArray(FloatMatrix4& result) const { | 1842 void TransformationMatrix::ToColumnMajorFloatArray(FloatMatrix4& result) const { |
1843 result[0] = M11(); | 1843 result[0] = M11(); |
1844 result[1] = M12(); | 1844 result[1] = M12(); |
1845 result[2] = M13(); | 1845 result[2] = M13(); |
1846 result[3] = M14(); | 1846 result[3] = M14(); |
1847 result[4] = M21(); | 1847 result[4] = M21(); |
1848 result[5] = M22(); | 1848 result[5] = M22(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 decomposition.translate_z, decomposition.scale_x, decomposition.scale_y, | 1909 decomposition.translate_z, decomposition.scale_x, decomposition.scale_y, |
1910 decomposition.scale_z, decomposition.skew_xy, decomposition.skew_xz, | 1910 decomposition.scale_z, decomposition.skew_xy, decomposition.skew_xz, |
1911 decomposition.skew_yz, decomposition.quaternion_x, | 1911 decomposition.skew_yz, decomposition.quaternion_x, |
1912 decomposition.quaternion_y, decomposition.quaternion_z, | 1912 decomposition.quaternion_y, decomposition.quaternion_z, |
1913 decomposition.quaternion_w, decomposition.perspective_x, | 1913 decomposition.quaternion_w, decomposition.perspective_x, |
1914 decomposition.perspective_y, decomposition.perspective_z, | 1914 decomposition.perspective_y, decomposition.perspective_z, |
1915 decomposition.perspective_w); | 1915 decomposition.perspective_w); |
1916 } | 1916 } |
1917 | 1917 |
1918 } // namespace blink | 1918 } // namespace blink |
OLD | NEW |