1 | /* |
2 | * Copyright 2016 Google Inc. |
3 | * |
4 | * Use of this source code is governed by a BSD-style license that can be |
5 | * found in the LICENSE file. |
6 | */ |
7 | |
8 | #include "src/gpu/glsl/GrGLSLProgramDataManager.h" |
9 | |
10 | #include "include/core/SkM44.h" |
11 | #include "include/core/SkMatrix.h" |
12 | #include "src/core/SkMatrixPriv.h" |
13 | |
14 | void GrGLSLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix) const { |
15 | float mt[] = { |
16 | matrix.get(SkMatrix::kMScaleX), |
17 | matrix.get(SkMatrix::kMSkewY), |
18 | matrix.get(SkMatrix::kMPersp0), |
19 | matrix.get(SkMatrix::kMSkewX), |
20 | matrix.get(SkMatrix::kMScaleY), |
21 | matrix.get(SkMatrix::kMPersp1), |
22 | matrix.get(SkMatrix::kMTransX), |
23 | matrix.get(SkMatrix::kMTransY), |
24 | matrix.get(SkMatrix::kMPersp2), |
25 | }; |
26 | this->setMatrix3f(u, mt); |
27 | } |
28 | |
29 | void GrGLSLProgramDataManager::setSkM44(UniformHandle u, const SkM44& matrix) const { |
30 | this->setMatrix4f(u, SkMatrixPriv::M44ColMajor(matrix)); |
31 | } |
32 | |