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