void GrGLNormalPathProcessor::setTransformData( const GrPrimitiveProcessor& primProc, int index, const SkTArray<const GrCoordTransform*, true>& coordTransforms, GrGLPathRendering* glpr, GrGLuint programID) { SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index]; int numTransforms = transforms.count(); for (int t = 0; t < numTransforms; ++t) { SkASSERT(transforms[t].fHandle.isValid()); const SkMatrix& transform = GetTransformMatrix(primProc.localMatrix(), *coordTransforms[t]); if (transforms[t].fCurrentValue.cheapEqualTo(transform)) { continue; } transforms[t].fCurrentValue = transform; const SeparableVaryingInfo& fragmentInput = fSeparableVaryingInfos[transforms[t].fHandle.handle()]; SkASSERT(transforms[t].fType == kVec2f_GrSLType || transforms[t].fType == kVec3f_GrSLType); unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3; glpr->setProgramPathFragmentInputTransform(programID, fragmentInput.fLocation, GR_GL_OBJECT_LINEAR, components, transform); } }
void GrGLGeometryProcessor::setTransformData(const GrPrimitiveProcessor& primProc, const GrGLProgramDataManager& pdman, int index, const SkTArray<const GrCoordTransform*, true>& transforms) { SkSTArray<2, Transform, true>& procTransforms = fInstalledTransforms[index]; int numTransforms = transforms.count(); for (int t = 0; t < numTransforms; ++t) { SkASSERT(procTransforms[t].fHandle.isValid()); const SkMatrix& transform = GetTransformMatrix(primProc.localMatrix(), *transforms[t]); if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) { pdman.setSkMatrix(procTransforms[t].fHandle.convertToUniformHandle(), transform); procTransforms[t].fCurrentValue = transform; } } }
void GrGLLegacyPathProcessor::setTransformData( const GrPrimitiveProcessor& primProc, int index, const SkTArray<const GrCoordTransform*, true>& transforms, GrGLPathRendering* glpr, GrGLuint) { // We've hidden the texcoord index in the first entry of the transforms array for each // effect int texCoordIndex = fInstalledTransforms[index][0].fHandle.handle(); for (int t = 0; t < transforms.count(); ++t) { const SkMatrix& transform = GetTransformMatrix(primProc.localMatrix(), *transforms[t]); GrGLPathRendering::PathTexGenComponents components = GrGLPathRendering::kST_PathTexGenComponents; if (transform.hasPerspective()) { components = GrGLPathRendering::kSTR_PathTexGenComponents; } glpr->enablePathTexGen(texCoordIndex++, components, transform); } }