diff options
-rw-r--r-- | WebCore/platform/graphics/android/GLUtils.cpp | 30 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GLUtils.h | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 12 |
3 files changed, 25 insertions, 19 deletions
diff --git a/WebCore/platform/graphics/android/GLUtils.cpp b/WebCore/platform/graphics/android/GLUtils.cpp index 0923c54..739dafc 100644 --- a/WebCore/platform/graphics/android/GLUtils.cpp +++ b/WebCore/platform/graphics/android/GLUtils.cpp @@ -46,22 +46,34 @@ using namespace android; ///////////////////////////////////////////////////////////////////////////////////////// void GLUtils::toGLMatrix(GLfloat* flattened, const TransformationMatrix& m) { - flattened[0] = m.m11(); - flattened[1] = m.m12(); + flattened[0] = m.m11(); // scaleX + flattened[1] = m.m12(); // skewY flattened[2] = m.m13(); - flattened[3] = m.m14(); - flattened[4] = m.m21(); - flattened[5] = m.m22(); + flattened[3] = m.m14(); // persp0 + flattened[4] = m.m21(); // skewX + flattened[5] = m.m22(); // scaleY flattened[6] = m.m23(); - flattened[7] = m.m24(); + flattened[7] = m.m24(); // persp1 flattened[8] = m.m31(); flattened[9] = m.m32(); flattened[10] = m.m33(); flattened[11] = m.m34(); - flattened[12] = m.m41(); - flattened[13] = m.m42(); + flattened[12] = m.m41(); // transX + flattened[13] = m.m42(); // transY flattened[14] = m.m43(); - flattened[15] = m.m44(); + flattened[15] = m.m44(); // persp2 +} + +void GLUtils::toSkMatrix(SkMatrix& matrix, const TransformationMatrix& m) { + matrix[0] = m.m11(); // scaleX + matrix[1] = m.m21(); // skewX + matrix[2] = m.m41(); // transX + matrix[3] = m.m12(); // skewY + matrix[4] = m.m22(); // scaleY + matrix[5] = m.m42(); // transY + matrix[6] = m.m14(); // persp0 + matrix[7] = m.m24(); // persp1 + matrix[8] = m.m44(); // persp2 } void GLUtils::setOrthographicMatrix(TransformationMatrix& ortho, float left, float top, diff --git a/WebCore/platform/graphics/android/GLUtils.h b/WebCore/platform/graphics/android/GLUtils.h index 1886c04..1b2e823 100644 --- a/WebCore/platform/graphics/android/GLUtils.h +++ b/WebCore/platform/graphics/android/GLUtils.h @@ -33,6 +33,7 @@ #include <EGL/egl.h> #include <EGL/eglext.h> #include "SkBitmap.h" +#include "SkMatrix.h" #include "TransformationMatrix.h" namespace WebCore { @@ -42,6 +43,7 @@ class GLUtils { public: // Matrix utilities static void toGLMatrix(GLfloat* flattened, const TransformationMatrix& matrix); + static void toSkMatrix(SkMatrix& skmatrix, const TransformationMatrix& matrix); static void setOrthographicMatrix(TransformationMatrix& ortho, float left, float top, float right, float bottom, float nearZ, float farZ); diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index d91ac65..b71f525 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -5,6 +5,7 @@ #include "AndroidAnimation.h" #include "DrawExtra.h" +#include "GLUtils.h" #include "ParseCanvas.h" #include "SkBitmapRef.h" #include "SkBounder.h" @@ -419,17 +420,8 @@ void LayerAndroid::updatePositions() // // TODO: this should happen in the caller, and we should remove these // fields from our subclass - TransformationMatrix::DecomposedType tDecomp; - m_transform.decompose(tDecomp); matrix.reset(); - matrix.setScaleX(tDecomp.scaleX); - matrix.setScaleY(tDecomp.scaleY); - matrix.setSkewX(tDecomp.skewXZ); - matrix.setSkewY(tDecomp.skewYZ); - matrix.setTranslateX(tDecomp.translateX); - matrix.setTranslateY(tDecomp.translateY); - matrix.setPerspX(tDecomp.perspectiveX); - matrix.setPerspY(tDecomp.perspectiveY); + GLUtils::toSkMatrix(matrix, m_transform); this->setMatrix(matrix); } |