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