Line data Source code
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 "glsl/GrGLSLProgramDataManager.h"
9 :
10 : #include "SkMatrix.h"
11 : #include "SkMatrix44.h"
12 :
13 0 : void GrGLSLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix) const {
14 : float mt[] = {
15 0 : matrix.get(SkMatrix::kMScaleX),
16 0 : matrix.get(SkMatrix::kMSkewY),
17 0 : matrix.get(SkMatrix::kMPersp0),
18 0 : matrix.get(SkMatrix::kMSkewX),
19 0 : matrix.get(SkMatrix::kMScaleY),
20 0 : matrix.get(SkMatrix::kMPersp1),
21 0 : matrix.get(SkMatrix::kMTransX),
22 0 : matrix.get(SkMatrix::kMTransY),
23 0 : matrix.get(SkMatrix::kMPersp2),
24 0 : };
25 0 : this->setMatrix3f(u, mt);
26 0 : }
27 :
28 0 : 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 0 : matrix.asColMajorf(m);
32 0 : this->setMatrix4f(u, m);
33 0 : }
|