| 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 "GrPathProcessor.h" | 8 #include "GrPathProcessor.h" |
| 9 | 9 |
| 10 #include "gl/GrGLGpu.h" | 10 #include "gl/GrGLGpu.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 fInstalledTransforms[i][t].fHandle = | 64 fInstalledTransforms[i][t].fHandle = |
| 65 pb->addSeparableVarying(strVaryingName.c_str(), &v).toIn
dex(); | 65 pb->addSeparableVarying(strVaryingName.c_str(), &v).toIn
dex(); |
| 66 fInstalledTransforms[i][t].fType = varyingType; | 66 fInstalledTransforms[i][t].fType = varyingType; |
| 67 | 67 |
| 68 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCo
ords, | 68 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCo
ords, |
| 69 (SkString(v.fsIn()), varyingType)); | 69 (SkString(v.fsIn()), varyingType)); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 void setData(const GrGLProgramDataManager& pd, const GrPrimitiveProcessor& p
rimProc) override { | 74 void setData(const GrGLSLProgramDataManager& pd, |
| 75 const GrPrimitiveProcessor& primProc) override { |
| 75 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); | 76 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); |
| 76 if (pathProc.opts().readsColor() && pathProc.color() != fColor) { | 77 if (pathProc.opts().readsColor() && pathProc.color() != fColor) { |
| 77 GrGLfloat c[4]; | 78 float c[4]; |
| 78 GrColorToRGBAFloat(pathProc.color(), c); | 79 GrColorToRGBAFloat(pathProc.color(), c); |
| 79 pd.set4fv(fColorUniform, 1, c); | 80 pd.set4fv(fColorUniform, 1, c); |
| 80 fColor = pathProc.color(); | 81 fColor = pathProc.color(); |
| 81 } | 82 } |
| 82 } | 83 } |
| 83 | 84 |
| 84 void setTransformData(const GrPrimitiveProcessor& primProc, | 85 void setTransformData(const GrPrimitiveProcessor& primProc, |
| 85 const GrGLProgramDataManager& pdman, | 86 const GrGLSLProgramDataManager& pdman, |
| 86 int index, | 87 int index, |
| 87 const SkTArray<const GrCoordTransform*, true>& coordTr
ansforms) override { | 88 const SkTArray<const GrCoordTransform*, true>& coordTr
ansforms) override { |
| 88 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); | 89 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); |
| 89 SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index]; | 90 SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index]; |
| 90 int numTransforms = transforms.count(); | 91 int numTransforms = transforms.count(); |
| 91 for (int t = 0; t < numTransforms; ++t) { | 92 for (int t = 0; t < numTransforms; ++t) { |
| 92 SkASSERT(transforms[t].fHandle.isValid()); | 93 SkASSERT(transforms[t].fHandle.isValid()); |
| 93 const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix(
), | 94 const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix(
), |
| 94 *coordTransforms[t]); | 95 *coordTransforms[t]); |
| 95 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) { | 96 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 125 | 126 |
| 126 void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps, | 127 void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps, |
| 127 GrProcessorKeyBuilder* b) const { | 128 GrProcessorKeyBuilder* b) const { |
| 128 GrGLPathProcessor::GenKey(*this, caps, b); | 129 GrGLPathProcessor::GenKey(*this, caps, b); |
| 129 } | 130 } |
| 130 | 131 |
| 131 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& caps
) const { | 132 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& caps
) const { |
| 132 SkASSERT(caps.pathRenderingSupport()); | 133 SkASSERT(caps.pathRenderingSupport()); |
| 133 return new GrGLPathProcessor(); | 134 return new GrGLPathProcessor(); |
| 134 } | 135 } |
| OLD | NEW |