/////////////////////////////////////////////////////////////////////////////////////////
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,
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "SkBitmap.h"
+#include "SkMatrix.h"
#include "TransformationMatrix.h"
namespace WebCore {
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);
#include "AndroidAnimation.h"
#include "DrawExtra.h"
+#include "GLUtils.h"
#include "ParseCanvas.h"
#include "SkBitmapRef.h"
#include "SkBounder.h"
//
// 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);
}