summaryrefslogtreecommitdiffstats
path: root/gfx/skia/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/skia/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp')
-rw-r--r--gfx/skia/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/gfx/skia/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp b/gfx/skia/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp
new file mode 100644
index 0000000000..395e325f9a
--- /dev/null
+++ b/gfx/skia/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
+
+#include "include/core/SkMatrix.h"
+#include "include/core/SkMatrix44.h"
+
+void GrGLSLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix) const {
+ float mt[] = {
+ matrix.get(SkMatrix::kMScaleX),
+ matrix.get(SkMatrix::kMSkewY),
+ matrix.get(SkMatrix::kMPersp0),
+ matrix.get(SkMatrix::kMSkewX),
+ matrix.get(SkMatrix::kMScaleY),
+ matrix.get(SkMatrix::kMPersp1),
+ matrix.get(SkMatrix::kMTransX),
+ matrix.get(SkMatrix::kMTransY),
+ matrix.get(SkMatrix::kMPersp2),
+ };
+ this->setMatrix3f(u, mt);
+}
+
+void GrGLSLProgramDataManager::setSkMatrix44(UniformHandle u, const SkMatrix44& matrix) const {
+ float mt[16];
+ matrix.asColMajorf(mt);
+ this->setMatrix4f(u, mt);
+}