| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "glsl/GrGLSLProgramDataManager.h" | 8 #include "glsl/GrGLSLProgramDataManager.h" |
| 9 | 9 |
| 10 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
| 11 #include "SkMatrix44.h" |
| 11 | 12 |
| 12 void GrGLSLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matr
ix) const { | 13 void GrGLSLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matr
ix) const { |
| 13 float mt[] = { | 14 float mt[] = { |
| 14 matrix.get(SkMatrix::kMScaleX), | 15 matrix.get(SkMatrix::kMScaleX), |
| 15 matrix.get(SkMatrix::kMSkewY), | 16 matrix.get(SkMatrix::kMSkewY), |
| 16 matrix.get(SkMatrix::kMPersp0), | 17 matrix.get(SkMatrix::kMPersp0), |
| 17 matrix.get(SkMatrix::kMSkewX), | 18 matrix.get(SkMatrix::kMSkewX), |
| 18 matrix.get(SkMatrix::kMScaleY), | 19 matrix.get(SkMatrix::kMScaleY), |
| 19 matrix.get(SkMatrix::kMPersp1), | 20 matrix.get(SkMatrix::kMPersp1), |
| 20 matrix.get(SkMatrix::kMTransX), | 21 matrix.get(SkMatrix::kMTransX), |
| 21 matrix.get(SkMatrix::kMTransY), | 22 matrix.get(SkMatrix::kMTransY), |
| 22 matrix.get(SkMatrix::kMPersp2), | 23 matrix.get(SkMatrix::kMPersp2), |
| 23 }; | 24 }; |
| 24 this->setMatrix3f(u, mt); | 25 this->setMatrix3f(u, mt); |
| 25 } | 26 } |
| 27 |
| 28 void GrGLSLProgramDataManager::setSkMatrix44(UniformHandle u, const SkMatrix44&
matrix) const { |
| 29 // TODO: We could skip this temporary buffer if we had direct access to the
matrix storage |
| 30 float m[16]; |
| 31 matrix.asColMajorf(m); |
| 32 this->setMatrix4f(u, m); |
| 33 } |
| OLD | NEW |