summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/GLUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/android/GLUtils.cpp')
-rw-r--r--WebCore/platform/graphics/android/GLUtils.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/GLUtils.cpp b/WebCore/platform/graphics/android/GLUtils.cpp
index 1c84fe2..0923c54 100644
--- a/WebCore/platform/graphics/android/GLUtils.cpp
+++ b/WebCore/platform/graphics/android/GLUtils.cpp
@@ -67,16 +67,17 @@ void GLUtils::toGLMatrix(GLfloat* flattened, const TransformationMatrix& m) {
void GLUtils::setOrthographicMatrix(TransformationMatrix& ortho, float left, float top,
float right, float bottom, float nearZ, float farZ) {
float deltaX = right - left;
- float deltaY = bottom - top;
+ float deltaY = top - bottom;
float deltaZ = farZ - nearZ;
+ if (!deltaX || !deltaY || !deltaZ)
+ return;
ortho.setM11(2.0f / deltaX);
- ortho.setM22(2.0 / deltaY);
- ortho.setM33(2.0f / deltaZ);
ortho.setM41(-(right + left) / deltaX);
+ ortho.setM22(2.0f / deltaY);
ortho.setM42(-(top + bottom) / deltaY);
- ortho.setM43(-(farZ + nearZ) / deltaZ);
- ortho.setM44(1);
+ ortho.setM33(-2.0f / deltaZ);
+ ortho.setM43(-(nearZ + farZ) / deltaZ);
}
/////////////////////////////////////////////////////////////////////////////////////////