| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrGLPathProcessor.h" | 8 #include "GrGLPathProcessor.h" |
| 9 | 9 |
| 10 #include "GrPathProcessor.h" | 10 #include "GrPathProcessor.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 fSeparableVaryingInfos[i].fLocation = location; | 101 fSeparableVaryingInfos[i].fLocation = location; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 void GrGLPathProcessor::setTransformData( | 105 void GrGLPathProcessor::setTransformData( |
| 106 const GrPrimitiveProcessor& primProc, | 106 const GrPrimitiveProcessor& primProc, |
| 107 int index, | 107 int index, |
| 108 const SkTArray<const GrCoordTransform*, true>& coordTransforms, | 108 const SkTArray<const GrCoordTransform*, true>& coordTransforms, |
| 109 GrGLPathRendering* glpr, | 109 GrGLPathRendering* glpr, |
| 110 GrGLuint programID) { | 110 GrGLuint programID) { |
| 111 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); |
| 111 SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index]; | 112 SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index]; |
| 112 int numTransforms = transforms.count(); | 113 int numTransforms = transforms.count(); |
| 113 for (int t = 0; t < numTransforms; ++t) { | 114 for (int t = 0; t < numTransforms; ++t) { |
| 114 SkASSERT(transforms[t].fHandle.isValid()); | 115 SkASSERT(transforms[t].fHandle.isValid()); |
| 115 const SkMatrix& transform = GetTransformMatrix(primProc.localMatrix(), | 116 const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix(), |
| 116 *coordTransforms[t]); | 117 *coordTransforms[t]); |
| 117 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) { | 118 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) { |
| 118 continue; | 119 continue; |
| 119 } | 120 } |
| 120 transforms[t].fCurrentValue = transform; | 121 transforms[t].fCurrentValue = transform; |
| 121 const SeparableVaryingInfo& fragmentInput = | 122 const SeparableVaryingInfo& fragmentInput = |
| 122 fSeparableVaryingInfos[transforms[t].fHandle.handle()]; | 123 fSeparableVaryingInfos[transforms[t].fHandle.handle()]; |
| 123 SkASSERT(transforms[t].fType == kVec2f_GrSLType || | 124 SkASSERT(transforms[t].fType == kVec2f_GrSLType || |
| 124 transforms[t].fType == kVec3f_GrSLType); | 125 transforms[t].fType == kVec3f_GrSLType); |
| 125 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3; | 126 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3; |
| 126 glpr->setProgramPathFragmentInputTransform(programID, | 127 glpr->setProgramPathFragmentInputTransform(programID, |
| 127 fragmentInput.fLocation, | 128 fragmentInput.fLocation, |
| 128 GR_GL_OBJECT_LINEAR, | 129 GR_GL_OBJECT_LINEAR, |
| 129 components, | 130 components, |
| 130 transform); | 131 transform); |
| 131 } | 132 } |
| 132 } | 133 } |
| OLD | NEW |