| Index: src/gpu/gl/GrGLUtil.cpp
|
| diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
|
| index 422f0c321a8be913b0bcbdef2051c2dacbb6a25d..d6f5820781699b3fd8f9c0335b035af90f475e62 100644
|
| --- a/src/gpu/gl/GrGLUtil.cpp
|
| +++ b/src/gpu/gl/GrGLUtil.cpp
|
| @@ -7,6 +7,7 @@
|
|
|
|
|
| #include "GrGLUtil.h"
|
| +#include "SkMatrix.h"
|
|
|
| void GrGLClearErr(const GrGLInterface* gl) {
|
| while (GR_GL_NO_ERROR != gl->fGetError()) {}
|
| @@ -236,3 +237,46 @@ GrGLVendor GrGLGetVendor(const GrGLInterface* gl) {
|
| GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR));
|
| return GrGLGetVendorFromString((const char*) v);
|
| }
|
| +
|
| +template<> void GrGLGetMatrix<3>(GrGLfloat* dest, const SkMatrix& src) {
|
| + // Col 0
|
| + dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
|
| + dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
|
| + dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
|
| +
|
| + // Col 1
|
| + dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
|
| + dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
|
| + dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
|
| +
|
| + // Col 2
|
| + dest[6] = SkScalarToFloat(src[SkMatrix::kMTransX]);
|
| + dest[7] = SkScalarToFloat(src[SkMatrix::kMTransY]);
|
| + dest[8] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
|
| +}
|
| +
|
| +template<> void GrGLGetMatrix<4>(GrGLfloat* dest, const SkMatrix& src) {
|
| + // Col 0
|
| + dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
|
| + dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
|
| + dest[2] = 0;
|
| + dest[3] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
|
| +
|
| + // Col 1
|
| + dest[4] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
|
| + dest[5] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
|
| + dest[6] = 0;
|
| + dest[7] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
|
| +
|
| + // Col 2
|
| + dest[8] = 0;
|
| + dest[9] = 0;
|
| + dest[10] = 1;
|
| + dest[11] = 0;
|
| +
|
| + // Col 3
|
| + dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]);
|
| + dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]);
|
| + dest[14] = 0;
|
| + dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
|
| +}
|
|
|