sk_sp<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor( const SkMatrix& textureMatrix, const SkRect& constraintRect, FilterConstraint filterConstraint, bool coordsLimitedToConstraintRect, const GrTextureParams::FilterMode* filterOrNullForBicubic, SkColorSpace* dstColorSpace, SkSourceGammaTreatment gammaTreatment) { const GrTextureParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic; if (filterOrNullForBicubic && GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic && kYes_FilterConstraint == filterConstraint) { // TODo: Here we should force a copy restricted to the constraintRect since MIP maps will // read outside the constraint rect. However, as in the adjuster case, we aren't currently // doing that. // We instead we compute the domain as though were bilerping which is only correct if we // only sample level 0. static const GrTextureParams::FilterMode kBilerp = GrTextureParams::kBilerp_FilterMode; fmForDetermineDomain = &kBilerp; } GrTextureParams params; if (filterOrNullForBicubic) { params.reset(SkShader::kClamp_TileMode, *filterOrNullForBicubic); } else { // Bicubic doesn't use filtering for it's texture accesses. params.reset(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode); } SkAutoTUnref<GrTexture> texture(this->refTextureForParams(params, gammaTreatment)); if (!texture) { return nullptr; } SkRect domain; DomainMode domainMode = determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToConstraintRect, texture->width(), texture->height(), nullptr, fmForDetermineDomain, &domain); SkASSERT(kTightCopy_DomainMode != domainMode); SkMatrix normalizedTextureMatrix = textureMatrix; normalizedTextureMatrix.postIDiv(texture->width(), texture->height()); sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->getColorSpace(), dstColorSpace); return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), normalizedTextureMatrix, domainMode, domain, filterOrNullForBicubic); }