OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 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 "gl/GrGLPathProgramDataManager.h" |
| 9 #include "gl/GrGLPathRendering.h" |
| 10 #include "gl/GrGLUniformHandle.h" |
| 11 #include "gl/GrGLGpu.h" |
| 12 #include "SkMatrix.h" |
| 13 |
| 14 GrGLPathProgramDataManager::GrGLPathProgramDataManager( |
| 15 GrGLGpu* gpu, GrGLuint programID, const SeparableVaryingInfoArray& separable
Varyings) |
| 16 : fGpu(gpu) |
| 17 , fProgramID(programID) { |
| 18 int count = separableVaryings.count(); |
| 19 fSeparableVaryings.push_back_n(count); |
| 20 for (int i = 0; i < count; i++) { |
| 21 SeparableVarying& separableVarying = fSeparableVaryings[i]; |
| 22 const SeparableVaryingInfo& builderSeparableVarying = separableVaryings[
i]; |
| 23 SkASSERT(GrGLShaderVar::kNonArray == builderSeparableVarying.fVariable.g
etArrayCount() || |
| 24 builderSeparableVarying.fVariable.getArrayCount() > 0); |
| 25 SkDEBUGCODE( |
| 26 separableVarying.fArrayCount = builderSeparableVarying.fVariable.get
ArrayCount(); |
| 27 separableVarying.fType = builderSeparableVarying.fVariable.getType()
; |
| 28 ); |
| 29 separableVarying.fLocation = builderSeparableVarying.fLocation; |
| 30 } |
| 31 } |
| 32 |
| 33 void GrGLPathProgramDataManager::setPathFragmentInputTransform(SeparableVaryingH
andle u, |
| 34 int components, |
| 35 const SkMatrix& m
atrix) const { |
| 36 const SeparableVarying& fragmentInput = |
| 37 fSeparableVaryings[u.toProgramDataIndex()]; |
| 38 |
| 39 SkASSERT((components == 2 && fragmentInput.fType == kVec2f_GrSLType) || |
| 40 (components == 3 && fragmentInput.fType == kVec3f_GrSLType)); |
| 41 |
| 42 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID, |
| 43 fragmentInput.
fLocation, |
| 44 GR_GL_OBJECT_L
INEAR, |
| 45 components, |
| 46 matrix); |
| 47 } |
| 48 |
OLD | NEW |