Retract GrContext from src/gpu/effects
Change-Id: Iceb7263098286bafb2605ef17d1fe6bb25d71e97 Reviewed-on: https://skia-review.googlesource.com/9693 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
e0d4fbac00
commit
296b1ccf9b
@ -88,7 +88,7 @@ protected:
|
||||
|
||||
const SkMatrix trans = SkMatrix::MakeTrans(-kPad, -kPad);
|
||||
|
||||
sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make(context,
|
||||
sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make(context->resourceProvider(),
|
||||
std::move(proxy),
|
||||
nullptr, trans);
|
||||
|
||||
|
@ -117,7 +117,7 @@ DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
|
||||
} else {
|
||||
vm.reset();
|
||||
}
|
||||
paint.addColorTextureProcessor(context, tContext->asTextureProxyRef(),
|
||||
paint.addColorTextureProcessor(context->resourceProvider(), tContext->asTextureProxyRef(),
|
||||
nullptr, vm);
|
||||
|
||||
renderTargetContext->drawRect(clip, GrPaint(paint), GrAA::kNo, vm,
|
||||
|
@ -123,7 +123,7 @@ protected:
|
||||
grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
|
||||
sk_sp<GrFragmentProcessor> fp(
|
||||
GrTextureDomainEffect::Make(
|
||||
context, proxy,
|
||||
context->resourceProvider(), proxy,
|
||||
nullptr, textureMatrices[tm],
|
||||
GrTextureDomain::MakeTexelDomainForMode(texelDomains[d], mode),
|
||||
mode, GrSamplerParams::kNone_FilterMode));
|
||||
|
@ -149,9 +149,9 @@ private:
|
||||
*/
|
||||
class AlphaOnlyClip final : public MaskOnlyClipBase {
|
||||
public:
|
||||
AlphaOnlyClip(GrContext* context, sk_sp<GrTextureProxy> mask, int x, int y) {
|
||||
AlphaOnlyClip(GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> mask, int x, int y) {
|
||||
int w = mask->width(), h = mask->height();
|
||||
fFP = GrDeviceSpaceTextureDecalFragmentProcessor::Make(context, std::move(mask),
|
||||
fFP = GrDeviceSpaceTextureDecalFragmentProcessor::Make(resourceProvider, std::move(mask),
|
||||
SkIRect::MakeWH(w, h), {x, y});
|
||||
}
|
||||
private:
|
||||
@ -225,7 +225,7 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetCo
|
||||
// Now visualize the alpha mask by drawing a rect over the area where it is defined. The regions
|
||||
// inside window rectangles or outside the scissor should still have the initial checkerboard
|
||||
// intact. (This verifies we didn't spend any time modifying those pixels in the mask.)
|
||||
AlphaOnlyClip clip(ctx, maskRTC->asTextureProxyRef(), x, y);
|
||||
AlphaOnlyClip clip(ctx->resourceProvider(), maskRTC->asTextureProxyRef(), x, y);
|
||||
rtc->drawRect(clip, std::move(paint), GrAA::kYes, SkMatrix::I(),
|
||||
SkRect::Make(SkIRect::MakeXYWH(x, y, maskRTC->width(), maskRTC->height())));
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ protected:
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
sk_sp<GrFragmentProcessor> fp(
|
||||
GrYUVEffect::MakeYUVToRGB(context,
|
||||
GrYUVEffect::MakeYUVToRGB(context->resourceProvider(),
|
||||
proxy[indices[i][0]],
|
||||
proxy[indices[i][1]],
|
||||
proxy[indices[i][2]],
|
||||
@ -250,8 +250,9 @@ protected:
|
||||
GrPaint grPaint;
|
||||
grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
|
||||
sk_sp<GrFragmentProcessor> fp(
|
||||
GrYUVEffect::MakeYUVToRGB(context, proxy[0], proxy[1], proxy[2],
|
||||
sizes, static_cast<SkYUVColorSpace>(space), true));
|
||||
GrYUVEffect::MakeYUVToRGB(context->resourceProvider(),
|
||||
proxy[0], proxy[1], proxy[2], sizes,
|
||||
static_cast<SkYUVColorSpace>(space), true));
|
||||
if (fp) {
|
||||
SkMatrix viewMatrix;
|
||||
viewMatrix.setTranslate(x, y);
|
||||
|
@ -41,11 +41,11 @@ public:
|
||||
this->reset(SkMatrix::I(), texture, filter);
|
||||
}
|
||||
|
||||
GrCoordTransform(GrContext* context, GrTextureProxy* proxy,
|
||||
GrCoordTransform(GrResourceProvider* resourceProvider, GrTextureProxy* proxy,
|
||||
GrSamplerParams::FilterMode filter) {
|
||||
SkASSERT(proxy);
|
||||
SkDEBUGCODE(fInProcessor = false);
|
||||
this->reset(context, SkMatrix::I(), proxy, filter);
|
||||
this->reset(resourceProvider, SkMatrix::I(), proxy, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,11 +59,11 @@ public:
|
||||
this->reset(m, texture, filter);
|
||||
}
|
||||
|
||||
GrCoordTransform(GrContext* context, const SkMatrix& m, GrTextureProxy* proxy,
|
||||
GrSamplerParams::FilterMode filter) {
|
||||
GrCoordTransform(GrResourceProvider* resourceProvider, const SkMatrix& m,
|
||||
GrTextureProxy* proxy, GrSamplerParams::FilterMode filter) {
|
||||
SkASSERT(proxy);
|
||||
SkDEBUGCODE(fInProcessor = false);
|
||||
this->reset(context, m, proxy, filter);
|
||||
this->reset(resourceProvider, m, proxy, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ public:
|
||||
void reset(const SkMatrix&, const GrTexture*, GrSamplerParams::FilterMode filter,
|
||||
bool normalize = true);
|
||||
|
||||
void reset(GrContext* context, const SkMatrix&, GrTextureProxy*,
|
||||
void reset(GrResourceProvider*, const SkMatrix&, GrTextureProxy*,
|
||||
GrSamplerParams::FilterMode filter, bool normalize = true);
|
||||
|
||||
void reset(const SkMatrix& m, GrSLPrecision precision = kDefault_GrSLPrecision) {
|
||||
|
@ -60,6 +60,8 @@ struct GrProcessorTestData {
|
||||
const GrRenderTargetContext* fRenderTargetContext;
|
||||
|
||||
GrContext* context() { return fContext; }
|
||||
GrResourceProvider* resourceProvider();
|
||||
const GrCaps* caps();
|
||||
sk_sp<GrTextureProxy> textureProxy(int index) { return fProxies[index]; }
|
||||
|
||||
private:
|
||||
|
@ -66,8 +66,7 @@ static float adjust_sigma(float sigma, int maxTextureSize, int *scaleFactor, int
|
||||
return sigma;
|
||||
}
|
||||
|
||||
static void convolve_gaussian_1d(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
static void convolve_gaussian_1d(GrRenderTargetContext* renderTargetContext,
|
||||
const GrClip& clip,
|
||||
const SkIRect& dstRect,
|
||||
const SkIPoint& srcOffset,
|
||||
@ -79,8 +78,11 @@ static void convolve_gaussian_1d(GrContext* context,
|
||||
int bounds[2]) {
|
||||
GrPaint paint;
|
||||
paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
|
||||
|
||||
GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
|
||||
|
||||
sk_sp<GrFragmentProcessor> conv(GrGaussianConvolutionFragmentProcessor::Make(
|
||||
context, std::move(proxy), direction, radius, sigma, useBounds, bounds));
|
||||
resourceProvider, std::move(proxy), direction, radius, sigma, useBounds, bounds));
|
||||
paint.addColorFragmentProcessor(std::move(conv));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
SkMatrix localMatrix = SkMatrix::MakeTrans(-SkIntToScalar(srcOffset.x()),
|
||||
@ -89,8 +91,7 @@ static void convolve_gaussian_1d(GrContext* context,
|
||||
SkRect::Make(dstRect), localMatrix);
|
||||
}
|
||||
|
||||
static void convolve_gaussian_2d(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
static void convolve_gaussian_2d(GrRenderTargetContext* renderTargetContext,
|
||||
const GrClip& clip,
|
||||
const SkIRect& dstRect,
|
||||
const SkIPoint& srcOffset,
|
||||
@ -108,8 +109,10 @@ static void convolve_gaussian_2d(GrContext* context,
|
||||
paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
|
||||
SkIRect bounds = srcBounds ? *srcBounds : SkIRect::EmptyIRect();
|
||||
|
||||
GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
|
||||
|
||||
sk_sp<GrFragmentProcessor> conv(GrMatrixConvolutionEffect::MakeGaussian(
|
||||
context, std::move(proxy), bounds, size, 1.0, 0.0, kernelOffset,
|
||||
resourceProvider, std::move(proxy), bounds, size, 1.0, 0.0, kernelOffset,
|
||||
srcBounds ? GrTextureDomain::kDecal_Mode : GrTextureDomain::kIgnore_Mode,
|
||||
true, sigmaX, sigmaY));
|
||||
paint.addColorFragmentProcessor(std::move(conv));
|
||||
@ -118,8 +121,7 @@ static void convolve_gaussian_2d(GrContext* context,
|
||||
SkRect::Make(dstRect), localMatrix);
|
||||
}
|
||||
|
||||
static void convolve_gaussian(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
static void convolve_gaussian(GrRenderTargetContext* renderTargetContext,
|
||||
const GrClip& clip,
|
||||
const SkIRect& srcRect,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
@ -131,7 +133,7 @@ static void convolve_gaussian(GrContext* context,
|
||||
int bounds[2] = { 0, 0 };
|
||||
SkIRect dstRect = SkIRect::MakeWH(srcRect.width(), srcRect.height());
|
||||
if (!srcBounds) {
|
||||
convolve_gaussian_1d(context, renderTargetContext, clip, dstRect, srcOffset,
|
||||
convolve_gaussian_1d(renderTargetContext, clip, dstRect, srcOffset,
|
||||
std::move(proxy), direction, radius, sigma, false, bounds);
|
||||
return;
|
||||
}
|
||||
@ -170,15 +172,15 @@ static void convolve_gaussian(GrContext* context,
|
||||
}
|
||||
if (midRect.isEmpty()) {
|
||||
// Blur radius covers srcBounds; use bounds over entire draw
|
||||
convolve_gaussian_1d(context, renderTargetContext, clip, dstRect, srcOffset,
|
||||
convolve_gaussian_1d(renderTargetContext, clip, dstRect, srcOffset,
|
||||
std::move(proxy), direction, radius, sigma, true, bounds);
|
||||
} else {
|
||||
// Draw right and left margins with bounds; middle without.
|
||||
convolve_gaussian_1d(context, renderTargetContext, clip, leftRect, srcOffset,
|
||||
convolve_gaussian_1d(renderTargetContext, clip, leftRect, srcOffset,
|
||||
proxy, direction, radius, sigma, true, bounds);
|
||||
convolve_gaussian_1d(context, renderTargetContext, clip, rightRect, srcOffset,
|
||||
convolve_gaussian_1d(renderTargetContext, clip, rightRect, srcOffset,
|
||||
proxy, direction, radius, sigma, true, bounds);
|
||||
convolve_gaussian_1d(context, renderTargetContext, clip, midRect, srcOffset,
|
||||
convolve_gaussian_1d(renderTargetContext, clip, midRect, srcOffset,
|
||||
std::move(proxy), direction, radius, sigma, false, bounds);
|
||||
}
|
||||
}
|
||||
@ -253,7 +255,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
|
||||
// We shouldn't be scaling because this is a small size blur
|
||||
SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY));
|
||||
|
||||
convolve_gaussian_2d(context, dstRenderTargetContext.get(), clip, localDstBounds, srcOffset,
|
||||
convolve_gaussian_2d(dstRenderTargetContext.get(), clip, localDstBounds, srcOffset,
|
||||
std::move(srcProxy), radiusX, radiusY, sigmaX, sigmaY, srcBounds);
|
||||
|
||||
return dstRenderTargetContext;
|
||||
@ -278,7 +280,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
|
||||
domain.inset((i < scaleFactorX) ? SK_ScalarHalf : 0.0f,
|
||||
(i < scaleFactorY) ? SK_ScalarHalf : 0.0f);
|
||||
sk_sp<GrFragmentProcessor> fp(GrTextureDomainEffect::Make(
|
||||
context,
|
||||
context->resourceProvider(),
|
||||
std::move(srcProxy),
|
||||
nullptr,
|
||||
SkMatrix::I(),
|
||||
@ -290,8 +292,8 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
|
||||
srcOffset.set(0, 0);
|
||||
} else {
|
||||
GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode);
|
||||
paint.addColorTextureProcessor(context, std::move(srcProxy), nullptr,
|
||||
SkMatrix::I(), params);
|
||||
paint.addColorTextureProcessor(context->resourceProvider(), std::move(srcProxy),
|
||||
nullptr, SkMatrix::I(), params);
|
||||
}
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
shrink_irect_by_2(&dstRect, i < scaleFactorX, i < scaleFactorY);
|
||||
@ -322,7 +324,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
|
||||
srcRenderTargetContext->priv().absClear(&clearRect, 0x0);
|
||||
}
|
||||
|
||||
convolve_gaussian(context, dstRenderTargetContext.get(), clip, srcRect,
|
||||
convolve_gaussian(dstRenderTargetContext.get(), clip, srcRect,
|
||||
std::move(srcProxy), Gr1DKernelEffect::kX_Direction, radiusX, sigmaX,
|
||||
srcBounds, srcOffset);
|
||||
srcRenderTargetContext = dstRenderTargetContext;
|
||||
@ -347,7 +349,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
|
||||
srcRenderTargetContext->priv().absClear(&clearRect, 0x0);
|
||||
}
|
||||
|
||||
convolve_gaussian(context, dstRenderTargetContext.get(), clip, srcRect,
|
||||
convolve_gaussian(dstRenderTargetContext.get(), clip, srcRect,
|
||||
std::move(srcProxy), Gr1DKernelEffect::kY_Direction, radiusY, sigmaY,
|
||||
srcBounds, srcOffset);
|
||||
|
||||
@ -377,7 +379,8 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
paint.addColorTextureProcessor(context, std::move(proxy), nullptr, SkMatrix::I(), params);
|
||||
paint.addColorTextureProcessor(context->resourceProvider(), std::move(proxy),
|
||||
nullptr, SkMatrix::I(), params);
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
|
||||
SkIRect dstRect(srcRect);
|
||||
|
@ -27,7 +27,7 @@ inline GrFragmentProcessor::OptimizationFlags GrAlphaThresholdFragmentProcessor:
|
||||
}
|
||||
|
||||
GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
sk_sp<GrTextureProxy> maskProxy,
|
||||
@ -37,16 +37,16 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
|
||||
: INHERITED(OptFlags(outerThreshold))
|
||||
, fInnerThreshold(innerThreshold)
|
||||
, fOuterThreshold(outerThreshold)
|
||||
, fImageCoordTransform(context, SkMatrix::I(), proxy.get(),
|
||||
, fImageCoordTransform(resourceProvider, SkMatrix::I(), proxy.get(),
|
||||
GrSamplerParams::kNone_FilterMode)
|
||||
, fImageTextureSampler(context->resourceProvider(), std::move(proxy))
|
||||
, fImageTextureSampler(resourceProvider, std::move(proxy))
|
||||
, fColorSpaceXform(std::move(colorSpaceXform))
|
||||
, fMaskCoordTransform(
|
||||
context,
|
||||
resourceProvider,
|
||||
SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
|
||||
maskProxy.get(),
|
||||
GrSamplerParams::kNone_FilterMode)
|
||||
, fMaskTextureSampler(context->resourceProvider(), maskProxy) {
|
||||
, fMaskTextureSampler(resourceProvider, maskProxy) {
|
||||
this->initClassID<GrAlphaThresholdFragmentProcessor>();
|
||||
this->addCoordTransform(&fImageCoordTransform);
|
||||
this->addTextureSampler(&fImageTextureSampler);
|
||||
@ -162,7 +162,7 @@ sk_sp<GrFragmentProcessor> GrAlphaThresholdFragmentProcessor::TestCreate(GrProce
|
||||
uint32_t y = d->fRandom->nextULessThan(kMaxHeight - height);
|
||||
SkIRect bounds = SkIRect::MakeXYWH(x, y, width, height);
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom);
|
||||
return GrAlphaThresholdFragmentProcessor::Make(d->context(),
|
||||
return GrAlphaThresholdFragmentProcessor::Make(d->resourceProvider(),
|
||||
std::move(bmpProxy),
|
||||
std::move(colorSpaceXform),
|
||||
std::move(maskProxy),
|
||||
|
@ -20,7 +20,7 @@
|
||||
class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor {
|
||||
|
||||
public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
sk_sp<GrTextureProxy> maskProxy,
|
||||
@ -28,7 +28,7 @@ public:
|
||||
float outerThreshold,
|
||||
const SkIRect& bounds) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor(
|
||||
context,
|
||||
resourceProvider,
|
||||
std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
std::move(maskProxy),
|
||||
@ -46,7 +46,7 @@ public:
|
||||
private:
|
||||
static OptimizationFlags OptFlags(float outerThreshold);
|
||||
|
||||
GrAlphaThresholdFragmentProcessor(GrContext*,
|
||||
GrAlphaThresholdFragmentProcessor(GrResourceProvider*,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
sk_sp<GrTextureProxy> maskProxy,
|
||||
|
@ -355,7 +355,7 @@ sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
|
||||
SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f);
|
||||
SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f);
|
||||
SkRect circle = SkRect::MakeWH(wh, wh);
|
||||
return GrCircleBlurFragmentProcessor::Make(d->context()->resourceProvider(), circle, sigma);
|
||||
return GrCircleBlurFragmentProcessor::Make(d->resourceProvider(), circle, sigma);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -171,7 +171,7 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage*
|
||||
outProps.colorSpace());
|
||||
|
||||
sk_sp<GrFragmentProcessor> fp(GrAlphaThresholdFragmentProcessor::Make(
|
||||
context,
|
||||
context->resourceProvider(),
|
||||
std::move(inputProxy),
|
||||
std::move(colorSpaceXform),
|
||||
std::move(maskProxy),
|
||||
|
@ -356,8 +356,8 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
|
||||
sk_sp<GrColorSpaceXform> bgXform =
|
||||
GrColorSpaceXform::Make(background->getColorSpace(), outputProperties.colorSpace());
|
||||
bgFP = GrTextureDomainEffect::Make(
|
||||
context, std::move(backgroundProxy), std::move(bgXform), backgroundMatrix,
|
||||
GrTextureDomain::MakeTexelDomain(background->subset()),
|
||||
context->resourceProvider(), std::move(backgroundProxy), std::move(bgXform),
|
||||
backgroundMatrix, GrTextureDomain::MakeTexelDomain(background->subset()),
|
||||
GrTextureDomain::kDecal_Mode, GrSamplerParams::kNone_FilterMode);
|
||||
} else {
|
||||
bgFP = GrConstColorProcessor::Make(GrColor4f::TransparentBlack(),
|
||||
@ -372,8 +372,8 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
|
||||
sk_sp<GrFragmentProcessor> foregroundFP;
|
||||
|
||||
foregroundFP = GrTextureDomainEffect::Make(
|
||||
context, std::move(foregroundProxy), std::move(fgXform), foregroundMatrix,
|
||||
GrTextureDomain::MakeTexelDomain(foreground->subset()),
|
||||
context->resourceProvider(), std::move(foregroundProxy), std::move(fgXform),
|
||||
foregroundMatrix, GrTextureDomain::MakeTexelDomain(foreground->subset()),
|
||||
GrTextureDomain::kDecal_Mode, GrSamplerParams::kNone_FilterMode);
|
||||
|
||||
paint.addColorFragmentProcessor(std::move(foregroundFP));
|
||||
|
@ -1011,7 +1011,7 @@ sk_sp<GrFragmentProcessor> GrRectBlurEffect::TestCreate(GrProcessorTestData* d)
|
||||
float sigma = d->fRandom->nextRangeF(3,8);
|
||||
float width = d->fRandom->nextRangeF(200,300);
|
||||
float height = d->fRandom->nextRangeF(200,300);
|
||||
return GrRectBlurEffect::Make(d->context()->resourceProvider(),
|
||||
return GrRectBlurEffect::Make(d->resourceProvider(),
|
||||
SkRect::MakeWH(width, height), sigma);
|
||||
}
|
||||
#endif
|
||||
@ -1519,8 +1519,9 @@ sk_sp<GrTextureProxy> SkBlurMaskFilterImpl::filterMaskGPU(GrContext* context,
|
||||
if (!isNormalBlur) {
|
||||
GrPaint paint;
|
||||
// Blend pathTexture over blurTexture.
|
||||
paint.addCoverageFragmentProcessor(
|
||||
GrSimpleTextureEffect::Make(context, std::move(srcProxy), nullptr, SkMatrix::I()));
|
||||
paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(context->resourceProvider(),
|
||||
std::move(srcProxy),
|
||||
nullptr, SkMatrix::I()));
|
||||
if (kInner_SkBlurStyle == fBlurStyle) {
|
||||
// inner: dst = dst * src
|
||||
paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op);
|
||||
|
@ -213,14 +213,15 @@ void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const {
|
||||
#if SK_SUPPORT_GPU
|
||||
class GrDisplacementMapEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(
|
||||
GrResourceProvider* resourceProvider,
|
||||
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
|
||||
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVector scale,
|
||||
sk_sp<GrTextureProxy> displacement, const SkMatrix& offsetMatrix,
|
||||
sk_sp<GrTextureProxy> color,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform, const SkISize& colorDimensions) {
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrDisplacementMapEffect(context, xChannelSelector, yChannelSelector, scale,
|
||||
new GrDisplacementMapEffect(resourceProvider, xChannelSelector, yChannelSelector, scale,
|
||||
std::move(displacement),
|
||||
offsetMatrix, std::move(color), std::move(colorSpaceXform),
|
||||
colorDimensions));
|
||||
@ -247,7 +248,7 @@ private:
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
GrDisplacementMapEffect(GrContext*,
|
||||
GrDisplacementMapEffect(GrResourceProvider*,
|
||||
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
|
||||
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
|
||||
const SkVector& scale,
|
||||
@ -339,7 +340,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
|
||||
colorSpace);
|
||||
GrPaint paint;
|
||||
paint.addColorFragmentProcessor(
|
||||
GrDisplacementMapEffect::Make(context,
|
||||
GrDisplacementMapEffect::Make(context->resourceProvider(),
|
||||
fXChannelSelector,
|
||||
fYChannelSelector,
|
||||
scale,
|
||||
@ -484,7 +485,7 @@ void GrDisplacementMapEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
|
||||
}
|
||||
|
||||
GrDisplacementMapEffect::GrDisplacementMapEffect(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
|
||||
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
|
||||
const SkVector& scale,
|
||||
@ -495,13 +496,13 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(
|
||||
const SkISize& colorDimensions)
|
||||
: INHERITED(GrPixelConfigIsOpaque(color->config()) ? kPreservesOpaqueInput_OptimizationFlag
|
||||
: kNone_OptimizationFlags)
|
||||
, fDisplacementTransform(context, offsetMatrix, displacement.get(),
|
||||
, fDisplacementTransform(resourceProvider, offsetMatrix, displacement.get(),
|
||||
GrSamplerParams::kNone_FilterMode)
|
||||
, fDisplacementSampler(context->resourceProvider(), displacement)
|
||||
, fColorTransform(context, color.get(), GrSamplerParams::kNone_FilterMode)
|
||||
, fDisplacementSampler(resourceProvider, displacement)
|
||||
, fColorTransform(resourceProvider, color.get(), GrSamplerParams::kNone_FilterMode)
|
||||
, fDomain(color.get(), GrTextureDomain::MakeTexelDomain(SkIRect::MakeSize(colorDimensions)),
|
||||
GrTextureDomain::kDecal_Mode)
|
||||
, fColorSampler(context->resourceProvider(), color)
|
||||
, fColorSampler(resourceProvider, color)
|
||||
, fColorSpaceXform(std::move(colorSpaceXform))
|
||||
, fXChannelSelector(xChannelSelector)
|
||||
, fYChannelSelector(yChannelSelector)
|
||||
@ -548,7 +549,8 @@ sk_sp<GrFragmentProcessor> GrDisplacementMapEffect::TestCreate(GrProcessorTestDa
|
||||
colorDimensions.fWidth = d->fRandom->nextRangeU(0, colorProxy->width());
|
||||
colorDimensions.fHeight = d->fRandom->nextRangeU(0, colorProxy->height());
|
||||
auto colorSpaceXform = GrTest::TestColorXform(d->fRandom);
|
||||
return GrDisplacementMapEffect::Make(d->context(), xChannelSelector, yChannelSelector, scale,
|
||||
return GrDisplacementMapEffect::Make(d->resourceProvider(),
|
||||
xChannelSelector, yChannelSelector, scale,
|
||||
std::move(dispProxy), SkMatrix::I(),
|
||||
std::move(colorProxy), colorSpaceXform,
|
||||
colorDimensions);
|
||||
|
@ -360,14 +360,15 @@ protected:
|
||||
const SkIRect& bounds,
|
||||
const SkMatrix& matrix,
|
||||
const OutputProperties& outputProperties) const;
|
||||
virtual sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrContext*, sk_sp<GrTextureProxy>,
|
||||
virtual sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrResourceProvider*,
|
||||
sk_sp<GrTextureProxy>,
|
||||
const SkMatrix&,
|
||||
const SkIRect* srcBounds,
|
||||
BoundaryMode boundaryMode) const = 0;
|
||||
#endif
|
||||
private:
|
||||
#if SK_SUPPORT_GPU
|
||||
void drawRect(GrContext*, GrRenderTargetContext*,
|
||||
void drawRect(GrRenderTargetContext*,
|
||||
sk_sp<GrTextureProxy> srcProxy,
|
||||
const SkMatrix& matrix,
|
||||
const GrClip& clip,
|
||||
@ -380,8 +381,7 @@ private:
|
||||
};
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
void SkLightingImageFilterInternal::drawRect(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
void SkLightingImageFilterInternal::drawRect(GrRenderTargetContext* renderTargetContext,
|
||||
sk_sp<GrTextureProxy> srcProxy,
|
||||
const SkMatrix& matrix,
|
||||
const GrClip& clip,
|
||||
@ -389,10 +389,12 @@ void SkLightingImageFilterInternal::drawRect(GrContext* context,
|
||||
BoundaryMode boundaryMode,
|
||||
const SkIRect* srcBounds,
|
||||
const SkIRect& bounds) const {
|
||||
GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
|
||||
|
||||
SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()));
|
||||
GrPaint paint;
|
||||
paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
|
||||
sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(context, std::move(srcProxy),
|
||||
sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(resourceProvider, std::move(srcProxy),
|
||||
matrix, srcBounds,
|
||||
boundaryMode));
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
@ -440,23 +442,23 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
|
||||
SkRect bottomRight = SkRect::MakeXYWH(dstRect.width() - 1, dstRect.height() - 1, 1, 1);
|
||||
|
||||
const SkIRect* pSrcBounds = inputBounds.contains(offsetBounds) ? nullptr : &inputBounds;
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, topLeft,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, topLeft,
|
||||
kTopLeft_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, top,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, top,
|
||||
kTop_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, topRight,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, topRight,
|
||||
kTopRight_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, left,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, left,
|
||||
kLeft_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, interior,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, interior,
|
||||
kInterior_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, right,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, right,
|
||||
kRight_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, bottomLeft,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, bottomLeft,
|
||||
kBottomLeft_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, bottom,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, bottom,
|
||||
kBottom_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
this->drawRect(context, renderTargetContext.get(), inputProxy, matrix, clip, bottomRight,
|
||||
this->drawRect(renderTargetContext.get(), inputProxy, matrix, clip, bottomRight,
|
||||
kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
|
||||
|
||||
return SkSpecialImage::MakeDeferredFromGpu(
|
||||
@ -490,7 +492,7 @@ protected:
|
||||
SkIPoint* offset) const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrContext*, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkMatrix&, const SkIRect* bounds,
|
||||
BoundaryMode) const override;
|
||||
#endif
|
||||
@ -526,7 +528,7 @@ protected:
|
||||
SkIPoint* offset) const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrContext*, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkMatrix&, const SkIRect* bounds,
|
||||
BoundaryMode) const override;
|
||||
#endif
|
||||
@ -542,7 +544,7 @@ private:
|
||||
|
||||
class GrLightingEffect : public GrSingleTextureEffect {
|
||||
public:
|
||||
GrLightingEffect(GrContext*, sk_sp<GrTextureProxy>,
|
||||
GrLightingEffect(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkImageFilterLight* light, SkScalar surfaceScale,
|
||||
const SkMatrix& matrix, BoundaryMode boundaryMode, const SkIRect* srcBounds);
|
||||
~GrLightingEffect() override;
|
||||
@ -569,7 +571,7 @@ private:
|
||||
|
||||
class GrDiffuseLightingEffect : public GrLightingEffect {
|
||||
public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
@ -578,7 +580,7 @@ public:
|
||||
BoundaryMode boundaryMode,
|
||||
const SkIRect* srcBounds) {
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrDiffuseLightingEffect(context, std::move(proxy), light,
|
||||
new GrDiffuseLightingEffect(resourceProvider, std::move(proxy), light,
|
||||
surfaceScale, matrix, kd, boundaryMode, srcBounds));
|
||||
}
|
||||
|
||||
@ -593,7 +595,7 @@ private:
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
GrDiffuseLightingEffect(GrContext*, sk_sp<GrTextureProxy>,
|
||||
GrDiffuseLightingEffect(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
@ -609,7 +611,7 @@ private:
|
||||
|
||||
class GrSpecularLightingEffect : public GrLightingEffect {
|
||||
public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
@ -619,7 +621,7 @@ public:
|
||||
BoundaryMode boundaryMode,
|
||||
const SkIRect* srcBounds) {
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrSpecularLightingEffect(context, std::move(proxy),
|
||||
new GrSpecularLightingEffect(resourceProvider, std::move(proxy),
|
||||
light, surfaceScale, matrix, ks, shininess,
|
||||
boundaryMode, srcBounds));
|
||||
}
|
||||
@ -636,7 +638,7 @@ private:
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
GrSpecularLightingEffect(GrContext*, sk_sp<GrTextureProxy>,
|
||||
GrSpecularLightingEffect(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
@ -1339,13 +1341,13 @@ void SkDiffuseLightingImageFilter::toString(SkString* str) const {
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
sk_sp<GrFragmentProcessor> SkDiffuseLightingImageFilter::makeFragmentProcessor(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkMatrix& matrix,
|
||||
const SkIRect* srcBounds,
|
||||
BoundaryMode boundaryMode) const {
|
||||
SkScalar scale = this->surfaceScale() * 255;
|
||||
return GrDiffuseLightingEffect::Make(context, std::move(proxy),
|
||||
return GrDiffuseLightingEffect::Make(resourceProvider, std::move(proxy),
|
||||
this->light(), scale, matrix, this->kd(),
|
||||
boundaryMode, srcBounds);
|
||||
}
|
||||
@ -1506,13 +1508,13 @@ void SkSpecularLightingImageFilter::toString(SkString* str) const {
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
sk_sp<GrFragmentProcessor> SkSpecularLightingImageFilter::makeFragmentProcessor(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkMatrix& matrix,
|
||||
const SkIRect* srcBounds,
|
||||
BoundaryMode boundaryMode) const {
|
||||
SkScalar scale = this->surfaceScale() * 255;
|
||||
return GrSpecularLightingEffect::Make(context, std::move(proxy), this->light(),
|
||||
return GrSpecularLightingEffect::Make(resourceProvider, std::move(proxy), this->light(),
|
||||
scale, matrix, this->ks(),
|
||||
this->shininess(), boundaryMode, srcBounds);
|
||||
}
|
||||
@ -1696,7 +1698,7 @@ static GrTextureDomain create_domain(GrTextureProxy* proxy, const SkIRect* srcBo
|
||||
}
|
||||
}
|
||||
|
||||
GrLightingEffect::GrLightingEffect(GrContext* context,
|
||||
GrLightingEffect::GrLightingEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
@ -1704,7 +1706,7 @@ GrLightingEffect::GrLightingEffect(GrContext* context,
|
||||
BoundaryMode boundaryMode,
|
||||
const SkIRect* srcBounds)
|
||||
// Perhaps this could advertise the opaque or coverage-as-alpha optimizations?
|
||||
: INHERITED(context, kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I())
|
||||
: INHERITED(resourceProvider, kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I())
|
||||
, fLight(light)
|
||||
, fSurfaceScale(surfaceScale)
|
||||
, fFilterMatrix(matrix)
|
||||
@ -1726,7 +1728,7 @@ bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrContext* context,
|
||||
GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
@ -1734,7 +1736,7 @@ GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrContext* context,
|
||||
SkScalar kd,
|
||||
BoundaryMode boundaryMode,
|
||||
const SkIRect* srcBounds)
|
||||
: INHERITED(context, std::move(proxy), light, surfaceScale, matrix,
|
||||
: INHERITED(resourceProvider, std::move(proxy), light, surfaceScale, matrix,
|
||||
boundaryMode, srcBounds), fKD(kd) {
|
||||
this->initClassID<GrDiffuseLightingEffect>();
|
||||
}
|
||||
@ -1772,7 +1774,7 @@ sk_sp<GrFragmentProcessor> GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa
|
||||
d->fRandom->nextRangeU(0, proxy->width()),
|
||||
d->fRandom->nextRangeU(0, proxy->height()));
|
||||
BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundaryModeCount);
|
||||
return GrDiffuseLightingEffect::Make(d->context(),
|
||||
return GrDiffuseLightingEffect::Make(d->resourceProvider(),
|
||||
std::move(proxy), light.get(), surfaceScale,
|
||||
matrix, kd, mode, &srcBounds);
|
||||
}
|
||||
@ -1944,7 +1946,7 @@ void GrGLDiffuseLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrSpecularLightingEffect::GrSpecularLightingEffect(GrContext* context,
|
||||
GrSpecularLightingEffect::GrSpecularLightingEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
@ -1953,7 +1955,8 @@ GrSpecularLightingEffect::GrSpecularLightingEffect(GrContext* context,
|
||||
SkScalar shininess,
|
||||
BoundaryMode boundaryMode,
|
||||
const SkIRect* srcBounds)
|
||||
: INHERITED(context, std::move(proxy), light, surfaceScale, matrix, boundaryMode, srcBounds)
|
||||
: INHERITED(resourceProvider, std::move(proxy), light, surfaceScale,
|
||||
matrix, boundaryMode, srcBounds)
|
||||
, fKS(ks)
|
||||
, fShininess(shininess) {
|
||||
this->initClassID<GrSpecularLightingEffect>();
|
||||
@ -1995,7 +1998,7 @@ sk_sp<GrFragmentProcessor> GrSpecularLightingEffect::TestCreate(GrProcessorTestD
|
||||
d->fRandom->nextRangeU(0, proxy->height()),
|
||||
d->fRandom->nextRangeU(0, proxy->width()),
|
||||
d->fRandom->nextRangeU(0, proxy->height()));
|
||||
return GrSpecularLightingEffect::Make(d->context(), std::move(proxy),
|
||||
return GrSpecularLightingEffect::Make(d->resourceProvider(), std::move(proxy),
|
||||
light.get(), surfaceScale, matrix, ks, shininess, mode,
|
||||
&srcBounds);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ sk_sp<SkImageFilter> SkMagnifierImageFilter::Make(const SkRect& srcRect, SkScala
|
||||
#if SK_SUPPORT_GPU
|
||||
class GrMagnifierEffect : public GrSingleTextureEffect {
|
||||
public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkIRect& bounds,
|
||||
@ -57,7 +57,7 @@ public:
|
||||
float yInvZoom,
|
||||
float xInvInset,
|
||||
float yInvInset) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrMagnifierEffect(context,
|
||||
return sk_sp<GrFragmentProcessor>(new GrMagnifierEffect(resourceProvider,
|
||||
std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
bounds, srcRect,
|
||||
@ -81,7 +81,7 @@ public:
|
||||
float yInvInset() const { return fYInvInset; }
|
||||
|
||||
private:
|
||||
GrMagnifierEffect(GrContext* context,
|
||||
GrMagnifierEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkIRect& bounds,
|
||||
@ -90,7 +90,7 @@ private:
|
||||
float yInvZoom,
|
||||
float xInvInset,
|
||||
float yInvInset)
|
||||
: INHERITED{context,
|
||||
: INHERITED{resourceProvider,
|
||||
ModulationFlags(proxy->config()),
|
||||
GR_PROXY_MOVE(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
@ -270,7 +270,7 @@ sk_sp<GrFragmentProcessor> GrMagnifierEffect::TestCreate(GrProcessorTestData* d)
|
||||
SkRect srcRect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
|
||||
|
||||
sk_sp<GrFragmentProcessor> effect(GrMagnifierEffect::Make(
|
||||
d->context(),
|
||||
d->resourceProvider(),
|
||||
std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
bounds,
|
||||
@ -361,7 +361,7 @@ sk_sp<SkSpecialImage> SkMagnifierImageFilter::onFilterImage(SkSpecialImage* sour
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(input->getColorSpace(),
|
||||
dstColorSpace);
|
||||
sk_sp<GrFragmentProcessor> fp(GrMagnifierEffect::Make(
|
||||
context,
|
||||
context->resourceProvider(),
|
||||
std::move(inputProxy),
|
||||
std::move(colorSpaceXform),
|
||||
bounds,
|
||||
|
@ -318,7 +318,7 @@ sk_sp<SkSpecialImage> SkMatrixConvolutionImageFilter::onFilterImage(SkSpecialIma
|
||||
offset->fY = bounds.top();
|
||||
bounds.offset(-inputOffset);
|
||||
|
||||
sk_sp<GrFragmentProcessor> fp(GrMatrixConvolutionEffect::Make(context,
|
||||
sk_sp<GrFragmentProcessor> fp(GrMatrixConvolutionEffect::Make(context->resourceProvider(),
|
||||
std::move(inputProxy),
|
||||
bounds,
|
||||
fKernelSize,
|
||||
|
@ -145,16 +145,17 @@ public:
|
||||
kDilate_MorphologyType,
|
||||
};
|
||||
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
Direction dir, int radius, MorphologyType type) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(context, std::move(proxy),
|
||||
return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(resourceProvider, std::move(proxy),
|
||||
dir, radius, type));
|
||||
}
|
||||
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
Direction dir, int radius,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy, Direction dir, int radius,
|
||||
MorphologyType type, const float bounds[2]) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(context, std::move(proxy),
|
||||
return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(resourceProvider, std::move(proxy),
|
||||
dir, radius, type, bounds));
|
||||
}
|
||||
|
||||
@ -179,8 +180,9 @@ private:
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
GrMorphologyEffect(GrContext*, sk_sp<GrTextureProxy>, Direction, int radius, MorphologyType);
|
||||
GrMorphologyEffect(GrContext*, sk_sp<GrTextureProxy>,
|
||||
GrMorphologyEffect(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
Direction, int radius, MorphologyType);
|
||||
GrMorphologyEffect(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
Direction, int radius, MorphologyType, const float bounds[2]);
|
||||
|
||||
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
|
||||
@ -322,12 +324,12 @@ void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrContext* context,
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
Direction direction,
|
||||
int radius,
|
||||
MorphologyType type)
|
||||
: INHERITED{context,
|
||||
: INHERITED{resourceProvider,
|
||||
ModulationFlags(proxy->config()),
|
||||
GR_PROXY_MOVE(proxy),
|
||||
direction, radius}
|
||||
@ -336,13 +338,13 @@ GrMorphologyEffect::GrMorphologyEffect(GrContext* context,
|
||||
this->initClassID<GrMorphologyEffect>();
|
||||
}
|
||||
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrContext* context,
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
Direction direction,
|
||||
int radius,
|
||||
MorphologyType type,
|
||||
const float range[2])
|
||||
: INHERITED{context,
|
||||
: INHERITED{resourceProvider,
|
||||
ModulationFlags(proxy->config()),
|
||||
GR_PROXY_MOVE(proxy),
|
||||
direction, radius}
|
||||
@ -388,13 +390,13 @@ sk_sp<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorTestData* d
|
||||
MorphologyType type = d->fRandom->nextBool() ? GrMorphologyEffect::kErode_MorphologyType
|
||||
: GrMorphologyEffect::kDilate_MorphologyType;
|
||||
|
||||
return GrMorphologyEffect::Make(d->context(), std::move(proxy), dir, radius, type);
|
||||
return GrMorphologyEffect::Make(d->resourceProvider(),
|
||||
std::move(proxy), dir, radius, type);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void apply_morphology_rect(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext,
|
||||
const GrClip& clip,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& srcRect,
|
||||
@ -406,7 +408,9 @@ static void apply_morphology_rect(GrContext* context,
|
||||
GrPaint paint;
|
||||
paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
|
||||
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(context, std::move(proxy),
|
||||
GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
|
||||
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(resourceProvider, std::move(proxy),
|
||||
direction, radius, morphType,
|
||||
bounds));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -414,8 +418,7 @@ static void apply_morphology_rect(GrContext* context,
|
||||
SkRect::Make(dstRect), SkRect::Make(srcRect));
|
||||
}
|
||||
|
||||
static void apply_morphology_rect_no_bounds(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetContext,
|
||||
const GrClip& clip,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& srcRect,
|
||||
@ -426,15 +429,16 @@ static void apply_morphology_rect_no_bounds(GrContext* context,
|
||||
GrPaint paint;
|
||||
paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
|
||||
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(context, std::move(proxy),
|
||||
GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
|
||||
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(resourceProvider, std::move(proxy),
|
||||
direction, radius, morphType));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
renderTargetContext->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
|
||||
SkRect::Make(dstRect), SkRect::Make(srcRect));
|
||||
}
|
||||
|
||||
static void apply_morphology_pass(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
static void apply_morphology_pass(GrRenderTargetContext* renderTargetContext,
|
||||
const GrClip& clip,
|
||||
sk_sp<GrTextureProxy> textureProxy,
|
||||
const SkIRect& srcRect,
|
||||
@ -467,15 +471,15 @@ static void apply_morphology_pass(GrContext* context,
|
||||
}
|
||||
if (middleSrcRect.fLeft - middleSrcRect.fRight >= 0) {
|
||||
// radius covers srcRect; use bounds over entire draw
|
||||
apply_morphology_rect(context, renderTargetContext, clip, std::move(textureProxy),
|
||||
apply_morphology_rect(renderTargetContext, clip, std::move(textureProxy),
|
||||
srcRect, dstRect, radius, morphType, bounds, direction);
|
||||
} else {
|
||||
// Draw upper and lower margins with bounds; middle without.
|
||||
apply_morphology_rect(context, renderTargetContext, clip, textureProxy,
|
||||
apply_morphology_rect(renderTargetContext, clip, textureProxy,
|
||||
lowerSrcRect, lowerDstRect, radius, morphType, bounds, direction);
|
||||
apply_morphology_rect(context, renderTargetContext, clip, textureProxy,
|
||||
apply_morphology_rect(renderTargetContext, clip, textureProxy,
|
||||
upperSrcRect, upperDstRect, radius, morphType, bounds, direction);
|
||||
apply_morphology_rect_no_bounds(context, renderTargetContext, clip, std::move(textureProxy),
|
||||
apply_morphology_rect_no_bounds(renderTargetContext, clip, std::move(textureProxy),
|
||||
middleSrcRect, middleDstRect, radius, morphType, direction);
|
||||
}
|
||||
}
|
||||
@ -507,8 +511,7 @@ static sk_sp<SkSpecialImage> apply_morphology(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
apply_morphology_pass(context,
|
||||
dstRTContext.get(), clip, std::move(srcTexture),
|
||||
apply_morphology_pass(dstRTContext.get(), clip, std::move(srcTexture),
|
||||
srcRect, dstRect, radius.fWidth, morphType,
|
||||
Gr1DKernelEffect::kX_Direction);
|
||||
SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
|
||||
@ -528,8 +531,7 @@ static sk_sp<SkSpecialImage> apply_morphology(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
apply_morphology_pass(context,
|
||||
dstRTContext.get(), clip, std::move(srcTexture),
|
||||
apply_morphology_pass(dstRTContext.get(), clip, std::move(srcTexture),
|
||||
srcRect, dstRect, radius.fHeight, morphType,
|
||||
Gr1DKernelEffect::kY_Direction);
|
||||
|
||||
|
@ -254,7 +254,8 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
|
||||
sk_sp<GrColorSpaceXform> bgXform = GrColorSpaceXform::Make(background->getColorSpace(),
|
||||
outputProperties.colorSpace());
|
||||
bgFP = GrTextureDomainEffect::Make(
|
||||
context, std::move(backgroundProxy), std::move(bgXform), bgMatrix,
|
||||
context->resourceProvider(), std::move(backgroundProxy),
|
||||
std::move(bgXform), bgMatrix,
|
||||
GrTextureDomain::MakeTexelDomain(background->subset()),
|
||||
GrTextureDomain::kDecal_Mode,
|
||||
GrSamplerParams::kNone_FilterMode);
|
||||
@ -271,7 +272,8 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
|
||||
sk_sp<GrFragmentProcessor> foregroundFP;
|
||||
|
||||
foregroundFP = GrTextureDomainEffect::Make(
|
||||
context, std::move(foregroundProxy), std::move(fgXform), fgMatrix,
|
||||
context->resourceProvider(), std::move(foregroundProxy),
|
||||
std::move(fgXform), fgMatrix,
|
||||
GrTextureDomain::MakeTexelDomain(foreground->subset()),
|
||||
GrTextureDomain::kDecal_Mode,
|
||||
GrSamplerParams::kNone_FilterMode);
|
||||
|
@ -1697,7 +1697,7 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque)
|
||||
if (-1 != fRow) {
|
||||
fYCoord = fAtlas->getYOffset(fRow)+SK_ScalarHalf*fAtlas->getNormalizedTexelHeight();
|
||||
// This is 1/2 places where auto-normalization is disabled
|
||||
fCoordTransform.reset(args.fContext, *args.fMatrix,
|
||||
fCoordTransform.reset(args.fContext->resourceProvider(), *args.fMatrix,
|
||||
fAtlas->asTextureProxyRef().get(),
|
||||
params.filterMode(), false);
|
||||
fTextureSampler.reset(args.fContext->resourceProvider(),
|
||||
@ -1717,7 +1717,7 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque)
|
||||
return;
|
||||
}
|
||||
// This is 2/2 places where auto-normalization is disabled
|
||||
fCoordTransform.reset(args.fContext, *args.fMatrix,
|
||||
fCoordTransform.reset(args.fContext->resourceProvider(), *args.fMatrix,
|
||||
proxy.get(), params.filterMode(), false);
|
||||
fTextureSampler.reset(args.fContext->resourceProvider(),
|
||||
std::move(proxy), params);
|
||||
|
@ -30,8 +30,7 @@ static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& r
|
||||
// Draw a mask using the supplied paint. Since the coverage/geometry
|
||||
// is already burnt into the mask this boils down to a rect draw.
|
||||
// Return true if the mask was successfully drawn.
|
||||
static bool draw_mask(GrContext* context,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
static bool draw_mask(GrRenderTargetContext* renderTargetContext,
|
||||
const GrClip& clip,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkIRect& maskRect,
|
||||
@ -42,10 +41,13 @@ static bool draw_mask(GrContext* context,
|
||||
return false;
|
||||
}
|
||||
|
||||
GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
|
||||
|
||||
SkMatrix matrix = SkMatrix::MakeTrans(-SkIntToScalar(maskRect.fLeft),
|
||||
-SkIntToScalar(maskRect.fTop));
|
||||
matrix.preConcat(viewMatrix);
|
||||
paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(context, std::move(mask),
|
||||
paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider,
|
||||
std::move(mask),
|
||||
nullptr, matrix));
|
||||
|
||||
renderTargetContext->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
|
||||
@ -100,7 +102,7 @@ static bool sw_draw_with_mask_filter(GrContext* context,
|
||||
return false;
|
||||
}
|
||||
|
||||
return draw_mask(context, renderTargetContext, clipData, viewMatrix,
|
||||
return draw_mask(renderTargetContext, clipData, viewMatrix,
|
||||
dstM.fBounds, std::move(paint), sContext->asTextureProxyRef());
|
||||
}
|
||||
|
||||
@ -231,7 +233,7 @@ static void draw_path_with_mask_filter(GrContext* context,
|
||||
viewMatrix,
|
||||
finalIRect);
|
||||
if (filtered) {
|
||||
if (draw_mask(context, renderTargetContext, clip, viewMatrix,
|
||||
if (draw_mask(renderTargetContext, clip, viewMatrix,
|
||||
finalIRect, std::move(paint), std::move(filtered))) {
|
||||
// This path is completely drawn
|
||||
return;
|
||||
|
@ -72,11 +72,12 @@ void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// set up the draw state to enable the aa clipping mask.
|
||||
static sk_sp<GrFragmentProcessor> create_fp_for_mask(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> create_fp_for_mask(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> mask,
|
||||
const SkIRect &devBound) {
|
||||
SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height());
|
||||
return GrDeviceSpaceTextureDecalFragmentProcessor::Make(context, std::move(mask), domainTexels,
|
||||
return GrDeviceSpaceTextureDecalFragmentProcessor::Make(resourceProvider,
|
||||
std::move(mask), domainTexels,
|
||||
{devBound.fLeft, devBound.fTop});
|
||||
}
|
||||
|
||||
@ -323,7 +324,7 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar
|
||||
if (result) {
|
||||
// The mask's top left coord should be pinned to the rounded-out top left corner of
|
||||
// the clip's device space bounds.
|
||||
out->addCoverageFP(create_fp_for_mask(context, std::move(result),
|
||||
out->addCoverageFP(create_fp_for_mask(context->resourceProvider(), std::move(result),
|
||||
reducedClip.ibounds()));
|
||||
return true;
|
||||
}
|
||||
|
@ -321,7 +321,8 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, SkColorSpace* dstColorSpa
|
||||
}
|
||||
if (tempProxy) {
|
||||
if (!fp) {
|
||||
fp = GrConfigConversionEffect::Make(this, tempProxy, tempDrawInfo.fSwizzle,
|
||||
fp = GrConfigConversionEffect::Make(this->resourceProvider(),
|
||||
tempProxy, tempDrawInfo.fSwizzle,
|
||||
GrConfigConversionEffect::kNone_PMConversion,
|
||||
SkMatrix::I());
|
||||
if (!fp) {
|
||||
@ -877,7 +878,8 @@ sk_sp<GrFragmentProcessor> GrContext::createPMToUPMEffect(sk_sp<GrTextureProxy>
|
||||
GrConfigConversionEffect::PMConversion pmToUPM =
|
||||
static_cast<GrConfigConversionEffect::PMConversion>(fPMToUPMConversion);
|
||||
if (GrConfigConversionEffect::kNone_PMConversion != pmToUPM) {
|
||||
return GrConfigConversionEffect::Make(this, proxy, swizzle, pmToUPM, matrix);
|
||||
return GrConfigConversionEffect::Make(this->resourceProvider(),
|
||||
proxy, swizzle, pmToUPM, matrix);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
@ -892,7 +894,8 @@ sk_sp<GrFragmentProcessor> GrContext::createUPMToPMEffect(sk_sp<GrTextureProxy>
|
||||
GrConfigConversionEffect::PMConversion upmToPM =
|
||||
static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion);
|
||||
if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) {
|
||||
return GrConfigConversionEffect::Make(this, std::move(proxy), swizzle, upmToPM, matrix);
|
||||
return GrConfigConversionEffect::Make(this->resourceProvider(),
|
||||
std::move(proxy), swizzle, upmToPM, matrix);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "GrCaps.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrGpu.h"
|
||||
#include "GrResourceProvider.h"
|
||||
#include "GrTextureProxy.h"
|
||||
|
||||
static GrSLPrecision compute_precision(const GrShaderCaps* caps,
|
||||
@ -67,7 +68,7 @@ void GrCoordTransform::reset(const SkMatrix& m, const GrTexture* texture,
|
||||
}
|
||||
}
|
||||
|
||||
void GrCoordTransform::reset(GrContext* context, const SkMatrix& m,
|
||||
void GrCoordTransform::reset(GrResourceProvider* resourceProvider, const SkMatrix& m,
|
||||
GrTextureProxy* proxy,
|
||||
GrSamplerParams::FilterMode filter, bool normalize) {
|
||||
SkASSERT(proxy);
|
||||
@ -77,11 +78,11 @@ void GrCoordTransform::reset(GrContext* context, const SkMatrix& m,
|
||||
// MDB TODO: just GrCaps is needed for this method
|
||||
// MDB TODO: once all the coord transforms take a proxy just store it here and
|
||||
// instantiate later
|
||||
fTexture = proxy->instantiate(context->resourceProvider());
|
||||
fTexture = proxy->instantiate(resourceProvider);
|
||||
fNormalize = normalize;
|
||||
fReverseY = kBottomLeft_GrSurfaceOrigin == proxy->origin();
|
||||
|
||||
const GrCaps* caps = context->caps();
|
||||
const GrCaps* caps = resourceProvider->caps();
|
||||
fPrecision = compute_precision(caps->shaderCaps(),
|
||||
proxy->worstCaseWidth(*caps),
|
||||
proxy->worstCaseHeight(*caps), filter);
|
||||
|
@ -48,34 +48,40 @@ void GrPaint::addCoverageTextureProcessor(GrTexture* texture,
|
||||
params));
|
||||
}
|
||||
|
||||
void GrPaint::addColorTextureProcessor(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
void GrPaint::addColorTextureProcessor(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix) {
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(ctx, std::move(proxy),
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix));
|
||||
}
|
||||
|
||||
void GrPaint::addColorTextureProcessor(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
void GrPaint::addColorTextureProcessor(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
const GrSamplerParams& params) {
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(ctx,
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider,
|
||||
std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix, params));
|
||||
}
|
||||
|
||||
void GrPaint::addCoverageTextureProcessor(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
void GrPaint::addCoverageTextureProcessor(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkMatrix& matrix) {
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(ctx, std::move(proxy),
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider,
|
||||
std::move(proxy),
|
||||
nullptr, matrix));
|
||||
}
|
||||
|
||||
void GrPaint::addCoverageTextureProcessor(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
void GrPaint::addCoverageTextureProcessor(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkMatrix& matrix,
|
||||
const GrSamplerParams& params) {
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(ctx, std::move(proxy),
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider,
|
||||
std::move(proxy),
|
||||
nullptr, matrix, params));
|
||||
}
|
||||
|
||||
|
@ -118,13 +118,14 @@ public:
|
||||
void addCoverageTextureProcessor(GrTexture*, const SkMatrix&, const GrSamplerParams&);
|
||||
|
||||
|
||||
void addColorTextureProcessor(GrContext*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>,
|
||||
const SkMatrix&);
|
||||
void addColorTextureProcessor(GrContext*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>,
|
||||
const SkMatrix&, const GrSamplerParams&);
|
||||
void addColorTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>, const SkMatrix&);
|
||||
void addColorTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>, const SkMatrix&,
|
||||
const GrSamplerParams&);
|
||||
|
||||
void addCoverageTextureProcessor(GrContext*, sk_sp<GrTextureProxy>, const SkMatrix&);
|
||||
void addCoverageTextureProcessor(GrContext*, sk_sp<GrTextureProxy>,
|
||||
void addCoverageTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, const SkMatrix&);
|
||||
void addCoverageTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkMatrix&, const GrSamplerParams&);
|
||||
|
||||
int numColorFragmentProcessors() const { return fColorFragmentProcessors.count(); }
|
||||
|
@ -15,8 +15,17 @@
|
||||
#include "GrXferProcessor.h"
|
||||
#include "SkSpinlock.h"
|
||||
|
||||
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
GrResourceProvider* GrProcessorTestData::resourceProvider() {
|
||||
return fContext->resourceProvider();
|
||||
}
|
||||
|
||||
const GrCaps* GrProcessorTestData::caps() {
|
||||
return fContext->caps();
|
||||
}
|
||||
|
||||
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
|
||||
class GrFragmentProcessor;
|
||||
class GrGeometryProcessor;
|
||||
|
||||
|
@ -436,7 +436,7 @@ private:
|
||||
friend class GrStencilAndCoverPathRenderer; // for access to add[Mesh]DrawOp
|
||||
friend class GrTessellatingPathRenderer; // for access to add[Mesh]DrawOp
|
||||
// for a unit test
|
||||
friend void test_draw_op(GrContext*, GrRenderTargetContext*,
|
||||
friend void test_draw_op(GrRenderTargetContext*,
|
||||
sk_sp<GrFragmentProcessor>, sk_sp<GrTextureProxy>);
|
||||
|
||||
void internalClear(const GrFixedClip&, const GrColor, bool canIgnoreClip);
|
||||
|
@ -150,8 +150,7 @@ sk_sp<GrTextureProxy> GrSWMaskHelper::DrawShapeMaskToTexture(GrContext* context,
|
||||
return helper.toTextureProxy(context, fit);
|
||||
}
|
||||
|
||||
void GrSWMaskHelper::DrawToTargetWithShapeMask(GrContext* context,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
void GrSWMaskHelper::DrawToTargetWithShapeMask(sk_sp<GrTextureProxy> proxy,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
GrPaint&& paint,
|
||||
const GrUserStencilSettings& userStencilSettings,
|
||||
@ -164,6 +163,8 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrContext* context,
|
||||
return;
|
||||
}
|
||||
|
||||
GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
|
||||
|
||||
SkRect dstRect = SkRect::Make(deviceSpaceRectToDraw);
|
||||
|
||||
// We use device coords to compute the texture coordinates. We take the device coords and apply
|
||||
@ -175,7 +176,8 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrContext* context,
|
||||
std::unique_ptr<GrMeshDrawOp> op = GrRectOpFactory::MakeNonAAFill(
|
||||
paint.getColor(), SkMatrix::I(), dstRect, nullptr, &invert);
|
||||
paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(
|
||||
context, std::move(proxy), nullptr, maskMatrix, GrSamplerParams::kNone_FilterMode));
|
||||
resourceProvider, std::move(proxy), nullptr, maskMatrix,
|
||||
GrSamplerParams::kNone_FilterMode));
|
||||
GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone);
|
||||
pipelineBuilder.setUserStencil(&userStencilSettings);
|
||||
renderTargetContext->addMeshDrawOp(pipelineBuilder, clip, std::move(op));
|
||||
|
@ -77,8 +77,7 @@ public:
|
||||
// This utility draws a path mask generated by DrawShapeMaskToTexture using a provided paint.
|
||||
// The rectangle is drawn in device space. The 'viewMatrix' will be used to ensure the correct
|
||||
// local coords are provided to any fragment processors in the paint.
|
||||
static void DrawToTargetWithShapeMask(GrContext*,
|
||||
sk_sp<GrTextureProxy>,
|
||||
static void DrawToTargetWithShapeMask(sk_sp<GrTextureProxy>,
|
||||
GrRenderTargetContext*,
|
||||
GrPaint&& paint,
|
||||
const GrUserStencilSettings& userStencilSettings,
|
||||
|
@ -226,7 +226,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
unclippedDevShapeBounds);
|
||||
}
|
||||
GrSWMaskHelper::DrawToTargetWithShapeMask(
|
||||
args.fContext, std::move(proxy), args.fRenderTargetContext, std::move(args.fPaint),
|
||||
std::move(proxy), args.fRenderTargetContext, std::move(args.fPaint),
|
||||
*args.fUserStencilSettings, *args.fClip, *args.fViewMatrix,
|
||||
SkIPoint{boundsForMask->fLeft, boundsForMask->fTop}, *boundsForMask);
|
||||
|
||||
|
@ -110,11 +110,12 @@ sk_sp<GrTextureProxy> GrTextureProducer::CopyOnGpu(GrContext* context,
|
||||
// better!
|
||||
SkASSERT(copyParams.fFilter != GrSamplerParams::kMipMap_FilterMode);
|
||||
paint.addColorFragmentProcessor(
|
||||
GrTextureDomainEffect::Make(context, std::move(inputProxy), nullptr, SkMatrix::I(),
|
||||
GrTextureDomainEffect::Make(context->resourceProvider(), std::move(inputProxy),
|
||||
nullptr, SkMatrix::I(),
|
||||
domain, GrTextureDomain::kClamp_Mode, copyParams.fFilter));
|
||||
} else {
|
||||
GrSamplerParams params(SkShader::kClamp_TileMode, copyParams.fFilter);
|
||||
paint.addColorTextureProcessor(context, std::move(inputProxy),
|
||||
paint.addColorTextureProcessor(context->resourceProvider(), std::move(inputProxy),
|
||||
nullptr, SkMatrix::I(), params);
|
||||
}
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
@ -296,7 +297,7 @@ sk_sp<GrFragmentProcessor> GrTextureProducer::CreateFragmentProcessorForDomainAn
|
||||
}
|
||||
|
||||
sk_sp<GrFragmentProcessor> GrTextureProducer::CreateFragmentProcessorForDomainAndFilter(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& textureMatrix,
|
||||
@ -306,24 +307,26 @@ sk_sp<GrFragmentProcessor> GrTextureProducer::CreateFragmentProcessorForDomainAn
|
||||
SkASSERT(kTightCopy_DomainMode != domainMode);
|
||||
if (filterOrNullForBicubic) {
|
||||
if (kDomain_DomainMode == domainMode) {
|
||||
return GrTextureDomainEffect::Make(context, std::move(proxy),
|
||||
return GrTextureDomainEffect::Make(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform), textureMatrix,
|
||||
domain, GrTextureDomain::kClamp_Mode,
|
||||
*filterOrNullForBicubic);
|
||||
} else {
|
||||
GrSamplerParams params(SkShader::kClamp_TileMode, *filterOrNullForBicubic);
|
||||
return GrSimpleTextureEffect::Make(context, std::move(proxy),
|
||||
return GrSimpleTextureEffect::Make(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform), textureMatrix,
|
||||
params);
|
||||
}
|
||||
} else {
|
||||
if (kDomain_DomainMode == domainMode) {
|
||||
return GrBicubicEffect::Make(context, std::move(proxy), std::move(colorSpaceXform),
|
||||
return GrBicubicEffect::Make(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
textureMatrix, domain);
|
||||
} else {
|
||||
static const SkShader::TileMode kClampClamp[] =
|
||||
{ SkShader::kClamp_TileMode, SkShader::kClamp_TileMode };
|
||||
return GrBicubicEffect::Make(context, std::move(proxy), std::move(colorSpaceXform),
|
||||
return GrBicubicEffect::Make(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
textureMatrix, kClampClamp);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "GrResourceKey.h"
|
||||
|
||||
class GrColorSpaceXform;
|
||||
class GrResourceProvider;
|
||||
class GrTexture;
|
||||
class GrTextureProxy;
|
||||
|
||||
@ -140,9 +141,9 @@ protected:
|
||||
const GrSamplerParams::FilterMode* filterOrNullForBicubic);
|
||||
|
||||
static sk_sp<GrFragmentProcessor> CreateFragmentProcessorForDomainAndFilter(
|
||||
GrContext* context,
|
||||
GrResourceProvider*,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
sk_sp<GrColorSpaceXform>,
|
||||
const SkMatrix& textureMatrix,
|
||||
DomainMode,
|
||||
const SkRect& domain,
|
||||
|
@ -19,7 +19,7 @@ namespace {
|
||||
SkYUVColorSpace colorSpace);
|
||||
};
|
||||
|
||||
static bool convert_proxy(GrContext* context, sk_sp<GrTextureProxy> src,
|
||||
static bool convert_proxy(sk_sp<GrTextureProxy> src,
|
||||
GrRenderTargetContext* dst, int dstW, int dstH,
|
||||
SkYUVColorSpace colorSpace, MakeFPProc proc) {
|
||||
|
||||
@ -32,7 +32,10 @@ static bool convert_proxy(GrContext* context, sk_sp<GrTextureProxy> src,
|
||||
filter = GrSamplerParams::kBilerp_FilterMode;
|
||||
}
|
||||
|
||||
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(context, std::move(src), nullptr,
|
||||
GrResourceProvider* resourceProvider = dst->resourceProvider();
|
||||
|
||||
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(resourceProvider, std::move(src),
|
||||
nullptr,
|
||||
SkMatrix::MakeScale(xScale, yScale),
|
||||
filter));
|
||||
if (!fp) {
|
||||
@ -121,32 +124,32 @@ bool GrTextureToYUVPlanes(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
|
||||
// Do all the draws before any readback.
|
||||
if (yuvRenderTargetContext) {
|
||||
if (!convert_proxy(context, std::move(proxy), yuvRenderTargetContext.get(),
|
||||
if (!convert_proxy(std::move(proxy), yuvRenderTargetContext.get(),
|
||||
sizes[0].fWidth, sizes[0].fHeight,
|
||||
colorSpace, GrYUVEffect::MakeRGBToYUV)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
SkASSERT(yRenderTargetContext);
|
||||
if (!convert_proxy(context, proxy, yRenderTargetContext.get(),
|
||||
if (!convert_proxy(proxy, yRenderTargetContext.get(),
|
||||
sizes[0].fWidth, sizes[0].fHeight,
|
||||
colorSpace, GrYUVEffect::MakeRGBToY)) {
|
||||
return false;
|
||||
}
|
||||
if (uvRenderTargetContext) {
|
||||
if (!convert_proxy(context, std::move(proxy), uvRenderTargetContext.get(),
|
||||
if (!convert_proxy(std::move(proxy), uvRenderTargetContext.get(),
|
||||
sizes[1].fWidth, sizes[1].fHeight,
|
||||
colorSpace, GrYUVEffect::MakeRGBToUV)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
SkASSERT(uRenderTargetContext && vRenderTargetContext);
|
||||
if (!convert_proxy(context, proxy, uRenderTargetContext.get(),
|
||||
if (!convert_proxy(proxy, uRenderTargetContext.get(),
|
||||
sizes[1].fWidth, sizes[1].fHeight,
|
||||
colorSpace, GrYUVEffect::MakeRGBToU)) {
|
||||
return false;
|
||||
}
|
||||
if (!convert_proxy(context, std::move(proxy), vRenderTargetContext.get(),
|
||||
if (!convert_proxy(std::move(proxy), vRenderTargetContext.get(),
|
||||
sizes[2].fWidth, sizes[2].fHeight,
|
||||
colorSpace, GrYUVEffect::MakeRGBToV)) {
|
||||
return false;
|
||||
|
@ -132,7 +132,7 @@ sk_sp<GrTextureProxy> GrYUVProvider::refAsTextureProxy(GrContext* ctx,
|
||||
|
||||
GrPaint paint;
|
||||
sk_sp<GrFragmentProcessor> yuvToRgbProcessor(
|
||||
GrYUVEffect::MakeYUVToRGB(ctx,
|
||||
GrYUVEffect::MakeYUVToRGB(ctx->resourceProvider(),
|
||||
yuvTextureContexts[0]->asTextureProxyRef(),
|
||||
yuvTextureContexts[1]->asTextureProxyRef(),
|
||||
yuvTextureContexts[2]->asTextureProxyRef(),
|
||||
|
@ -1161,7 +1161,7 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special1,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform =
|
||||
GrColorSpaceXform::Make(result->getColorSpace(), fRenderTargetContext->getColorSpace());
|
||||
|
||||
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(this->context(),
|
||||
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(this->context()->resourceProvider(),
|
||||
std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
SkMatrix::I()));
|
||||
|
@ -28,9 +28,9 @@ public:
|
||||
kY_Direction,
|
||||
};
|
||||
|
||||
Gr1DKernelEffect(GrContext* ctx, OptimizationFlags optFlags, sk_sp<GrTextureProxy> proxy,
|
||||
Direction direction, int radius)
|
||||
: INHERITED(ctx, optFlags, std::move(proxy), nullptr, SkMatrix::I())
|
||||
Gr1DKernelEffect(GrResourceProvider* resourceProvider, OptimizationFlags optFlags,
|
||||
sk_sp<GrTextureProxy> proxy, Direction direction, int radius)
|
||||
: INHERITED(resourceProvider, optFlags, std::move(proxy), nullptr, SkMatrix::I())
|
||||
, fDirection(direction)
|
||||
, fRadius(radius) {
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "GrBezierEffect.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrShaderCaps.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "glsl/GrGLSLGeometryProcessor.h"
|
||||
@ -266,7 +265,7 @@ sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
static_cast<GrPrimitiveEdgeType>(
|
||||
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
|
||||
gp = GrConicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
|
||||
edgeType, *d->context()->caps(), GrTest::TestMatrix(d->fRandom),
|
||||
edgeType, *d->caps(), GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool());
|
||||
} while (nullptr == gp);
|
||||
return gp;
|
||||
@ -468,7 +467,7 @@ sk_sp<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) {
|
||||
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
|
||||
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
|
||||
gp = GrQuadEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), edgeType,
|
||||
*d->context()->caps(), GrTest::TestMatrix(d->fRandom),
|
||||
*d->caps(), GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool());
|
||||
} while (nullptr == gp);
|
||||
return gp;
|
||||
@ -691,7 +690,7 @@ sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
static_cast<GrPrimitiveEdgeType>(
|
||||
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
|
||||
gp = GrCubicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
|
||||
edgeType, *d->context()->caps());
|
||||
edgeType, *d->caps());
|
||||
} while (nullptr == gp);
|
||||
return gp;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "GrBicubicEffect.h"
|
||||
|
||||
#include "GrProxyMove.h"
|
||||
#include "GrTextureProxy.h"
|
||||
#include "glsl/GrGLSLColorSpaceXformHelper.h"
|
||||
@ -152,11 +153,11 @@ GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
|
||||
this->initClassID<GrBicubicEffect>();
|
||||
}
|
||||
|
||||
GrBicubicEffect::GrBicubicEffect(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
GrBicubicEffect::GrBicubicEffect(GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix &matrix,
|
||||
const SkShader::TileMode tileModes[2])
|
||||
: INHERITED{context,
|
||||
: INHERITED{resourceProvider,
|
||||
ModulationFlags(proxy->config()),
|
||||
GR_PROXY_MOVE(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
@ -166,11 +167,11 @@ GrBicubicEffect::GrBicubicEffect(GrContext* context, sk_sp<GrTextureProxy> proxy
|
||||
this->initClassID<GrBicubicEffect>();
|
||||
}
|
||||
|
||||
GrBicubicEffect::GrBicubicEffect(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
GrBicubicEffect::GrBicubicEffect(GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix &matrix,
|
||||
const SkRect& domain)
|
||||
: INHERITED(context, ModulationFlags(proxy->config()), proxy,
|
||||
: INHERITED(resourceProvider, ModulationFlags(proxy->config()), proxy,
|
||||
std::move(colorSpaceXform), matrix,
|
||||
GrSamplerParams(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode))
|
||||
, fDomain(proxy.get(), domain, GrTextureDomain::kClamp_Mode) {
|
||||
@ -203,7 +204,8 @@ sk_sp<GrFragmentProcessor> GrBicubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom);
|
||||
static const SkShader::TileMode kClampClamp[] =
|
||||
{ SkShader::kClamp_TileMode, SkShader::kClamp_TileMode };
|
||||
return GrBicubicEffect::Make(d->context(), d->textureProxy(texIdx), std::move(colorSpaceXform),
|
||||
return GrBicubicEffect::Make(d->resourceProvider(),
|
||||
d->textureProxy(texIdx), std::move(colorSpaceXform),
|
||||
SkMatrix::I(), kClampClamp);
|
||||
}
|
||||
#endif
|
||||
|
@ -51,11 +51,12 @@ public:
|
||||
/**
|
||||
* Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
|
||||
*/
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
const SkShader::TileMode tileModes[2]) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(context, std::move(proxy),
|
||||
return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix, tileModes));
|
||||
}
|
||||
@ -63,11 +64,12 @@ public:
|
||||
/**
|
||||
* Create a Mitchell filter effect with a texture matrix and a domain.
|
||||
*/
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
const SkRect& domain) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(context, std::move(proxy),
|
||||
return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix, domain));
|
||||
}
|
||||
@ -88,9 +90,9 @@ private:
|
||||
GrBicubicEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix &matrix,
|
||||
const SkRect& domain);
|
||||
|
||||
GrBicubicEffect(GrContext*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>,
|
||||
GrBicubicEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>,
|
||||
const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
|
||||
GrBicubicEffect(GrContext*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>,
|
||||
GrBicubicEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>,
|
||||
const SkMatrix &matrix, const SkRect& domain);
|
||||
|
||||
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "GrBitmapTextGeoProc.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrTexture.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "glsl/GrGLSLGeometryProcessor.h"
|
||||
@ -120,14 +119,14 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrContext* context, GrColor color,
|
||||
GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrResourceProvider* resourceProvider, GrColor color,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const GrSamplerParams& params, GrMaskFormat format,
|
||||
const SkMatrix& localMatrix, bool usesLocalCoords)
|
||||
: fColor(color)
|
||||
, fLocalMatrix(localMatrix)
|
||||
, fUsesLocalCoords(usesLocalCoords)
|
||||
, fTextureSampler(context->resourceProvider(), std::move(proxy), params)
|
||||
, fTextureSampler(resourceProvider, std::move(proxy), params)
|
||||
, fInColor(nullptr)
|
||||
, fMaskFormat(format) {
|
||||
this->initClassID<GrBitmapTextGeoProc>();
|
||||
@ -187,7 +186,8 @@ sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData*
|
||||
break;
|
||||
}
|
||||
|
||||
return GrBitmapTextGeoProc::Make(d->context(), GrRandomColor(d->fRandom), std::move(proxy),
|
||||
return GrBitmapTextGeoProc::Make(d->resourceProvider(), GrRandomColor(d->fRandom),
|
||||
std::move(proxy),
|
||||
params, format, GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool());
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ class GrInvariantOutput;
|
||||
*/
|
||||
class GrBitmapTextGeoProc : public GrGeometryProcessor {
|
||||
public:
|
||||
static sk_sp<GrGeometryProcessor> Make(GrContext* context, GrColor color,
|
||||
static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, GrColor color,
|
||||
sk_sp<GrTextureProxy> proxy, const GrSamplerParams& p,
|
||||
GrMaskFormat format, const SkMatrix& localMatrix,
|
||||
bool usesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(
|
||||
new GrBitmapTextGeoProc(context, color, std::move(proxy), p, format,
|
||||
new GrBitmapTextGeoProc(resourceProvider, color, std::move(proxy), p, format,
|
||||
localMatrix, usesLocalCoords));
|
||||
}
|
||||
|
||||
@ -48,7 +48,8 @@ public:
|
||||
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
|
||||
|
||||
private:
|
||||
GrBitmapTextGeoProc(GrContext*, GrColor, sk_sp<GrTextureProxy>, const GrSamplerParams& params,
|
||||
GrBitmapTextGeoProc(GrResourceProvider*, GrColor, sk_sp<GrTextureProxy>,
|
||||
const GrSamplerParams& params,
|
||||
GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords);
|
||||
|
||||
GrColor fColor;
|
||||
|
@ -111,13 +111,13 @@ GrConfigConversionEffect::GrConfigConversionEffect(GrTexture* texture,
|
||||
SkASSERT(swizzle != GrSwizzle::RGBA() || kNone_PMConversion != pmConversion);
|
||||
}
|
||||
|
||||
GrConfigConversionEffect::GrConfigConversionEffect(GrContext* context,
|
||||
GrConfigConversionEffect::GrConfigConversionEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy>
|
||||
proxy,
|
||||
const GrSwizzle& swizzle,
|
||||
PMConversion pmConversion,
|
||||
const SkMatrix& matrix)
|
||||
: INHERITED(context, kNone_OptimizationFlags, proxy, nullptr, matrix)
|
||||
: INHERITED(resourceProvider, kNone_OptimizationFlags, proxy, nullptr, matrix)
|
||||
, fSwizzle(swizzle)
|
||||
, fPMConversion(pmConversion) {
|
||||
this->initClassID<GrConfigConversionEffect>();
|
||||
@ -154,7 +154,7 @@ sk_sp<GrFragmentProcessor> GrConfigConversionEffect::TestCreate(GrProcessorTestD
|
||||
swizzle = GrSwizzle::CreateRandom(d->fRandom);
|
||||
} while (pmConv == kNone_PMConversion && swizzle == GrSwizzle::RGBA());
|
||||
return sk_sp<GrFragmentProcessor>(new GrConfigConversionEffect(
|
||||
d->context(),
|
||||
d->resourceProvider(),
|
||||
d->textureProxy(GrProcessorUnitTest::kSkiaPMTextureIdx),
|
||||
swizzle, pmConv, GrTest::TestMatrix(d->fRandom)));
|
||||
}
|
||||
@ -249,13 +249,13 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
||||
GrPaint paint2;
|
||||
GrPaint paint3;
|
||||
sk_sp<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect(
|
||||
context, dataProxy, GrSwizzle::RGBA(),
|
||||
context->resourceProvider(), dataProxy, GrSwizzle::RGBA(),
|
||||
*pmToUPMRule, SkMatrix::I()));
|
||||
sk_sp<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
|
||||
context, readRTC->asTextureProxyRef(), GrSwizzle::RGBA(),
|
||||
context->resourceProvider(), readRTC->asTextureProxyRef(), GrSwizzle::RGBA(),
|
||||
*upmToPMRule, SkMatrix::I()));
|
||||
sk_sp<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect(
|
||||
context, tempRTC->asTextureProxyRef(), GrSwizzle::RGBA(),
|
||||
context->resourceProvider(), tempRTC->asTextureProxyRef(), GrSwizzle::RGBA(),
|
||||
*pmToUPMRule, SkMatrix::I()));
|
||||
|
||||
paint1.addColorFragmentProcessor(std::move(pmToUPM1));
|
||||
@ -321,7 +321,7 @@ sk_sp<GrFragmentProcessor> GrConfigConversionEffect::Make(GrTexture* texture,
|
||||
}
|
||||
}
|
||||
|
||||
sk_sp<GrFragmentProcessor> GrConfigConversionEffect::Make(GrContext* context,
|
||||
sk_sp<GrFragmentProcessor> GrConfigConversionEffect::Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const GrSwizzle& swizzle,
|
||||
PMConversion pmConversion,
|
||||
@ -330,7 +330,7 @@ sk_sp<GrFragmentProcessor> GrConfigConversionEffect::Make(GrContext* context,
|
||||
// If we returned a GrConfigConversionEffect that was equivalent to a GrSimpleTextureEffect
|
||||
// then we may pollute our texture cache with redundant shaders. So in the case that no
|
||||
// conversions were requested we instead return a GrSimpleTextureEffect.
|
||||
return GrSimpleTextureEffect::Make(context, std::move(proxy), nullptr, matrix);
|
||||
return GrSimpleTextureEffect::Make(resourceProvider, std::move(proxy), nullptr, matrix);
|
||||
} else {
|
||||
if (kRGBA_8888_GrPixelConfig != proxy->config() &&
|
||||
kBGRA_8888_GrPixelConfig != proxy->config() &&
|
||||
@ -338,7 +338,8 @@ sk_sp<GrFragmentProcessor> GrConfigConversionEffect::Make(GrContext* context,
|
||||
// The PM conversions assume colors are 0..255
|
||||
return nullptr;
|
||||
}
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrConfigConversionEffect(context, std::move(proxy), swizzle, pmConversion, matrix));
|
||||
return sk_sp<GrFragmentProcessor>(new GrConfigConversionEffect(resourceProvider,
|
||||
std::move(proxy), swizzle,
|
||||
pmConversion, matrix));
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrTexture*, const GrSwizzle&, PMConversion,
|
||||
const SkMatrix&);
|
||||
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext*, sk_sp<GrTextureProxy>,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const GrSwizzle&, PMConversion, const SkMatrix&);
|
||||
|
||||
const char* name() const override { return "Config Conversion"; }
|
||||
@ -55,8 +55,8 @@ public:
|
||||
private:
|
||||
GrConfigConversionEffect(GrTexture*, const GrSwizzle&, PMConversion, const SkMatrix& matrix);
|
||||
|
||||
GrConfigConversionEffect(GrContext*, sk_sp<GrTextureProxy>, const GrSwizzle&, PMConversion,
|
||||
const SkMatrix& matrix);
|
||||
GrConfigConversionEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, const GrSwizzle&,
|
||||
PMConversion, const SkMatrix& matrix);
|
||||
|
||||
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "effects/GrCustomXfermode.h"
|
||||
|
||||
#include "GrCaps.h"
|
||||
#include "GrCoordTransform.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrFragmentProcessor.h"
|
||||
#include "GrPipeline.h"
|
||||
#include "GrProcessor.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "GrDistanceFieldGeoProc.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrTexture.h"
|
||||
#include "SkDistanceFieldGen.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -222,7 +221,7 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrContext* context,
|
||||
GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrResourceProvider* resourceProvider,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
@ -234,7 +233,7 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrContext* context,
|
||||
bool usesLocalCoords)
|
||||
: fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fTextureSampler(context->resourceProvider(), std::move(proxy), params)
|
||||
, fTextureSampler(resourceProvider, std::move(proxy), params)
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
, fDistanceAdjust(distanceAdjust)
|
||||
#endif
|
||||
@ -289,7 +288,7 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorT
|
||||
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
|
||||
}
|
||||
|
||||
return GrDistanceFieldA8TextGeoProc::Make(d->context(),
|
||||
return GrDistanceFieldA8TextGeoProc::Make(d->resourceProvider(),
|
||||
GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
std::move(proxy), params,
|
||||
@ -472,7 +471,7 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
@ -481,7 +480,7 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
|
||||
bool usesLocalCoords)
|
||||
: fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fTextureSampler(context->resourceProvider(), std::move(proxy), params)
|
||||
, fTextureSampler(resourceProvider, std::move(proxy), params)
|
||||
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
|
||||
, fInColor(nullptr)
|
||||
, fUsesLocalCoords(usesLocalCoords) {
|
||||
@ -532,7 +531,7 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes
|
||||
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
|
||||
}
|
||||
|
||||
return GrDistanceFieldPathGeoProc::Make(d->context(),
|
||||
return GrDistanceFieldPathGeoProc::Make(d->resourceProvider(),
|
||||
GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
std::move(proxy),
|
||||
@ -777,7 +776,7 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
GrColor color, const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const GrSamplerParams& params,
|
||||
@ -785,7 +784,7 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
|
||||
uint32_t flags, bool usesLocalCoords)
|
||||
: fColor(color)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fTextureSampler(context->resourceProvider(), std::move(proxy), params)
|
||||
, fTextureSampler(resourceProvider, std::move(proxy), params)
|
||||
, fDistanceAdjust(distanceAdjust)
|
||||
, fFlags(flags & kLCD_DistanceFieldEffectMask)
|
||||
, fUsesLocalCoords(usesLocalCoords) {
|
||||
@ -836,7 +835,8 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessor
|
||||
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
|
||||
}
|
||||
flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(d->context(), GrRandomColor(d->fRandom),
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(d->resourceProvider(),
|
||||
GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
std::move(proxy), params,
|
||||
wa,
|
||||
|
@ -49,23 +49,23 @@ enum GrDistanceFieldEffectFlags {
|
||||
class GrDistanceFieldA8TextGeoProc : public GrGeometryProcessor {
|
||||
public:
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
static sk_sp<GrGeometryProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
GrColor color, const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const GrSamplerParams& params,
|
||||
float lum, uint32_t flags, bool usesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(
|
||||
new GrDistanceFieldA8TextGeoProc(context, color, viewMatrix, std::move(proxy),
|
||||
new GrDistanceFieldA8TextGeoProc(resourceProvider, color, viewMatrix, std::move(proxy),
|
||||
params, lum, flags, usesLocalCoords));
|
||||
}
|
||||
#else
|
||||
static sk_sp<GrGeometryProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
GrColor color, const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const GrSamplerParams& params,
|
||||
uint32_t flags, bool usesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(
|
||||
new GrDistanceFieldA8TextGeoProc(context, color, viewMatrix, std::move(proxy),
|
||||
new GrDistanceFieldA8TextGeoProc(resourceProvider, color, viewMatrix, std::move(proxy),
|
||||
params, flags, usesLocalCoords));
|
||||
}
|
||||
#endif
|
||||
@ -90,7 +90,7 @@ public:
|
||||
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldA8TextGeoProc(GrContext*, GrColor, const SkMatrix& viewMatrix,
|
||||
GrDistanceFieldA8TextGeoProc(GrResourceProvider*, GrColor, const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params,
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float distanceAdjust,
|
||||
@ -123,12 +123,12 @@ private:
|
||||
*/
|
||||
class GrDistanceFieldPathGeoProc : public GrGeometryProcessor {
|
||||
public:
|
||||
static sk_sp<GrGeometryProcessor> Make(GrContext* context, GrColor color,
|
||||
static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, GrColor color,
|
||||
const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy,
|
||||
const GrSamplerParams& params,
|
||||
uint32_t flags, bool usesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(
|
||||
new GrDistanceFieldPathGeoProc(context, color, viewMatrix, std::move(proxy),
|
||||
new GrDistanceFieldPathGeoProc(resourceProvider, color, viewMatrix, std::move(proxy),
|
||||
params, flags, usesLocalCoords));
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public:
|
||||
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldPathGeoProc(GrContext*, GrColor, const SkMatrix& viewMatrix,
|
||||
GrDistanceFieldPathGeoProc(GrResourceProvider*, GrColor, const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy>, const GrSamplerParams&, uint32_t flags,
|
||||
bool usesLocalCoords);
|
||||
|
||||
@ -190,14 +190,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static sk_sp<GrGeometryProcessor> Make(GrContext* context, GrColor color,
|
||||
static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const GrSamplerParams& params,
|
||||
DistanceAdjust distanceAdjust, uint32_t flags,
|
||||
bool usesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(
|
||||
new GrDistanceFieldLCDTextGeoProc(context, color, viewMatrix, std::move(proxy),
|
||||
new GrDistanceFieldLCDTextGeoProc(resourceProvider, color, viewMatrix, std::move(proxy),
|
||||
params, distanceAdjust,
|
||||
flags, usesLocalCoords));
|
||||
}
|
||||
@ -220,7 +220,7 @@ public:
|
||||
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldLCDTextGeoProc(GrContext*, GrColor, const SkMatrix& viewMatrix,
|
||||
GrDistanceFieldLCDTextGeoProc(GrResourceProvider*, GrColor, const SkMatrix& viewMatrix,
|
||||
sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params,
|
||||
DistanceAdjust wa, uint32_t flags,
|
||||
bool usesLocalCoords);
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "GrGaussianConvolutionFragmentProcessor.h"
|
||||
|
||||
#include "GrProxyMove.h"
|
||||
#include "GrTextureProxy.h"
|
||||
#include "../private/GrGLSL.h"
|
||||
@ -169,14 +170,14 @@ static void fill_in_1D_guassian_kernel(float* kernel, int width, float gaussianS
|
||||
}
|
||||
|
||||
GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
|
||||
GrContext* context,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
Direction direction,
|
||||
int radius,
|
||||
float gaussianSigma,
|
||||
bool useBounds,
|
||||
int bounds[2])
|
||||
: INHERITED{context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
Direction direction,
|
||||
int radius,
|
||||
float gaussianSigma,
|
||||
bool useBounds,
|
||||
int bounds[2])
|
||||
: INHERITED{resourceProvider,
|
||||
ModulationFlags(proxy->config()),
|
||||
GR_PROXY_MOVE(proxy),
|
||||
direction,
|
||||
@ -239,6 +240,7 @@ sk_sp<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::TestCreate(
|
||||
float sigma = radius / 3.f;
|
||||
|
||||
return GrGaussianConvolutionFragmentProcessor::Make(
|
||||
d->context(), d->textureProxy(texIdx), dir, radius, sigma, useBounds, bounds);
|
||||
d->resourceProvider(), d->textureProxy(texIdx),
|
||||
dir, radius, sigma, useBounds, bounds);
|
||||
}
|
||||
#endif
|
||||
|
@ -18,7 +18,7 @@
|
||||
class GrGaussianConvolutionFragmentProcessor : public Gr1DKernelEffect {
|
||||
public:
|
||||
/// Convolve with a Gaussian kernel
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
Direction dir,
|
||||
int halfWidth,
|
||||
@ -26,7 +26,7 @@ public:
|
||||
bool useBounds,
|
||||
int* bounds) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrGaussianConvolutionFragmentProcessor(
|
||||
context, std::move(proxy), dir, halfWidth, gaussianSigma, useBounds, bounds));
|
||||
resourceProvider, std::move(proxy), dir, halfWidth, gaussianSigma, useBounds, bounds));
|
||||
}
|
||||
|
||||
~GrGaussianConvolutionFragmentProcessor() override;
|
||||
@ -49,7 +49,7 @@ public:
|
||||
|
||||
private:
|
||||
/// Convolve with a Gaussian kernel
|
||||
GrGaussianConvolutionFragmentProcessor(GrContext*, sk_sp<GrTextureProxy>, Direction,
|
||||
GrGaussianConvolutionFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, Direction,
|
||||
int halfWidth, float gaussianSigma, bool useBounds,
|
||||
int bounds[2]);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
#include "GrMatrixConvolutionEffect.h"
|
||||
|
||||
#include "GrTextureProxy.h"
|
||||
#include "glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -149,7 +150,7 @@ void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdma
|
||||
fDomain.setData(pdman, conv.domain(), texture);
|
||||
}
|
||||
|
||||
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrContext* context,
|
||||
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
@ -161,7 +162,7 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrContext* context,
|
||||
bool convolveAlpha)
|
||||
// To advertise either the modulation or opaqueness optimizations we'd have to examine the
|
||||
// parameters.
|
||||
: INHERITED(context, kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I())
|
||||
: INHERITED(resourceProvider, kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I())
|
||||
, fKernelSize(kernelSize)
|
||||
, fGain(SkScalarToFloat(gain))
|
||||
, fBias(SkScalarToFloat(bias) / 255.0f)
|
||||
@ -226,24 +227,25 @@ static void fill_in_2D_gaussian_kernel(float* kernel, int width, int height,
|
||||
|
||||
|
||||
// Static function to create a 2D convolution
|
||||
sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::MakeGaussian(GrContext* context,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
SkScalar gain,
|
||||
SkScalar bias,
|
||||
const SkIPoint& kernelOffset,
|
||||
GrTextureDomain::Mode tileMode,
|
||||
bool convolveAlpha,
|
||||
SkScalar sigmaX,
|
||||
SkScalar sigmaY) {
|
||||
sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::MakeGaussian(
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
SkScalar gain,
|
||||
SkScalar bias,
|
||||
const SkIPoint& kernelOffset,
|
||||
GrTextureDomain::Mode tileMode,
|
||||
bool convolveAlpha,
|
||||
SkScalar sigmaX,
|
||||
SkScalar sigmaY) {
|
||||
float kernel[MAX_KERNEL_SIZE];
|
||||
|
||||
fill_in_2D_gaussian_kernel(kernel, kernelSize.width(), kernelSize.height(), sigmaX, sigmaY);
|
||||
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrMatrixConvolutionEffect(context, std::move(proxy), bounds, kernelSize, kernel,
|
||||
gain, bias, kernelOffset, tileMode, convolveAlpha));
|
||||
new GrMatrixConvolutionEffect(resourceProvider, std::move(proxy), bounds, kernelSize,
|
||||
kernel, gain, bias, kernelOffset, tileMode, convolveAlpha));
|
||||
}
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect);
|
||||
@ -272,7 +274,7 @@ sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrProcessorTest
|
||||
GrTextureDomain::Mode tileMode =
|
||||
static_cast<GrTextureDomain::Mode>(d->fRandom->nextRangeU(0, 2));
|
||||
bool convolveAlpha = d->fRandom->nextBool();
|
||||
return GrMatrixConvolutionEffect::Make(d->context(),
|
||||
return GrMatrixConvolutionEffect::Make(d->resourceProvider(),
|
||||
std::move(proxy),
|
||||
bounds,
|
||||
kernelSize,
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
class GrMatrixConvolutionEffect : public GrSingleTextureEffect {
|
||||
public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
@ -28,11 +28,11 @@ public:
|
||||
GrTextureDomain::Mode tileMode,
|
||||
bool convolveAlpha) {
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrMatrixConvolutionEffect(context, std::move(proxy), bounds, kernelSize, kernel,
|
||||
gain, bias, kernelOffset, tileMode, convolveAlpha));
|
||||
new GrMatrixConvolutionEffect(resourceProvider, std::move(proxy), bounds, kernelSize,
|
||||
kernel, gain, bias, kernelOffset, tileMode, convolveAlpha));
|
||||
}
|
||||
|
||||
static sk_sp<GrFragmentProcessor> MakeGaussian(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> MakeGaussian(GrResourceProvider*,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
@ -56,7 +56,7 @@ public:
|
||||
const char* name() const override { return "MatrixConvolution"; }
|
||||
|
||||
private:
|
||||
GrMatrixConvolutionEffect(GrContext*,
|
||||
GrMatrixConvolutionEffect(GrResourceProvider*,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "GrSRGBEffect.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrFragmentProcessor.h"
|
||||
#include "GrProcessor.h"
|
||||
#include "glsl/GrGLSLFragmentProcessor.h"
|
||||
|
@ -12,11 +12,12 @@
|
||||
#include "glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
|
||||
GrSimpleTextureEffect::GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
GrSimpleTextureEffect::GrSimpleTextureEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerParams::FilterMode filterMode)
|
||||
: INHERITED{ctx,
|
||||
: INHERITED{resourceProvider,
|
||||
ModulationFlags(proxy->config()),
|
||||
GR_PROXY_MOVE(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
@ -25,11 +26,12 @@ GrSimpleTextureEffect::GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProx
|
||||
this->initClassID<GrSimpleTextureEffect>();
|
||||
}
|
||||
|
||||
GrSimpleTextureEffect::GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
GrSimpleTextureEffect::GrSimpleTextureEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
const GrSamplerParams& params)
|
||||
: INHERITED{ctx,
|
||||
: INHERITED{resourceProvider,
|
||||
ModulationFlags(proxy->config()),
|
||||
GR_PROXY_MOVE(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
@ -107,7 +109,7 @@ sk_sp<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(GrProcessorTestData
|
||||
|
||||
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom);
|
||||
return GrSimpleTextureEffect::Make(d->context(), d->textureProxy(texIdx),
|
||||
return GrSimpleTextureEffect::Make(d->resourceProvider(), d->textureProxy(texIdx),
|
||||
std::move(colorSpaceXform), matrix);
|
||||
}
|
||||
#endif
|
||||
|
@ -47,29 +47,35 @@ public:
|
||||
}
|
||||
|
||||
/* unfiltered, clamp mode */
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix) {
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrSimpleTextureEffect(ctx, std::move(proxy), std::move(colorSpaceXform), matrix,
|
||||
new GrSimpleTextureEffect(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform), matrix,
|
||||
GrSamplerParams::kNone_FilterMode));
|
||||
}
|
||||
|
||||
/* clamp mode */
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
GrSamplerParams::FilterMode filterMode) {
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrSimpleTextureEffect(ctx, std::move(proxy), std::move(colorSpaceXform),
|
||||
new GrSimpleTextureEffect(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix, filterMode));
|
||||
}
|
||||
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
const GrSamplerParams& p) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(ctx, std::move(proxy),
|
||||
return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(resourceProvider,
|
||||
std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix, p));
|
||||
}
|
||||
@ -97,13 +103,13 @@ private:
|
||||
this->initClassID<GrSimpleTextureEffect>();
|
||||
}
|
||||
|
||||
GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix,
|
||||
GrSamplerParams::FilterMode filterMode);
|
||||
GrSimpleTextureEffect(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>, const SkMatrix& matrix,
|
||||
GrSamplerParams::FilterMode);
|
||||
|
||||
GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix,
|
||||
const GrSamplerParams& params);
|
||||
GrSimpleTextureEffect(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>, const SkMatrix& matrix,
|
||||
const GrSamplerParams&);
|
||||
|
||||
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "effects/GrSingleTextureEffect.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrTextureProxy.h"
|
||||
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
|
||||
@ -46,38 +45,41 @@ GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
|
||||
this->addTextureSampler(&fTextureSampler);
|
||||
}
|
||||
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrContext* ctx, OptimizationFlags optFlags,
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrResourceProvider* resourceProvider,
|
||||
OptimizationFlags optFlags,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& m)
|
||||
: INHERITED(optFlags)
|
||||
, fCoordTransform(ctx, m, proxy.get(), GrSamplerParams::kNone_FilterMode)
|
||||
, fTextureSampler(ctx->resourceProvider(), std::move(proxy))
|
||||
, fCoordTransform(resourceProvider, m, proxy.get(), GrSamplerParams::kNone_FilterMode)
|
||||
, fTextureSampler(resourceProvider, std::move(proxy))
|
||||
, fColorSpaceXform(std::move(colorSpaceXform)) {
|
||||
this->addCoordTransform(&fCoordTransform);
|
||||
this->addTextureSampler(&fTextureSampler);
|
||||
}
|
||||
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrContext* ctx, OptimizationFlags optFlags,
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrResourceProvider* resourceProvider,
|
||||
OptimizationFlags optFlags,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& m,
|
||||
GrSamplerParams::FilterMode filterMode)
|
||||
: INHERITED(optFlags)
|
||||
, fCoordTransform(ctx, m, proxy.get(), filterMode)
|
||||
, fTextureSampler(ctx->resourceProvider(), std::move(proxy), filterMode)
|
||||
, fCoordTransform(resourceProvider, m, proxy.get(), filterMode)
|
||||
, fTextureSampler(resourceProvider, std::move(proxy), filterMode)
|
||||
, fColorSpaceXform(std::move(colorSpaceXform)) {
|
||||
this->addCoordTransform(&fCoordTransform);
|
||||
this->addTextureSampler(&fTextureSampler);
|
||||
}
|
||||
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrContext* ctx, OptimizationFlags optFlags,
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrResourceProvider* resourceProvider,
|
||||
OptimizationFlags optFlags,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& m, const GrSamplerParams& params)
|
||||
: INHERITED(optFlags)
|
||||
, fCoordTransform(ctx, m, proxy.get(), params.filterMode())
|
||||
, fTextureSampler(ctx->resourceProvider(), std::move(proxy), params)
|
||||
, fCoordTransform(resourceProvider, m, proxy.get(), params.filterMode())
|
||||
, fTextureSampler(resourceProvider, std::move(proxy), params)
|
||||
, fColorSpaceXform(std::move(colorSpaceXform)) {
|
||||
this->addCoordTransform(&fCoordTransform);
|
||||
this->addTextureSampler(&fTextureSampler);
|
||||
|
@ -44,13 +44,13 @@ protected:
|
||||
OptimizationFlags optFlags);
|
||||
|
||||
/** unfiltered, clamp mode */
|
||||
GrSingleTextureEffect(GrContext*, OptimizationFlags, sk_sp<GrTextureProxy>,
|
||||
GrSingleTextureEffect(GrResourceProvider*, OptimizationFlags, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>, const SkMatrix&);
|
||||
/** clamp mode */
|
||||
GrSingleTextureEffect(GrContext*, OptimizationFlags, sk_sp<GrTextureProxy>,
|
||||
GrSingleTextureEffect(GrResourceProvider*, OptimizationFlags, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>, const SkMatrix&,
|
||||
GrSamplerParams::FilterMode filterMode);
|
||||
GrSingleTextureEffect(GrContext*, OptimizationFlags, sk_sp<GrTextureProxy>,
|
||||
GrSingleTextureEffect(GrResourceProvider*, OptimizationFlags, sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>, const SkMatrix&, const GrSamplerParams&);
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "GrTextureDomain.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrResourceProvider.h"
|
||||
#include "GrShaderCaps.h"
|
||||
#include "GrSimpleTextureEffect.h"
|
||||
@ -273,7 +272,7 @@ GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture,
|
||||
this->initClassID<GrTextureDomainEffect>();
|
||||
}
|
||||
|
||||
sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(GrContext* context,
|
||||
sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
@ -282,23 +281,24 @@ sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(GrContext* context,
|
||||
GrSamplerParams::FilterMode filterMode) {
|
||||
if (GrTextureDomain::kIgnore_Mode == mode ||
|
||||
(GrTextureDomain::kClamp_Mode == mode && can_ignore_rect(proxy.get(), domain))) {
|
||||
return GrSimpleTextureEffect::Make(context, std::move(proxy), std::move(colorSpaceXform),
|
||||
matrix, filterMode);
|
||||
return GrSimpleTextureEffect::Make(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform), matrix, filterMode);
|
||||
} else {
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
new GrTextureDomainEffect(context, std::move(proxy), std::move(colorSpaceXform),
|
||||
new GrTextureDomainEffect(resourceProvider, std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix, domain, mode, filterMode));
|
||||
}
|
||||
}
|
||||
|
||||
GrTextureDomainEffect::GrTextureDomainEffect(GrContext* context,
|
||||
GrTextureDomainEffect::GrTextureDomainEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrix& matrix,
|
||||
const SkRect& domain,
|
||||
GrTextureDomain::Mode mode,
|
||||
GrSamplerParams::FilterMode filterMode)
|
||||
: GrSingleTextureEffect(context, OptFlags(proxy->config(), mode), proxy,
|
||||
: GrSingleTextureEffect(resourceProvider, OptFlags(proxy->config(), mode), proxy,
|
||||
std::move(colorSpaceXform), matrix, filterMode)
|
||||
, fTextureDomain(proxy.get(), domain, mode) {
|
||||
SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
|
||||
@ -376,7 +376,7 @@ sk_sp<GrFragmentProcessor> GrTextureDomainEffect::TestCreate(GrProcessorTestData
|
||||
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
|
||||
bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom);
|
||||
return GrTextureDomainEffect::Make(d->context(),
|
||||
return GrTextureDomainEffect::Make(d->resourceProvider(),
|
||||
std::move(proxy),
|
||||
std::move(colorSpaceXform),
|
||||
matrix,
|
||||
@ -408,21 +408,21 @@ GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentPro
|
||||
}
|
||||
|
||||
sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::Make(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& subset,
|
||||
const SkIPoint& deviceSpaceOffset) {
|
||||
return sk_sp<GrFragmentProcessor>(new GrDeviceSpaceTextureDecalFragmentProcessor(
|
||||
context, std::move(proxy), subset, deviceSpaceOffset));
|
||||
resourceProvider, std::move(proxy), subset, deviceSpaceOffset));
|
||||
}
|
||||
|
||||
GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor(
|
||||
GrContext* context,
|
||||
GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const SkIRect& subset,
|
||||
const SkIPoint& deviceSpaceOffset)
|
||||
: INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
|
||||
, fTextureSampler(context->resourceProvider(), proxy, GrSamplerParams::ClampNoFilter())
|
||||
, fTextureSampler(resourceProvider, proxy, GrSamplerParams::ClampNoFilter())
|
||||
, fTextureDomain(proxy.get(), GrTextureDomain::MakeTexelDomain(subset),
|
||||
GrTextureDomain::kDecal_Mode) {
|
||||
this->addTextureSampler(&fTextureSampler);
|
||||
@ -508,7 +508,7 @@ sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::TestCreat
|
||||
SkIPoint pt;
|
||||
pt.fX = d->fRandom->nextULessThan(2048);
|
||||
pt.fY = d->fRandom->nextULessThan(2048);
|
||||
return GrDeviceSpaceTextureDecalFragmentProcessor::Make(d->context(),
|
||||
return GrDeviceSpaceTextureDecalFragmentProcessor::Make(d->resourceProvider(),
|
||||
std::move(proxy), subset, pt);
|
||||
}
|
||||
#endif
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
GrTextureDomain::Mode,
|
||||
GrSamplerParams::FilterMode filterMode);
|
||||
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext*,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider*,
|
||||
sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>,
|
||||
const SkMatrix&,
|
||||
@ -189,7 +189,7 @@ private:
|
||||
GrTextureDomain::Mode,
|
||||
GrSamplerParams::FilterMode);
|
||||
|
||||
GrTextureDomainEffect(GrContext*,
|
||||
GrTextureDomainEffect(GrResourceProvider*,
|
||||
sk_sp<GrTextureProxy>,
|
||||
sk_sp<GrColorSpaceXform>,
|
||||
const SkMatrix&,
|
||||
@ -215,7 +215,8 @@ public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrTexture*, const SkIRect& subset,
|
||||
const SkIPoint& deviceSpaceOffset);
|
||||
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext*, sk_sp<GrTextureProxy>, const SkIRect& subset,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkIRect& subset,
|
||||
const SkIPoint& deviceSpaceOffset);
|
||||
|
||||
const char* name() const override { return "GrDeviceSpaceTextureDecalFragmentProcessor"; }
|
||||
@ -237,7 +238,7 @@ private:
|
||||
|
||||
GrDeviceSpaceTextureDecalFragmentProcessor(GrTexture*, const SkIRect&, const SkIPoint&);
|
||||
|
||||
GrDeviceSpaceTextureDecalFragmentProcessor(GrContext*, sk_sp<GrTextureProxy>,
|
||||
GrDeviceSpaceTextureDecalFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>,
|
||||
const SkIRect&, const SkIPoint&);
|
||||
|
||||
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "GrYUVEffect.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrCoordTransform.h"
|
||||
#include "GrFragmentProcessor.h"
|
||||
#include "GrProcessor.h"
|
||||
@ -63,7 +62,7 @@ static const float kRec709InverseConversionMatrix[16] = {
|
||||
|
||||
class YUVtoRGBEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
static sk_sp<GrFragmentProcessor> Make(GrContext* context,
|
||||
static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> yProxy,
|
||||
sk_sp<GrTextureProxy> uProxy,
|
||||
sk_sp<GrTextureProxy> vProxy, const SkISize sizes[3],
|
||||
@ -88,7 +87,7 @@ public:
|
||||
GrSamplerParams::kBilerp_FilterMode :
|
||||
GrSamplerParams::kNone_FilterMode;
|
||||
return sk_sp<GrFragmentProcessor>(new YUVtoRGBEffect(
|
||||
context, std::move(yProxy), std::move(uProxy), std::move(vProxy),
|
||||
resourceProvider, std::move(yProxy), std::move(uProxy), std::move(vProxy),
|
||||
yuvMatrix, uvFilterMode, colorSpace, nv12));
|
||||
}
|
||||
|
||||
@ -154,15 +153,17 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
YUVtoRGBEffect(GrContext* ctx, sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy,
|
||||
YUVtoRGBEffect(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy,
|
||||
sk_sp<GrTextureProxy> vProxy, const SkMatrix yuvMatrix[3],
|
||||
GrSamplerParams::FilterMode uvFilterMode, SkYUVColorSpace colorSpace, bool nv12)
|
||||
: INHERITED(kPreservesOpaqueInput_OptimizationFlag)
|
||||
, fYTransform(ctx, yuvMatrix[0], yProxy.get(), GrSamplerParams::kNone_FilterMode)
|
||||
, fYSampler(ctx->resourceProvider(), std::move(yProxy))
|
||||
, fUTransform(ctx, yuvMatrix[1], uProxy.get(), uvFilterMode)
|
||||
, fUSampler(ctx->resourceProvider(), std::move(uProxy), uvFilterMode)
|
||||
, fVSampler(ctx->resourceProvider(), vProxy, uvFilterMode)
|
||||
, fYTransform(resourceProvider, yuvMatrix[0], yProxy.get(),
|
||||
GrSamplerParams::kNone_FilterMode)
|
||||
, fYSampler(resourceProvider, std::move(yProxy))
|
||||
, fUTransform(resourceProvider, yuvMatrix[1], uProxy.get(), uvFilterMode)
|
||||
, fUSampler(resourceProvider, std::move(uProxy), uvFilterMode)
|
||||
, fVSampler(resourceProvider, vProxy, uvFilterMode)
|
||||
, fColorSpace(colorSpace)
|
||||
, fNV12(nv12) {
|
||||
this->initClassID<YUVtoRGBEffect>();
|
||||
@ -171,7 +172,8 @@ private:
|
||||
this->addCoordTransform(&fUTransform);
|
||||
this->addTextureSampler(&fUSampler);
|
||||
if (!fNV12) {
|
||||
fVTransform = GrCoordTransform(ctx, yuvMatrix[2], vProxy.get(), uvFilterMode);
|
||||
fVTransform = GrCoordTransform(resourceProvider, yuvMatrix[2], vProxy.get(),
|
||||
uvFilterMode);
|
||||
this->addCoordTransform(&fVTransform);
|
||||
this->addTextureSampler(&fVSampler);
|
||||
}
|
||||
@ -360,14 +362,14 @@ private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<GrFragmentProcessor> GrYUVEffect::MakeYUVToRGB(GrContext* context,
|
||||
sk_sp<GrFragmentProcessor> GrYUVEffect::MakeYUVToRGB(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> yProxy,
|
||||
sk_sp<GrTextureProxy> uProxy,
|
||||
sk_sp<GrTextureProxy> vProxy,
|
||||
const SkISize sizes[3],
|
||||
SkYUVColorSpace colorSpace, bool nv12) {
|
||||
SkASSERT(yProxy && uProxy && vProxy && sizes);
|
||||
return YUVtoRGBEffect::Make(context,
|
||||
return YUVtoRGBEffect::Make(resourceProvider,
|
||||
std::move(yProxy), std::move(uProxy), std::move(vProxy),
|
||||
sizes, colorSpace, nv12);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "SkImageInfo.h"
|
||||
|
||||
class GrContext;
|
||||
class GrResourceProvider;
|
||||
class GrFragmentProcessor;
|
||||
class GrTextureProxy;
|
||||
|
||||
@ -19,7 +19,7 @@ namespace GrYUVEffect {
|
||||
* Creates an effect that performs color conversion from YUV to RGB. The input textures are
|
||||
* assumed to be kA8_GrPixelConfig.
|
||||
*/
|
||||
sk_sp<GrFragmentProcessor> MakeYUVToRGB(GrContext* context,
|
||||
sk_sp<GrFragmentProcessor> MakeYUVToRGB(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> yProxy,
|
||||
sk_sp<GrTextureProxy> uProxy,
|
||||
sk_sp<GrTextureProxy> vProxy, const SkISize sizes[3],
|
||||
|
@ -656,7 +656,7 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect);
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
|
||||
// Doesn't work without derivative instructions.
|
||||
return d->context()->caps()->shaderCaps()->shaderDerivativeSupport()
|
||||
return d->caps()->shaderCaps()->shaderDerivativeSupport()
|
||||
? QuadEdgeEffect::Make(GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool())
|
||||
|
@ -234,7 +234,8 @@ private:
|
||||
flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
|
||||
flags |= fGammaCorrect ? kGammaCorrect_DistanceFieldEffectFlag : 0;
|
||||
|
||||
flushInfo.fGeometryProcessor = GrDistanceFieldPathGeoProc::Make(atlas->context(),
|
||||
flushInfo.fGeometryProcessor = GrDistanceFieldPathGeoProc::Make(
|
||||
atlas->context()->resourceProvider(),
|
||||
this->color(), this->viewMatrix(), atlas->getProxy(), params, flags,
|
||||
this->usesLocalCoords());
|
||||
} else {
|
||||
@ -251,7 +252,8 @@ private:
|
||||
invert.preTranslate(-fShapes[0].fTranslate.fX, -fShapes[0].fTranslate.fY);
|
||||
}
|
||||
|
||||
flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(atlas->context(),
|
||||
flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(
|
||||
atlas->context()->resourceProvider(),
|
||||
this->color(), atlas->getProxy(), params, kA8_GrMaskFormat, invert,
|
||||
this->usesLocalCoords());
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "GrAtlasTextOp.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrOpFlushState.h"
|
||||
#include "GrResourceProvider.h"
|
||||
|
||||
@ -93,12 +94,13 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) const {
|
||||
FlushInfo flushInfo;
|
||||
if (this->usesDistanceFields()) {
|
||||
flushInfo.fGeometryProcessor =
|
||||
this->setupDfProcessor(fFontCache->context(), this->viewMatrix(),
|
||||
this->setupDfProcessor(fFontCache->context()->resourceProvider(),
|
||||
this->viewMatrix(),
|
||||
fFilteredColor, this->color(), std::move(proxy));
|
||||
} else {
|
||||
GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode);
|
||||
flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(
|
||||
fFontCache->context(),
|
||||
fFontCache->context()->resourceProvider(),
|
||||
this->color(), std::move(proxy), params,
|
||||
maskFormat, localMatrix, this->usesLocalCoords());
|
||||
}
|
||||
@ -217,7 +219,7 @@ bool GrAtlasTextOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
||||
|
||||
// TODO just use class params
|
||||
// TODO trying to figure out why lcd is so whack
|
||||
sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(GrContext* context,
|
||||
sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(GrResourceProvider* resourceProvider,
|
||||
const SkMatrix& viewMatrix,
|
||||
SkColor filteredColor,
|
||||
GrColor color,
|
||||
@ -249,7 +251,8 @@ sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(GrContext* context,
|
||||
GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(
|
||||
redCorrection, greenCorrection, blueCorrection);
|
||||
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(context, color, viewMatrix, std::move(proxy),
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(resourceProvider,
|
||||
color, viewMatrix, std::move(proxy),
|
||||
params, widthAdjust, flags,
|
||||
this->usesLocalCoords());
|
||||
} else {
|
||||
@ -257,11 +260,13 @@ sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(GrContext* context,
|
||||
U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT, filteredColor);
|
||||
float correction = fDistanceAdjustTable->getAdjustment(lum >> kDistanceAdjustLumShift,
|
||||
fUseGammaCorrectDistanceTable);
|
||||
return GrDistanceFieldA8TextGeoProc::Make(context, color, viewMatrix, std::move(proxy),
|
||||
return GrDistanceFieldA8TextGeoProc::Make(resourceProvider, color,
|
||||
viewMatrix, std::move(proxy),
|
||||
params, correction, flags,
|
||||
this->usesLocalCoords());
|
||||
#else
|
||||
return GrDistanceFieldA8TextGeoProc::Make(context, color, viewMatrix, std::move(proxy),
|
||||
return GrDistanceFieldA8TextGeoProc::Make(resourceProvider, color,
|
||||
viewMatrix, std::move(proxy),
|
||||
params, flags, this->usesLocalCoords());
|
||||
#endif
|
||||
}
|
||||
|
@ -148,8 +148,8 @@ private:
|
||||
|
||||
// TODO just use class params
|
||||
// TODO trying to figure out why lcd is so whack
|
||||
sk_sp<GrGeometryProcessor> setupDfProcessor(GrContext*, const
|
||||
SkMatrix& viewMatrix, SkColor filteredColor,
|
||||
sk_sp<GrGeometryProcessor> setupDfProcessor(GrResourceProvider*,
|
||||
const SkMatrix& viewMatrix, SkColor filteredColor,
|
||||
GrColor color, sk_sp<GrTextureProxy> proxy) const;
|
||||
|
||||
GrColor fColor;
|
||||
|
@ -123,6 +123,7 @@ void SkImageShader::toString(SkString* str) const {
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include "SkGr.h"
|
||||
#include "GrContext.h"
|
||||
#include "effects/GrSimpleTextureEffect.h"
|
||||
#include "effects/GrBicubicEffect.h"
|
||||
#include "effects/GrSimpleTextureEffect.h"
|
||||
@ -169,10 +170,10 @@ sk_sp<GrFragmentProcessor> SkImageShader::asFragmentProcessor(const AsFPArgs& ar
|
||||
args.fDstColorSpace);
|
||||
sk_sp<GrFragmentProcessor> inner;
|
||||
if (doBicubic) {
|
||||
inner = GrBicubicEffect::Make(args.fContext, std::move(proxy), std::move(colorSpaceXform),
|
||||
lmInverse, tm);
|
||||
inner = GrBicubicEffect::Make(args.fContext->resourceProvider(), std::move(proxy),
|
||||
std::move(colorSpaceXform), lmInverse, tm);
|
||||
} else {
|
||||
inner = GrSimpleTextureEffect::Make(args.fContext, std::move(proxy),
|
||||
inner = GrSimpleTextureEffect::Make(args.fContext->resourceProvider(), std::move(proxy),
|
||||
std::move(colorSpaceXform), lmInverse, params);
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
|
||||
GrPaint paint;
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
paint.addColorFragmentProcessor(
|
||||
GrYUVEffect::MakeYUVToRGB(ctx,
|
||||
GrYUVEffect::MakeYUVToRGB(ctx->resourceProvider(),
|
||||
sk_ref_sp(yProxy->asTextureProxy()),
|
||||
sk_ref_sp(uProxy->asTextureProxy()),
|
||||
sk_ref_sp(vProxy->asTextureProxy()), yuvSizes, colorSpace, nv12));
|
||||
@ -862,7 +862,7 @@ sk_sp<SkImage> SkImage_Gpu::onMakeColorSpace(sk_sp<SkColorSpace> colorSpace) con
|
||||
|
||||
GrPaint paint;
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
paint.addColorTextureProcessor(fContext, fProxy, nullptr, SkMatrix::I());
|
||||
paint.addColorTextureProcessor(fContext->resourceProvider(), fProxy, nullptr, SkMatrix::I());
|
||||
paint.addColorFragmentProcessor(std::move(xform));
|
||||
|
||||
const SkRect rect = SkRect::MakeIWH(this->width(), this->height());
|
||||
|
@ -256,10 +256,13 @@ static GrColor texel_color(int i, int j) {
|
||||
|
||||
static GrColor4f texel_color4f(int i, int j) { return GrColor4f::FromGrColor(texel_color(i, j)); }
|
||||
|
||||
void test_draw_op(GrContext* context, GrRenderTargetContext* rtc, sk_sp<GrFragmentProcessor> fp,
|
||||
void test_draw_op(GrRenderTargetContext* rtc, sk_sp<GrFragmentProcessor> fp,
|
||||
sk_sp<GrTextureProxy> inputDataProxy) {
|
||||
GrResourceProvider* resourceProvider = rtc->resourceProvider();
|
||||
|
||||
GrPaint paint;
|
||||
paint.addColorTextureProcessor(context, std::move(inputDataProxy), nullptr, SkMatrix::I());
|
||||
paint.addColorTextureProcessor(resourceProvider, std::move(inputDataProxy),
|
||||
nullptr, SkMatrix::I());
|
||||
paint.addColorFragmentProcessor(std::move(fp));
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
GrPipelineBuilder pb(std::move(paint), GrAAType::kNone);
|
||||
@ -337,7 +340,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
|
||||
!fp->compatibleWithCoverageAsAlpha()) {
|
||||
continue;
|
||||
}
|
||||
test_draw_op(context, rtc.get(), fp, dataProxy);
|
||||
test_draw_op(rtc.get(), fp, dataProxy);
|
||||
memset(rgbaData.get(), 0x0, sizeof(GrColor) * 256 * 256);
|
||||
rtc->readPixels(
|
||||
SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType),
|
||||
|
@ -29,7 +29,7 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont
|
||||
GrSamplerParams::kMipMap_FilterMode}) {
|
||||
rtContext->clear(nullptr, 0xDDCCBBAA, true);
|
||||
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(
|
||||
context,
|
||||
context->resourceProvider(),
|
||||
sk_ref_sp(rectProxy->asTextureProxy()),
|
||||
nullptr,
|
||||
SkMatrix::I(), filter));
|
||||
|
@ -136,7 +136,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
|
||||
GrPaint paint;
|
||||
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
|
||||
GrSamplerParams mipMapParams(SkShader::kRepeat_TileMode, GrSamplerParams::kMipMap_FilterMode);
|
||||
paint.addColorTextureProcessor(context, std::move(proxy),
|
||||
paint.addColorTextureProcessor(context->resourceProvider(), std::move(proxy),
|
||||
nullptr, SkMatrix::MakeScale(rtS), mipMapParams);
|
||||
|
||||
// 1) Draw texture to S32 surface (should generate/use sRGB mips)
|
||||
|
Loading…
Reference in New Issue
Block a user