From 5ddde30071f639962dd557c453f2ad01f8f0fd00 Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Wed, 8 Sep 2010 12:18:00 +0100 Subject: Merge WebKit at r66666 : Initial merge by git. Change-Id: I57dedeb49859adc9c539e760f0e749768c66626f --- WebCore/platform/graphics/FloatPoint3D.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'WebCore/platform/graphics/FloatPoint3D.cpp') diff --git a/WebCore/platform/graphics/FloatPoint3D.cpp b/WebCore/platform/graphics/FloatPoint3D.cpp index 3d37eea..bb05e7f 100644 --- a/WebCore/platform/graphics/FloatPoint3D.cpp +++ b/WebCore/platform/graphics/FloatPoint3D.cpp @@ -21,21 +21,27 @@ #include "config.h" -#include #include "FloatPoint3D.h" +#include + namespace WebCore { void FloatPoint3D::normalize() { - float length = sqrtf(m_x * m_x + m_y * m_y + m_z * m_z); + float tempLength = length(); - if (length != 0) { - m_x /= length; - m_y /= length; - m_z /= length; + if (tempLength) { + m_x /= tempLength; + m_y /= tempLength; + m_z /= tempLength; } } +float FloatPoint3D::length() const +{ + return sqrtf(lengthSquared()); +} + } // namespace WebCore -- cgit v1.1