Have GrTextureEffect factories take a view as input.
Bug: skia:9556 Change-Id: I06fd7e9bc7e370a5b8891220308a6d362336be9e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268632 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
9bfd5956de
commit
d2ccbb522e
@ -85,7 +85,7 @@ DEF_SIMPLE_GPU_GM_BG(fpcoordinateoverride, ctx, rtCtx, canvas, 512, 512,
|
||||
GrBitmapTextureMaker maker(ctx, bmp);
|
||||
auto[view, grCT] = maker.view(GrMipMapped::kNo);
|
||||
std::unique_ptr<GrFragmentProcessor> imgFP =
|
||||
GrTextureEffect::Make(view.detachProxy(), bmp.alphaType(), SkMatrix());
|
||||
GrTextureEffect::Make(std::move(view), bmp.alphaType(), SkMatrix());
|
||||
auto fp = std::unique_ptr<GrFragmentProcessor>(new SampleCoordEffect(std::move(imgFP)));
|
||||
|
||||
GrPaint grPaint;
|
||||
|
@ -146,7 +146,7 @@ protected:
|
||||
}
|
||||
GrSamplerState sampler(wmx, wmy, fFilter);
|
||||
const auto& caps = *context->priv().caps();
|
||||
auto fp1 = GrTextureEffect::MakeTexelSubset(view.refProxy(),
|
||||
auto fp1 = GrTextureEffect::MakeTexelSubset(view,
|
||||
fBitmap.alphaType(),
|
||||
textureMatrices[tm],
|
||||
sampler,
|
||||
@ -174,8 +174,8 @@ protected:
|
||||
// Now draw with a subsetted proxy using fixed function texture sampling rather
|
||||
// than a texture subset as a comparison.
|
||||
drawRect = localRect.makeOffset(x, y);
|
||||
auto fp2 = GrTextureEffect::Make(subsetView.refProxy(),
|
||||
fBitmap.alphaType(), subsetTextureMatrix,
|
||||
auto fp2 = GrTextureEffect::Make(subsetView, fBitmap.alphaType(),
|
||||
subsetTextureMatrix,
|
||||
GrSamplerState(wmx, wmy, fFilter), caps);
|
||||
if (auto op = sk_gpu_test::test_ops::MakeRect(context, std::move(fp2), drawRect,
|
||||
localRect)) {
|
||||
|
@ -194,8 +194,8 @@ void CCPRGeometryView::onDrawContent(SkCanvas* canvas) {
|
||||
|
||||
// Visualize coverage count in main canvas.
|
||||
GrPaint paint;
|
||||
paint.addColorFragmentProcessor(GrTextureEffect::Make(sk_ref_sp(ccbuff->asTextureProxy()),
|
||||
ccbuff->colorInfo().alphaType()));
|
||||
paint.addColorFragmentProcessor(
|
||||
GrTextureEffect::Make(ccbuff->readSurfaceView(), ccbuff->colorInfo().alphaType()));
|
||||
paint.addColorFragmentProcessor(
|
||||
std::make_unique<VisualizeCoverageCountFP>());
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrcOver);
|
||||
|
@ -899,8 +899,7 @@ GrSurfaceProxyView SkBlurMaskFilterImpl::filterMaskGPU(GrRecordingContext* conte
|
||||
if (!isNormalBlur) {
|
||||
GrPaint paint;
|
||||
// Blend pathTexture over blurTexture.
|
||||
paint.addCoverageFragmentProcessor(
|
||||
GrTextureEffect::Make(srcView.detachProxy(), srcAlphaType));
|
||||
paint.addCoverageFragmentProcessor(GrTextureEffect::Make(std::move(srcView), srcAlphaType));
|
||||
if (kInner_SkBlurStyle == fBlurStyle) {
|
||||
// inner: dst = dst * src
|
||||
paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op);
|
||||
|
@ -324,11 +324,11 @@ static GrSurfaceProxyView decimate(GrRecordingContext* context,
|
||||
}
|
||||
const auto& caps = *context->priv().caps();
|
||||
GrSamplerState sampler(wrapMode, GrSamplerState::Filter::kBilerp);
|
||||
fp = GrTextureEffect::MakeTexelSubset(srcView.detachProxy(), srcAlphaType,
|
||||
SkMatrix::I(), sampler, *contentRect, caps);
|
||||
fp = GrTextureEffect::MakeTexelSubset(std::move(srcView), srcAlphaType, SkMatrix::I(),
|
||||
sampler, *contentRect, caps);
|
||||
srcRect.offset(-srcOffset);
|
||||
} else {
|
||||
fp = GrTextureEffect::Make(srcView.detachProxy(), srcAlphaType, SkMatrix::I(),
|
||||
fp = GrTextureEffect::Make(std::move(srcView), srcAlphaType, SkMatrix::I(),
|
||||
GrSamplerState::Filter::kBilerp);
|
||||
}
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
@ -385,7 +385,7 @@ static std::unique_ptr<GrRenderTargetContext> reexpand(GrRecordingContext* conte
|
||||
|
||||
GrPaint paint;
|
||||
const auto& caps = *context->priv().caps();
|
||||
auto fp = GrTextureEffect::MakeTexelSubset(srcView.detachProxy(), srcAlphaType, SkMatrix::I(),
|
||||
auto fp = GrTextureEffect::MakeTexelSubset(std::move(srcView), srcAlphaType, SkMatrix::I(),
|
||||
GrSamplerState::Filter::kBilerp, srcBounds, caps);
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
@ -167,7 +167,7 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(const Context& c
|
||||
}
|
||||
|
||||
auto textureFP = GrTextureEffect::Make(
|
||||
inputView.detachProxy(), input->alphaType(),
|
||||
std::move(inputView), input->alphaType(),
|
||||
SkMatrix::MakeTrans(input->subset().x(), input->subset().y()));
|
||||
textureFP = GrColorSpaceXformEffect::Make(std::move(textureFP), input->getColorSpace(),
|
||||
input->alphaType(), ctx.colorSpace());
|
||||
|
@ -357,9 +357,8 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
|
||||
SkMatrix backgroundMatrix = SkMatrix::MakeTrans(
|
||||
SkIntToScalar(bgSubset.left() - backgroundOffset.fX),
|
||||
SkIntToScalar(bgSubset.top() - backgroundOffset.fY));
|
||||
bgFP = GrTextureEffect::MakeTexelSubset(backgroundView.detachProxy(),
|
||||
background->alphaType(), backgroundMatrix, sampler,
|
||||
bgSubset, caps);
|
||||
bgFP = GrTextureEffect::MakeTexelSubset(std::move(backgroundView), background->alphaType(),
|
||||
backgroundMatrix, sampler, bgSubset, caps);
|
||||
bgFP = GrColorSpaceXformEffect::Make(std::move(bgFP), background->getColorSpace(),
|
||||
background->alphaType(),
|
||||
ctx.colorSpace());
|
||||
@ -373,9 +372,9 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
|
||||
SkMatrix foregroundMatrix = SkMatrix::MakeTrans(
|
||||
SkIntToScalar(fgSubset.left() - foregroundOffset.fX),
|
||||
SkIntToScalar(fgSubset.top() - foregroundOffset.fY));
|
||||
auto fgFP = GrTextureEffect::MakeTexelSubset(foregroundView.detachProxy(),
|
||||
foreground->alphaType(), foregroundMatrix,
|
||||
sampler, fgSubset, caps);
|
||||
auto fgFP =
|
||||
GrTextureEffect::MakeTexelSubset(std::move(foregroundView), foreground->alphaType(),
|
||||
foregroundMatrix, sampler, fgSubset, caps);
|
||||
fgFP = GrColorSpaceXformEffect::Make(std::move(fgFP),
|
||||
foreground->getColorSpace(),
|
||||
foreground->alphaType(),
|
||||
|
@ -267,9 +267,8 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilterImpl::filterImageGPU(
|
||||
SkMatrix bgMatrix = SkMatrix::MakeTrans(
|
||||
SkIntToScalar(bgSubset.left() - backgroundOffset.fX),
|
||||
SkIntToScalar(bgSubset.top() - backgroundOffset.fY));
|
||||
bgFP = GrTextureEffect::MakeTexelSubset(backgroundView.detachProxy(),
|
||||
background->alphaType(), bgMatrix, sampler,
|
||||
bgSubset, caps);
|
||||
bgFP = GrTextureEffect::MakeTexelSubset(std::move(backgroundView), background->alphaType(),
|
||||
bgMatrix, sampler, bgSubset, caps);
|
||||
bgFP = GrColorSpaceXformEffect::Make(std::move(bgFP), background->getColorSpace(),
|
||||
background->alphaType(),
|
||||
ctx.colorSpace());
|
||||
@ -283,9 +282,9 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilterImpl::filterImageGPU(
|
||||
SkMatrix fgMatrix = SkMatrix::MakeTrans(
|
||||
SkIntToScalar(fgSubset.left() - foregroundOffset.fX),
|
||||
SkIntToScalar(fgSubset.top() - foregroundOffset.fY));
|
||||
auto fgFP = GrTextureEffect::MakeTexelSubset(foregroundView.detachProxy(),
|
||||
foreground->alphaType(), fgMatrix, sampler,
|
||||
fgSubset, caps);
|
||||
auto fgFP =
|
||||
GrTextureEffect::MakeTexelSubset(std::move(foregroundView), foreground->alphaType(),
|
||||
fgMatrix, sampler, fgSubset, caps);
|
||||
fgFP = GrColorSpaceXformEffect::Make(std::move(fgFP),
|
||||
foreground->getColorSpace(),
|
||||
foreground->alphaType(),
|
||||
|
@ -49,7 +49,7 @@ static bool draw_mask(GrRenderTargetContext* renderTargetContext,
|
||||
-SkIntToScalar(maskRect.fTop));
|
||||
matrix.preConcat(viewMatrix);
|
||||
paint.addCoverageFragmentProcessor(
|
||||
GrTextureEffect::Make(mask.detachProxy(), kUnknown_SkAlphaType, matrix));
|
||||
GrTextureEffect::Make(std::move(mask), kUnknown_SkAlphaType, matrix));
|
||||
|
||||
renderTargetContext->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
|
||||
SkRect::Make(maskRect), inverse);
|
||||
|
@ -2036,7 +2036,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC
|
||||
std::copy_n(baseM + 0, 5, yM + 15);
|
||||
GrPaint yPaint;
|
||||
yPaint.addColorFragmentProcessor(
|
||||
GrTextureEffect::Make(srcView.refProxy(), this->colorInfo().alphaType(), texMatrix));
|
||||
GrTextureEffect::Make(srcView, this->colorInfo().alphaType(), texMatrix));
|
||||
auto yFP = GrColorMatrixFragmentProcessor::Make(yM, false, true, false);
|
||||
yPaint.addColorFragmentProcessor(std::move(yFP));
|
||||
yPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -2058,8 +2058,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC
|
||||
std::copy_n(baseM + 5, 5, uM + 15);
|
||||
GrPaint uPaint;
|
||||
uPaint.addColorFragmentProcessor(GrTextureEffect::Make(
|
||||
srcView.refProxy(), this->colorInfo().alphaType(), texMatrix,
|
||||
GrSamplerState::Filter::kBilerp));
|
||||
srcView, this->colorInfo().alphaType(), texMatrix, GrSamplerState::Filter::kBilerp));
|
||||
auto uFP = GrColorMatrixFragmentProcessor::Make(uM, false, true, false);
|
||||
uPaint.addColorFragmentProcessor(std::move(uFP));
|
||||
uPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -2079,9 +2078,9 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC
|
||||
std::fill_n(vM, 15, 0.f);
|
||||
std::copy_n(baseM + 10, 5, vM + 15);
|
||||
GrPaint vPaint;
|
||||
vPaint.addColorFragmentProcessor(GrTextureEffect::Make(
|
||||
srcView.detachProxy(), this->colorInfo().alphaType(), texMatrix,
|
||||
GrSamplerState::Filter::kBilerp));
|
||||
vPaint.addColorFragmentProcessor(GrTextureEffect::Make(std::move(srcView),
|
||||
this->colorInfo().alphaType(), texMatrix,
|
||||
GrSamplerState::Filter::kBilerp));
|
||||
auto vFP = GrColorMatrixFragmentProcessor::Make(vM, false, true, false);
|
||||
vPaint.addColorFragmentProcessor(std::move(vFP));
|
||||
vPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -2628,7 +2627,11 @@ bool GrRenderTargetContext::blitTexture(GrTextureProxy* src, const SkIRect& srcR
|
||||
|
||||
GrPaint paint;
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
auto fp = GrTextureEffect::Make(sk_ref_sp(src), kUnknown_SkAlphaType);
|
||||
|
||||
GrSurfaceOrigin origin = src->origin();
|
||||
GrSwizzle swizzle = src->textureSwizzle();
|
||||
GrSurfaceProxyView view(sk_ref_sp(src), origin, swizzle);
|
||||
auto fp = GrTextureEffect::Make(std::move(view), kUnknown_SkAlphaType);
|
||||
if (!fp) {
|
||||
return false;
|
||||
}
|
||||
|
@ -163,8 +163,12 @@ void GrSoftwarePathRenderer::DrawToTargetWithShapeMask(
|
||||
SkMatrix maskMatrix = SkMatrix::MakeTrans(SkIntToScalar(-textureOriginInDeviceSpace.fX),
|
||||
SkIntToScalar(-textureOriginInDeviceSpace.fY));
|
||||
maskMatrix.preConcat(viewMatrix);
|
||||
|
||||
GrSurfaceOrigin origin = proxy->origin();
|
||||
GrSwizzle swizzle = proxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
|
||||
paint.addCoverageFragmentProcessor(GrTextureEffect::Make(
|
||||
std::move(proxy), kPremul_SkAlphaType, maskMatrix, GrSamplerState::Filter::kNearest));
|
||||
std::move(view), kPremul_SkAlphaType, maskMatrix, GrSamplerState::Filter::kNearest));
|
||||
DrawNonAARect(renderTargetContext, std::move(paint), userStencilSettings, clip, SkMatrix::I(),
|
||||
dstRect, invert);
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ bool GrSurfaceContext::readPixels(const GrImageInfo& origDstInfo, void* dst, siz
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> fp;
|
||||
if (canvas2DFastPath) {
|
||||
fp = direct->priv().createPMToUPMEffect(GrTextureEffect::Make(
|
||||
sk_ref_sp(srcProxy->asTextureProxy()), this->colorInfo().alphaType()));
|
||||
fp = direct->priv().createPMToUPMEffect(
|
||||
GrTextureEffect::Make(this->readSurfaceView(), this->colorInfo().alphaType()));
|
||||
if (dstInfo.colorType() == GrColorType::kBGRA_8888) {
|
||||
fp = GrFragmentProcessor::SwizzleOutput(std::move(fp), GrSwizzle::BGRA());
|
||||
dstInfo = dstInfo.makeColorType(GrColorType::kRGBA_8888);
|
||||
@ -229,8 +229,7 @@ bool GrSurfaceContext::readPixels(const GrImageInfo& origDstInfo, void* dst, siz
|
||||
// double unpremul.
|
||||
dstInfo = dstInfo.makeAlphaType(kPremul_SkAlphaType);
|
||||
} else {
|
||||
fp = GrTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
|
||||
this->colorInfo().alphaType());
|
||||
fp = GrTextureEffect::Make(this->readSurfaceView(), this->colorInfo().alphaType());
|
||||
}
|
||||
if (!fp) {
|
||||
return false;
|
||||
@ -397,7 +396,7 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
|
||||
}
|
||||
SkASSERT(tempProxy->textureSwizzle() == tempReadSwizzle);
|
||||
GrSurfaceProxyView tempView(tempProxy, tempOrigin, tempReadSwizzle);
|
||||
GrSurfaceContext tempCtx(direct, std::move(tempView), colorType, alphaType,
|
||||
GrSurfaceContext tempCtx(direct, tempView, colorType, alphaType,
|
||||
this->colorInfo().refColorSpace());
|
||||
|
||||
// In the fast path we always write the srcData to the temp context as though it were RGBA.
|
||||
@ -415,13 +414,13 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
|
||||
std::unique_ptr<GrFragmentProcessor> fp;
|
||||
if (canvas2DFastPath) {
|
||||
fp = direct->priv().createUPMToPMEffect(
|
||||
GrTextureEffect::Make(std::move(tempProxy), alphaType));
|
||||
GrTextureEffect::Make(std::move(tempView), alphaType));
|
||||
// Important: check the original src color type here!
|
||||
if (origSrcInfo.colorType() == GrColorType::kBGRA_8888) {
|
||||
fp = GrFragmentProcessor::SwizzleOutput(std::move(fp), GrSwizzle::BGRA());
|
||||
}
|
||||
} else {
|
||||
fp = GrTextureEffect::Make(std::move(tempProxy), alphaType);
|
||||
fp = GrTextureEffect::Make(std::move(tempView), alphaType);
|
||||
}
|
||||
if (!fp) {
|
||||
return false;
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
: fProxy(proxy), fOrigin(origin), fSwizzle(swizzle) {}
|
||||
|
||||
// This entry point is used when we don't care about the origin or the swizzle.
|
||||
GrSurfaceProxyView(sk_sp<GrSurfaceProxy> proxy)
|
||||
explicit GrSurfaceProxyView(sk_sp<GrSurfaceProxy> proxy)
|
||||
: fProxy(proxy), fOrigin(kTopLeft_GrSurfaceOrigin) {}
|
||||
|
||||
GrSurfaceProxyView(GrSurfaceProxyView&& view) = default;
|
||||
|
@ -61,7 +61,7 @@ GrSurfaceProxyView GrTextureProducer::CopyOnGpu(GrRecordingContext* context,
|
||||
|
||||
GrSamplerState sampler(GrSamplerState::WrapMode::kClamp, copyParams.fFilter);
|
||||
auto boundsRect = SkIRect::MakeSize(proxy->dimensions());
|
||||
auto fp = GrTextureEffect::MakeTexelSubset(inputView.detachProxy(), kUnknown_SkAlphaType,
|
||||
auto fp = GrTextureEffect::MakeTexelSubset(std::move(inputView), kUnknown_SkAlphaType,
|
||||
SkMatrix::I(), sampler, boundsRect, localRect, caps);
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -202,10 +202,10 @@ std::unique_ptr<GrFragmentProcessor> GrTextureProducer::createFragmentProcessorF
|
||||
: GrSamplerState::WrapMode::kClamp;
|
||||
GrSamplerState samplerState(wrapMode, *filterOrNullForBicubic);
|
||||
if (kNoDomain_DomainMode == domainMode) {
|
||||
return GrTextureEffect::Make(view.detachProxy(), srcAlphaType, textureMatrix,
|
||||
samplerState, caps);
|
||||
return GrTextureEffect::Make(std::move(view), srcAlphaType, textureMatrix, samplerState,
|
||||
caps);
|
||||
}
|
||||
return GrTextureEffect::MakeSubset(view.detachProxy(), srcAlphaType, textureMatrix,
|
||||
return GrTextureEffect::MakeSubset(std::move(view), srcAlphaType, textureMatrix,
|
||||
samplerState, domain, caps);
|
||||
} else {
|
||||
static const GrSamplerState::WrapMode kClampClamp[] = {
|
||||
|
@ -955,8 +955,11 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
|
||||
static constexpr auto kDir = GrBicubicEffect::Direction::kXY;
|
||||
fp = GrBicubicEffect::Make(std::move(proxy), texMatrix, domain, kDir, srcAlphaType);
|
||||
} else {
|
||||
fp = GrTextureEffect::MakeSubset(std::move(proxy), srcAlphaType, texMatrix,
|
||||
samplerState, domain, caps);
|
||||
GrSurfaceOrigin origin = proxy->origin();
|
||||
GrSwizzle swizzle = proxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
|
||||
fp = GrTextureEffect::MakeSubset(std::move(view), srcAlphaType, texMatrix, samplerState,
|
||||
domain, caps);
|
||||
}
|
||||
} else if (bicubic) {
|
||||
SkASSERT(GrSamplerState::Filter::kNearest == samplerState.filter());
|
||||
@ -964,7 +967,10 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
|
||||
static constexpr auto kDir = GrBicubicEffect::Direction::kXY;
|
||||
fp = GrBicubicEffect::Make(std::move(proxy), texMatrix, wrapMode, kDir, srcAlphaType);
|
||||
} else {
|
||||
fp = GrTextureEffect::Make(std::move(proxy), srcAlphaType, texMatrix, samplerState, caps);
|
||||
GrSurfaceOrigin origin = proxy->origin();
|
||||
GrSwizzle swizzle = proxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
|
||||
fp = GrTextureEffect::Make(std::move(view), srcAlphaType, texMatrix, samplerState, caps);
|
||||
}
|
||||
|
||||
fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(), bitmap.alphaType(),
|
||||
@ -1035,7 +1041,7 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special, int left, int top, const
|
||||
|
||||
tmpUnfiltered.setImageFilter(nullptr);
|
||||
|
||||
auto fp = GrTextureEffect::Make(view.detachProxy(), special->alphaType());
|
||||
auto fp = GrTextureEffect::Make(std::move(view), special->alphaType());
|
||||
fp = GrColorSpaceXformEffect::Make(std::move(fp), result->getColorSpace(), result->alphaType(),
|
||||
fRenderTargetContext->colorInfo().colorSpace());
|
||||
if (GrColorTypeIsAlphaOnly(SkColorTypeToGrColorType(result->colorType()))) {
|
||||
@ -1074,8 +1080,12 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special, int left, int top, const
|
||||
std::unique_ptr<GrFragmentProcessor> cfp;
|
||||
if (clipProxy && ctm.invert(&inverseClipMatrix)) {
|
||||
GrColorType srcColorType = SkColorTypeToGrColorType(clipImage->colorType());
|
||||
cfp = GrTextureEffect::Make(std::move(clipProxy), clipImage->alphaType(),
|
||||
inverseClipMatrix, filter);
|
||||
|
||||
GrSurfaceOrigin origin = clipProxy->origin();
|
||||
GrSwizzle swizzle = clipProxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(clipProxy), origin, swizzle);
|
||||
cfp = GrTextureEffect::Make(std::move(view), clipImage->alphaType(), inverseClipMatrix,
|
||||
filter);
|
||||
if (srcColorType != GrColorType::kAlpha_8) {
|
||||
cfp = GrFragmentProcessor::SwizzleOutput(std::move(cfp), GrSwizzle::AAAA());
|
||||
}
|
||||
|
@ -80,7 +80,7 @@
|
||||
std::unique_ptr<GrFragmentProcessor> upmToPM(
|
||||
new GrConfigConversionEffect(PMConversion::kToPremul));
|
||||
|
||||
paint1.addColorFragmentProcessor(GrTextureEffect::Make(dataView.detachProxy(),
|
||||
paint1.addColorFragmentProcessor(GrTextureEffect::Make(std::move(dataView),
|
||||
kPremul_SkAlphaType));
|
||||
paint1.addColorFragmentProcessor(pmToUPM->clone());
|
||||
paint1.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -95,14 +95,16 @@
|
||||
// draw
|
||||
tempRTC->discard();
|
||||
|
||||
paint2.addColorFragmentProcessor(GrTextureEffect::Make(readRTC->asTextureProxyRef(), kUnpremul_SkAlphaType));
|
||||
paint2.addColorFragmentProcessor(GrTextureEffect::Make(readRTC->readSurfaceView(),
|
||||
kUnpremul_SkAlphaType));
|
||||
paint2.addColorFragmentProcessor(std::move(upmToPM));
|
||||
paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
||||
tempRTC->fillRectToRect(GrNoClip(), std::move(paint2), GrAA::kNo, SkMatrix::I(), kRect,
|
||||
kRect);
|
||||
|
||||
paint3.addColorFragmentProcessor(GrTextureEffect::Make(tempRTC->asTextureProxyRef(), kPremul_SkAlphaType));
|
||||
paint3.addColorFragmentProcessor(GrTextureEffect::Make(tempRTC->readSurfaceView(),
|
||||
kPremul_SkAlphaType));
|
||||
paint3.addColorFragmentProcessor(std::move(pmToUPM));
|
||||
paint3.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
||||
|
@ -149,68 +149,69 @@ bool GrTextureEffect::Sampling::usesDecal() const {
|
||||
fHWSampler.wrapModeY() == GrSamplerState::WrapMode::kClampToBorder;
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::Make(sk_sp<GrSurfaceProxy> proxy,
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::Make(GrSurfaceProxyView view,
|
||||
SkAlphaType alphaType,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerState::Filter filter) {
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new GrTextureEffect(std::move(proxy), alphaType, matrix, Sampling(filter)));
|
||||
new GrTextureEffect(std::move(view), alphaType, matrix, Sampling(filter)));
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::Make(sk_sp<GrSurfaceProxy> proxy,
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::Make(GrSurfaceProxyView view,
|
||||
SkAlphaType alphaType,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerState sampler,
|
||||
const GrCaps& caps) {
|
||||
Sampling sampling(sampler, proxy->dimensions(), caps);
|
||||
Sampling sampling(sampler, view.proxy()->dimensions(), caps);
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new GrTextureEffect(std::move(proxy), alphaType, matrix, sampling));
|
||||
new GrTextureEffect(std::move(view), alphaType, matrix, sampling));
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeTexelSubset(sk_sp<GrSurfaceProxy> proxy,
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeTexelSubset(GrSurfaceProxyView view,
|
||||
SkAlphaType alphaType,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerState sampler,
|
||||
const SkIRect& subset,
|
||||
const GrCaps& caps) {
|
||||
Sampling sampling(*proxy, sampler, SkRect::Make(subset), true, nullptr, caps);
|
||||
Sampling sampling(*view.proxy(), sampler, SkRect::Make(subset), true, nullptr, caps);
|
||||
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new GrTextureEffect(std::move(proxy), alphaType, matrix, sampling));
|
||||
new GrTextureEffect(std::move(view), alphaType, matrix, sampling));
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeTexelSubset(sk_sp<GrSurfaceProxy> proxy,
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeTexelSubset(GrSurfaceProxyView view,
|
||||
SkAlphaType alphaType,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerState sampler,
|
||||
const SkIRect& subset,
|
||||
const SkRect& domain,
|
||||
const GrCaps& caps) {
|
||||
Sampling sampling(*proxy, sampler, SkRect::Make(subset), true, &domain, caps);
|
||||
Sampling sampling(*view.proxy(), sampler, SkRect::Make(subset), true, &domain, caps);
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new GrTextureEffect(std::move(proxy), alphaType, matrix, sampling));
|
||||
new GrTextureEffect(std::move(view), alphaType, matrix, sampling));
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeSubset(sk_sp<GrSurfaceProxy> proxy,
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeSubset(GrSurfaceProxyView view,
|
||||
SkAlphaType alphaType,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerState sampler,
|
||||
const SkRect& subset,
|
||||
const GrCaps& caps) {
|
||||
Sampling sampling(*proxy, sampler, subset, false, nullptr, caps);
|
||||
Sampling sampling(*view.proxy(), sampler, subset, false, nullptr, caps);
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new GrTextureEffect(std::move(proxy), alphaType, matrix, sampling));
|
||||
new GrTextureEffect(std::move(view), alphaType, matrix, sampling));
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeSubset(sk_sp<GrSurfaceProxy> proxy,
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureEffect::MakeSubset(GrSurfaceProxyView view,
|
||||
SkAlphaType alphaType,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerState sampler,
|
||||
const SkRect& subset,
|
||||
const SkRect& domain,
|
||||
const GrCaps& caps) {
|
||||
Sampling sampling(*proxy, sampler, subset, false, &domain, caps);
|
||||
Sampling sampling(*view.proxy(), sampler, subset, false, &domain, caps);
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new GrTextureEffect(std::move(proxy), alphaType, matrix, sampling));
|
||||
new GrTextureEffect(std::move(view), alphaType, matrix, sampling));
|
||||
}
|
||||
|
||||
GrGLSLFragmentProcessor* GrTextureEffect::onCreateGLSLInstance() const {
|
||||
@ -408,12 +409,12 @@ bool GrTextureEffect::onIsEqual(const GrFragmentProcessor& other) const {
|
||||
fSubset == that.fSubset;
|
||||
}
|
||||
|
||||
GrTextureEffect::GrTextureEffect(sk_sp<GrSurfaceProxy> texture, SkAlphaType alphaType,
|
||||
GrTextureEffect::GrTextureEffect(GrSurfaceProxyView view, SkAlphaType alphaType,
|
||||
const SkMatrix& matrix, const Sampling& sampling)
|
||||
: GrFragmentProcessor(kGrTextureEffect_ClassID,
|
||||
ModulateForSamplerOptFlags(alphaType, sampling.usesDecal()))
|
||||
, fCoordTransform(matrix, texture.get())
|
||||
, fSampler(std::move(texture), sampling.fHWSampler)
|
||||
, fCoordTransform(matrix, view.proxy())
|
||||
, fSampler(std::move(view), sampling.fHWSampler)
|
||||
, fSubset(sampling.fShaderSubset)
|
||||
, fShaderModes{sampling.fShaderModes[0], sampling.fShaderModes[1]} {
|
||||
// We always compare the range even when it isn't used so assert we have canonical don't care
|
||||
@ -460,6 +461,9 @@ std::unique_ptr<GrFragmentProcessor> GrTextureEffect::TestCreate(GrProcessorTest
|
||||
: GrSamplerState::Filter::kNearest);
|
||||
|
||||
const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom);
|
||||
return GrTextureEffect::Make(std::move(proxy), at, matrix, params, *testData->caps());
|
||||
GrSurfaceOrigin origin = proxy->origin();
|
||||
GrSwizzle swizzle = proxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
|
||||
return GrTextureEffect::Make(std::move(view), at, matrix, params, *testData->caps());
|
||||
}
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@ class GrTextureEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
/** Make from a filter. The sampler will be configured with clamp mode. */
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(
|
||||
sk_sp<GrSurfaceProxy>,
|
||||
GrSurfaceProxyView,
|
||||
SkAlphaType,
|
||||
const SkMatrix& = SkMatrix::I(),
|
||||
GrSamplerState::Filter = GrSamplerState::Filter::kNearest);
|
||||
@ -26,11 +26,8 @@ public:
|
||||
* Make from a full GrSamplerState. Caps are required to determine support for kClampToBorder.
|
||||
* This will be emulated in the shader if there is no hardware support.
|
||||
*/
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrSurfaceProxy>,
|
||||
SkAlphaType,
|
||||
const SkMatrix&,
|
||||
GrSamplerState,
|
||||
const GrCaps& caps);
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(
|
||||
GrSurfaceProxyView, SkAlphaType, const SkMatrix&, GrSamplerState, const GrCaps& caps);
|
||||
|
||||
/**
|
||||
* Makes a texture effect that samples a subset of a texture. The wrap modes of the
|
||||
@ -42,7 +39,7 @@ public:
|
||||
* outside the window. More specifically, we treat the MIP map case exactly like the
|
||||
* bilerp case in terms of how the final texture coords are computed.
|
||||
*/
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeTexelSubset(sk_sp<GrSurfaceProxy>,
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeTexelSubset(GrSurfaceProxyView,
|
||||
SkAlphaType,
|
||||
const SkMatrix&,
|
||||
GrSamplerState,
|
||||
@ -54,7 +51,7 @@ public:
|
||||
* knowledge of how this effect will be nested into a paint, the local coords used with the
|
||||
* draw, etc. It is only used to attempt to optimize away the shader subset calculations.
|
||||
*/
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeTexelSubset(sk_sp<GrSurfaceProxy>,
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeTexelSubset(GrSurfaceProxyView,
|
||||
SkAlphaType,
|
||||
const SkMatrix&,
|
||||
GrSamplerState,
|
||||
@ -68,7 +65,7 @@ public:
|
||||
* unmodified subset. The subset should be unnormalized. The effect will apply texture
|
||||
* coordinate normalization after subset restriction (logically).
|
||||
*/
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeSubset(sk_sp<GrSurfaceProxy>,
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeSubset(GrSurfaceProxyView,
|
||||
SkAlphaType,
|
||||
const SkMatrix&,
|
||||
GrSamplerState,
|
||||
@ -81,7 +78,7 @@ public:
|
||||
* knowledge of how this effect will be nested into a paint, the local coords used with the
|
||||
* draw, etc. It is only used to attempt to optimize away the shader subset calculations.
|
||||
*/
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeSubset(sk_sp<GrSurfaceProxy>,
|
||||
static std::unique_ptr<GrFragmentProcessor> MakeSubset(GrSurfaceProxyView,
|
||||
SkAlphaType,
|
||||
const SkMatrix&,
|
||||
GrSamplerState,
|
||||
@ -122,7 +119,7 @@ private:
|
||||
SkRect fSubset;
|
||||
ShaderMode fShaderModes[2];
|
||||
|
||||
inline GrTextureEffect(sk_sp<GrSurfaceProxy>, SkAlphaType, const SkMatrix&, const Sampling&);
|
||||
inline GrTextureEffect(GrSurfaceProxyView, SkAlphaType, const SkMatrix&, const Sampling&);
|
||||
|
||||
GrTextureEffect(const GrTextureEffect& src);
|
||||
|
||||
|
@ -65,16 +65,19 @@ std::unique_ptr<GrFragmentProcessor> GrYUVtoRGBEffect::Make(const sk_sp<GrTextur
|
||||
planeDomain = *domain;
|
||||
}
|
||||
|
||||
GrSurfaceOrigin origin = proxies[i]->origin();
|
||||
GrSwizzle swizzle = proxies[i]->textureSwizzle();
|
||||
GrSurfaceProxyView view(proxies[i], origin, swizzle);
|
||||
if (domain) {
|
||||
SkASSERT(planeFilter != GrSamplerState::Filter::kMipMap);
|
||||
if (planeFilter != GrSamplerState::Filter::kNearest) {
|
||||
// Inset by half a pixel for bilerp, after scaling to the size of the plane
|
||||
planeDomain.inset(0.5f, 0.5f);
|
||||
}
|
||||
planeFPs[i] = GrTextureEffect::MakeSubset(proxies[i], kUnknown_SkAlphaType,
|
||||
planeFPs[i] = GrTextureEffect::MakeSubset(std::move(view), kUnknown_SkAlphaType,
|
||||
*planeMatrix, planeFilter, planeDomain, caps);
|
||||
} else {
|
||||
planeFPs[i] = GrTextureEffect::Make(proxies[i], kUnknown_SkAlphaType, *planeMatrix,
|
||||
planeFPs[i] = GrTextureEffect::Make(std::move(view), kUnknown_SkAlphaType, *planeMatrix,
|
||||
planeFilter);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
new GrConfigConversionEffect(PMConversion::kToPremul));
|
||||
|
||||
paint1.addColorFragmentProcessor(
|
||||
GrTextureEffect::Make(dataView.detachProxy(), kPremul_SkAlphaType));
|
||||
GrTextureEffect::Make(std::move(dataView), kPremul_SkAlphaType));
|
||||
paint1.addColorFragmentProcessor(pmToUPM->clone());
|
||||
paint1.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
||||
@ -105,7 +105,7 @@ public:
|
||||
tempRTC->discard();
|
||||
|
||||
paint2.addColorFragmentProcessor(
|
||||
GrTextureEffect::Make(readRTC->asTextureProxyRef(), kUnpremul_SkAlphaType));
|
||||
GrTextureEffect::Make(readRTC->readSurfaceView(), kUnpremul_SkAlphaType));
|
||||
paint2.addColorFragmentProcessor(std::move(upmToPM));
|
||||
paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
||||
@ -113,7 +113,7 @@ public:
|
||||
kRect);
|
||||
|
||||
paint3.addColorFragmentProcessor(
|
||||
GrTextureEffect::Make(tempRTC->asTextureProxyRef(), kPremul_SkAlphaType));
|
||||
GrTextureEffect::Make(tempRTC->readSurfaceView(), kPremul_SkAlphaType));
|
||||
paint3.addColorFragmentProcessor(std::move(pmToUPM));
|
||||
paint3.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
||||
|
@ -1069,7 +1069,6 @@ std::unique_ptr<GrDrawOp> GrTextureOp::Make(GrRecordingContext* context,
|
||||
paint.setColor4f(color);
|
||||
paint.setXPFactory(SkBlendMode_AsXPFactory(blendMode));
|
||||
|
||||
GrSurfaceProxy* proxy = proxyView.proxy();
|
||||
std::unique_ptr<GrFragmentProcessor> fp;
|
||||
if (domain) {
|
||||
// Update domain to match what GrTextureOp would do for bilerp, but don't do any
|
||||
@ -1078,14 +1077,14 @@ std::unique_ptr<GrDrawOp> GrTextureOp::Make(GrRecordingContext* context,
|
||||
const auto& caps = *context->priv().caps();
|
||||
SkRect localRect;
|
||||
if (localQuad.asRect(&localRect)) {
|
||||
fp = GrTextureEffect::MakeSubset(sk_ref_sp(proxy), alphaType, SkMatrix::I(), filter,
|
||||
correctedDomain, localRect, caps);
|
||||
fp = GrTextureEffect::MakeSubset(std::move(proxyView), alphaType, SkMatrix::I(),
|
||||
filter, correctedDomain, localRect, caps);
|
||||
} else {
|
||||
fp = GrTextureEffect::MakeSubset(sk_ref_sp(proxy), alphaType, SkMatrix::I(), filter,
|
||||
correctedDomain, caps);
|
||||
fp = GrTextureEffect::MakeSubset(std::move(proxyView), alphaType, SkMatrix::I(),
|
||||
filter, correctedDomain, caps);
|
||||
}
|
||||
} else {
|
||||
fp = GrTextureEffect::Make(sk_ref_sp(proxy), alphaType, SkMatrix::I(), filter);
|
||||
fp = GrTextureEffect::Make(std::move(proxyView), alphaType, SkMatrix::I(), filter);
|
||||
}
|
||||
fp = GrColorSpaceXformEffect::Make(std::move(fp), std::move(textureXform));
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
@ -1093,8 +1092,8 @@ std::unique_ptr<GrDrawOp> GrTextureOp::Make(GrRecordingContext* context,
|
||||
paint.addColorFragmentProcessor(GrClampFragmentProcessor::Make(false));
|
||||
}
|
||||
|
||||
return GrFillRectOp::Make(context, std::move(paint), aaType, aaFlags,
|
||||
deviceQuad, localQuad);
|
||||
return GrFillRectOp::Make(context, std::move(paint), aaType, aaFlags, deviceQuad,
|
||||
localQuad);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,7 @@ sk_sp<SkImage> SkImage_Gpu::onMakeColorTypeAndColorSpace(GrRecordingContext* con
|
||||
|
||||
GrPaint paint;
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
sk_sp<GrTextureProxy> proxy = this->asTextureProxyRef(context);
|
||||
paint.addColorFragmentProcessor(GrTextureEffect::Make(std::move(proxy), this->alphaType()));
|
||||
paint.addColorFragmentProcessor(GrTextureEffect::Make(*this->view(context), this->alphaType()));
|
||||
if (xform) {
|
||||
paint.addColorFragmentProcessor(std::move(xform));
|
||||
}
|
||||
|
@ -247,8 +247,10 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
|
||||
inner = GrBicubicEffect::Make(std::move(proxy), lmInverse, wrapModes, domainX, domainY,
|
||||
kDir, srcAlphaType);
|
||||
} else {
|
||||
inner = GrTextureEffect::Make(std::move(proxy), srcAlphaType, lmInverse, samplerState,
|
||||
caps);
|
||||
GrSurfaceOrigin origin = proxy->origin();
|
||||
GrSwizzle swizzle = proxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
|
||||
inner = GrTextureEffect::Make(std::move(view), srcAlphaType, lmInverse, samplerState, caps);
|
||||
}
|
||||
inner = GrColorSpaceXformEffect::Make(std::move(inner), fImage->colorSpace(), srcAlphaType,
|
||||
args.fDstColorInfo->colorSpace());
|
||||
|
@ -168,8 +168,11 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
|
||||
cleanup(glCtx0, externalTexture.fID, glCtx1.get(), context1, &backendTexture1, image);
|
||||
return;
|
||||
}
|
||||
auto surfaceContext = GrSurfaceContext::Make(context0, std::move(texProxy), colorType,
|
||||
alphaType, nullptr);
|
||||
GrSwizzle swizzle =
|
||||
context0->priv().caps()->getReadSwizzle(texProxy->backendFormat(), colorType);
|
||||
GrSurfaceProxyView view(std::move(texProxy), origin, swizzle);
|
||||
auto surfaceContext =
|
||||
GrSurfaceContext::Make(context0, std::move(view), colorType, alphaType, nullptr);
|
||||
|
||||
if (!surfaceContext) {
|
||||
ERRORF(reporter, "Error wrapping external texture in GrSurfaceContext.");
|
||||
|
@ -446,10 +446,13 @@ static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject
|
||||
|
||||
rtc->clear(nullptr, { 1, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes);
|
||||
|
||||
GrSurfaceOrigin origin = atlasProxy->origin();
|
||||
GrSwizzle swizzle = atlasProxy->textureSwizzle();
|
||||
GrSurfaceProxyView atlasView(std::move(atlasProxy), origin, swizzle);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
SkRect r = SkRect::MakeXYWH(i*kDrawnTileSize, 0, kDrawnTileSize, kDrawnTileSize);
|
||||
|
||||
auto fp = GrTextureEffect::Make(atlasProxy, atlasAlphaType);
|
||||
auto fp = GrTextureEffect::Make(atlasView, atlasAlphaType);
|
||||
GrPaint paint;
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -568,7 +571,10 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
|
||||
SkMatrix t = SkMatrix::MakeTrans(-i*3*kDrawnTileSize, 0);
|
||||
|
||||
GrPaint paint;
|
||||
auto fp = GrTextureEffect::Make(std::move(proxies[i]), kPremul_SkAlphaType, t);
|
||||
GrSurfaceOrigin origin = proxies[i]->origin();
|
||||
GrSwizzle swizzle = proxies[i]->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(proxies[i]), origin, swizzle);
|
||||
auto fp = GrTextureEffect::Make(std::move(view), kPremul_SkAlphaType, t);
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
|
||||
|
@ -237,8 +237,10 @@ void test_draw_op(GrContext* context,
|
||||
sk_sp<GrTextureProxy> inputDataProxy,
|
||||
SkAlphaType inputAlphaType) {
|
||||
GrPaint paint;
|
||||
paint.addColorFragmentProcessor(
|
||||
GrTextureEffect::Make(std::move(inputDataProxy), inputAlphaType));
|
||||
GrSurfaceOrigin origin = inputDataProxy->origin();
|
||||
GrSwizzle swizzle = inputDataProxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(inputDataProxy), origin, swizzle);
|
||||
paint.addColorFragmentProcessor(GrTextureEffect::Make(std::move(view), inputAlphaType));
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
||||
|
@ -32,12 +32,15 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont
|
||||
SkAlphaType alphaType, uint32_t expectedPixelValues[]) {
|
||||
auto rtContext = GrRenderTargetContext::Make(
|
||||
context, colorType, nullptr, SkBackingFit::kExact, rectProxy->dimensions());
|
||||
GrSurfaceOrigin origin = rectProxy->origin();
|
||||
GrSwizzle swizzle = rectProxy->textureSwizzle();
|
||||
GrSurfaceProxyView view(std::move(rectProxy), origin, swizzle);
|
||||
for (auto filter : {GrSamplerState::Filter::kNearest,
|
||||
GrSamplerState::Filter::kBilerp,
|
||||
GrSamplerState::Filter::kMipMap}) {
|
||||
rtContext->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xDDCCBBAA),
|
||||
GrRenderTargetContext::CanClearFullscreen::kYes);
|
||||
auto fp = GrTextureEffect::Make(rectProxy, alphaType, SkMatrix::I(), filter);
|
||||
auto fp = GrTextureEffect::Make(view, alphaType, SkMatrix::I(), filter);
|
||||
GrPaint paint;
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
|
Loading…
Reference in New Issue
Block a user