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