aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp17
-rw-r--r--src/effects/SkBlurMaskFilter.cpp76
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp20
-rw-r--r--src/effects/SkLightingImageFilter.cpp48
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp1
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp1
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp58
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp20
8 files changed, 118 insertions, 123 deletions
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index bbae2e1552..b1c8b21460 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -16,7 +16,7 @@
#if SK_SUPPORT_GPU
#include "GrAlphaThresholdFragmentProcessor.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#endif
@@ -97,28 +97,25 @@ sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* contex
const SkMatrix& inMatrix,
const SkIRect& bounds) const {
- sk_sp<GrDrawContext> drawContext(context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- bounds.width(),
- bounds.height(),
- kAlpha_8_GrPixelConfig,
- nullptr));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox, bounds.width(), bounds.height(), kAlpha_8_GrPixelConfig, nullptr));
+ if (!renderTargetContext) {
return nullptr;
}
GrPaint grPaint;
grPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkRegion::Iterator iter(fRegion);
- drawContext->clear(nullptr, 0x0, true);
+ renderTargetContext->clear(nullptr, 0x0, true);
GrFixedClip clip(SkIRect::MakeWH(bounds.width(), bounds.height()));
while (!iter.done()) {
SkRect rect = SkRect::Make(iter.rect());
- drawContext->drawRect(clip, grPaint, inMatrix, rect);
+ renderTargetContext->drawRect(clip, grPaint, inMatrix, rect);
iter.next();
}
- return drawContext->asTexture();
+ return renderTargetContext->asTexture();
}
#endif
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index c32e111f29..e7f660148a 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -18,7 +18,7 @@
#if SK_SUPPORT_GPU
#include "GrCircleBlurFragmentProcessor.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrTexture.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
@@ -50,14 +50,14 @@ public:
const SkMatrix& ctm,
SkRect* maskRect) const override;
bool directFilterMaskGPU(GrTextureProvider* texProvider,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
const SkStrokeRec& strokeRec,
const SkPath& path) const override;
bool directFilterRRectMaskGPU(GrContext*,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
@@ -1011,13 +1011,13 @@ sk_sp<GrFragmentProcessor> GrRectBlurEffect::TestCreate(GrProcessorTestData* d)
bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkStrokeRec& strokeRec,
const SkPath& path) const {
- SkASSERT(drawContext);
+ SkASSERT(renderTargetContext);
if (fBlurStyle != kNormal_SkBlurStyle) {
return false;
@@ -1059,7 +1059,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
return false;
}
- drawContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), rect, inverse);
+ renderTargetContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), rect, inverse);
return true;
}
@@ -1121,34 +1121,33 @@ static sk_sp<GrTexture> find_or_create_rrect_blur_mask(GrContext* context,
sk_sp<GrTexture> mask(context->textureProvider()->findAndRefTextureByUniqueKey(key));
if (!mask) {
// TODO: this could be approx but the texture coords will need to be updated
- sk_sp<GrDrawContext> dc(context->makeDrawContextWithFallback(SkBackingFit::kExact,
- size.fWidth, size.fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kExact, size.fWidth, size.fHeight, kAlpha_8_GrPixelConfig, nullptr));
+ if (!rtc) {
return nullptr;
}
GrPaint grPaint;
grPaint.setAntiAlias(doAA);
- dc->clear(nullptr, 0x0, true);
- dc->drawRRect(GrNoClip(), grPaint, SkMatrix::I(), rrectToDraw, GrStyle::SimpleFill());
-
- sk_sp<GrTexture> srcTexture(dc->asTexture());
- sk_sp<GrDrawContext> dc2(SkGpuBlurUtils::GaussianBlur(context,
- srcTexture.get(),
- nullptr,
- SkIRect::MakeWH(size.fWidth,
- size.fHeight),
- nullptr,
- xformedSigma, xformedSigma,
- SkBackingFit::kExact));
- if (!dc2) {
+ rtc->clear(nullptr, 0x0, true);
+ rtc->drawRRect(GrNoClip(), grPaint, SkMatrix::I(), rrectToDraw, GrStyle::SimpleFill());
+
+ sk_sp<GrTexture> srcTexture(rtc->asTexture());
+ sk_sp<GrRenderTargetContext> rtc2(SkGpuBlurUtils::GaussianBlur(context,
+ srcTexture.get(),
+ nullptr,
+ SkIRect::MakeWH(
+ size.fWidth,
+ size.fHeight),
+ nullptr,
+ xformedSigma, xformedSigma,
+ SkBackingFit::kExact));
+ if (!rtc2) {
return nullptr;
}
- mask = dc2->asTexture();
+ mask = rtc2->asTexture();
SkASSERT(mask);
context->textureProvider()->assignUniqueKeyToTexture(key, mask.get());
}
@@ -1333,14 +1332,14 @@ GrGLSLFragmentProcessor* GrRRectBlurEffect::onCreateGLSLInstance() const {
}
bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkStrokeRec& strokeRec,
const SkRRect& srcRRect,
const SkRRect& devRRect) const {
- SkASSERT(drawContext);
+ SkASSERT(renderTargetContext);
if (fBlurStyle != kNormal_SkBlurStyle) {
return false;
@@ -1380,7 +1379,7 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
SkRect srcProxyRect = srcRRect.rect();
srcProxyRect.outset(3.0f*fSigma, 3.0f*fSigma);
- drawContext->drawRect(clip, newPaint, viewMatrix, srcProxyRect);
+ renderTargetContext->drawRect(clip, newPaint, viewMatrix, srcProxyRect);
return true;
}
@@ -1425,8 +1424,8 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
numIndices = 6;
}
- drawContext->drawVertices(clip, newPaint, viewMatrix, kTriangles_GrPrimitiveType,
- numPoints, points, nullptr, nullptr, indices, numIndices);
+ renderTargetContext->drawVertices(clip, newPaint, viewMatrix, kTriangles_GrPrimitiveType,
+ numPoints, points, nullptr, nullptr, indices, numIndices);
} else {
SkMatrix inverse;
@@ -1439,7 +1438,8 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
proxyRect.outset(extra, extra);
- drawContext->fillRectWithLocalMatrix(clip, newPaint, SkMatrix::I(), proxyRect, inverse);
+ renderTargetContext->fillRectWithLocalMatrix(clip, newPaint, SkMatrix::I(), proxyRect,
+ inverse);
}
return true;
@@ -1502,10 +1502,12 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
// If we're doing a normal blur, we can clobber the pathTexture in the
// gaussianBlur. Otherwise, we need to save it for later compositing.
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
- sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src, nullptr,
- clipRect, nullptr,
- xformedSigma, xformedSigma));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(SkGpuBlurUtils::GaussianBlur(context, src,
+ nullptr, clipRect,
+ nullptr,
+ xformedSigma,
+ xformedSigma));
+ if (!renderTargetContext) {
return false;
}
@@ -1530,10 +1532,10 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
paint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
}
- drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::Make(clipRect));
+ renderTargetContext->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::Make(clipRect));
}
- *result = drawContext->asTexture().release();
+ *result = renderTargetContext->asTexture().release();
return true;
}
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 88f5026663..d73b440a75 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -15,7 +15,7 @@
#include "SkColorPriv.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrCoordTransform.h"
#include "GrInvariantOutput.h"
#include "SkGr.h"
@@ -348,23 +348,23 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y()));
SkColorSpace* colorSpace = ctx.outputProperties().colorSpace();
- sk_sp<GrDrawContext> drawContext(
- context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(),
- GrRenderableConfigForColorSpace(colorSpace),
- sk_ref_sp(colorSpace)));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(
+ context->makeRenderTargetContext(SkBackingFit::kApprox, bounds.width(), bounds.height(),
+ GrRenderableConfigForColorSpace(colorSpace),
+ sk_ref_sp(colorSpace)));
+ if (!renderTargetContext) {
return nullptr;
}
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
- drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBounds));
+ renderTargetContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBounds));
offset->fX = bounds.left();
offset->fY = bounds.top();
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()));
+ renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()));
}
#endif
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 057ef24e95..fc106911b7 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -16,7 +16,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
@@ -369,7 +369,7 @@ protected:
#endif
private:
#if SK_SUPPORT_GPU
- void drawRect(GrDrawContext* drawContext,
+ void drawRect(GrRenderTargetContext* renderTargetContext,
GrTexture* src,
const SkMatrix& matrix,
const GrClip& clip,
@@ -382,7 +382,7 @@ private:
};
#if SK_SUPPORT_GPU
-void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext,
+void SkLightingImageFilterInternal::drawRect(GrRenderTargetContext* renderTargetContext,
GrTexture* src,
const SkMatrix& matrix,
const GrClip& clip,
@@ -392,12 +392,12 @@ void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext,
const SkIRect& bounds) const {
SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()));
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(src, matrix, srcBounds,
boundaryMode));
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
+ renderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
}
sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
@@ -413,11 +413,11 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
sk_sp<GrTexture> inputTexture(input->asTextureRef(context));
SkASSERT(inputTexture);
- sk_sp<GrDrawContext> drawContext(
- context->makeDrawContext(SkBackingFit::kApprox,offsetBounds.width(), offsetBounds.height(),
- GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
- sk_ref_sp(outputProperties.colorSpace())));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox,offsetBounds.width(), offsetBounds.height(),
+ GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
+ sk_ref_sp(outputProperties.colorSpace())));
+ if (!renderTargetContext) {
return nullptr;
}
@@ -439,29 +439,29 @@ 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(drawContext.get(), inputTexture.get(), matrix, clip, topLeft,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, topLeft,
kTopLeft_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, top, kTop_BoundaryMode,
- pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, topRight,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, top,
+ kTop_BoundaryMode, pSrcBounds, offsetBounds);
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, topRight,
kTopRight_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, left, kLeft_BoundaryMode,
- pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, interior,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, left,
+ kLeft_BoundaryMode, pSrcBounds, offsetBounds);
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, interior,
kInterior_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, right, kRight_BoundaryMode,
- pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomLeft,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, right,
+ kRight_BoundaryMode, pSrcBounds, offsetBounds);
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, bottomLeft,
kBottomLeft_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottom,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, bottom,
kBottom_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRight,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, bottomRight,
kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()));
+ renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()));
}
#endif
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index c546730e80..ccff378cee 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -17,7 +17,6 @@
////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
#include "GrInvariantOutput.h"
#include "effects/GrSingleTextureEffect.h"
#include "glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 5477d7ab7e..fe6d8acbbe 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -17,7 +17,6 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
#include "effects/GrMatrixConvolutionEffect.h"
#endif
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 2bd792860b..630f782f90 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -17,7 +17,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#include "GrInvariantOutput.h"
#include "GrTexture.h"
@@ -385,7 +385,7 @@ sk_sp<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorTestData* d
}
-static void apply_morphology_rect(GrDrawContext* drawContext,
+static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrTexture* texture,
const SkIRect& srcRect,
@@ -395,18 +395,18 @@ static void apply_morphology_rect(GrDrawContext* drawContext,
float bounds[2],
Gr1DKernelEffect::Direction direction) {
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture,
direction,
radius,
morphType,
bounds));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
- SkRect::Make(srcRect));
+ renderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
+ SkRect::Make(srcRect));
}
-static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext,
+static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrTexture* texture,
const SkIRect& srcRect,
@@ -415,15 +415,15 @@ static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext,
GrMorphologyEffect::MorphologyType morphType,
Gr1DKernelEffect::Direction direction) {
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture, direction, radius,
morphType));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
- SkRect::Make(srcRect));
+ renderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
+ SkRect::Make(srcRect));
}
-static void apply_morphology_pass(GrDrawContext* drawContext,
+static void apply_morphology_pass(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrTexture* texture,
const SkIRect& srcRect,
@@ -456,16 +456,16 @@ static void apply_morphology_pass(GrDrawContext* drawContext,
}
if (middleSrcRect.fLeft - middleSrcRect.fRight >= 0) {
// radius covers srcRect; use bounds over entire draw
- apply_morphology_rect(drawContext, clip, texture, srcRect, dstRect, radius,
+ apply_morphology_rect(renderTargetContext, clip, texture, srcRect, dstRect, radius,
morphType, bounds, direction);
} else {
// Draw upper and lower margins with bounds; middle without.
- apply_morphology_rect(drawContext, clip, texture, lowerSrcRect, lowerDstRect, radius,
- morphType, bounds, direction);
- apply_morphology_rect(drawContext, clip, texture, upperSrcRect, upperDstRect, radius,
- morphType, bounds, direction);
- apply_morphology_rect_no_bounds(drawContext, clip, texture, middleSrcRect, middleDstRect,
- radius, morphType, direction);
+ apply_morphology_rect(renderTargetContext, clip, texture, lowerSrcRect, lowerDstRect,
+ radius, morphType, bounds, direction);
+ apply_morphology_rect(renderTargetContext, clip, texture, upperSrcRect, upperDstRect,
+ radius, morphType, bounds, direction);
+ apply_morphology_rect_no_bounds(renderTargetContext, clip, texture, middleSrcRect,
+ middleDstRect, radius, morphType, direction);
}
}
@@ -490,14 +490,13 @@ static sk_sp<SkSpecialImage> apply_morphology(
SkASSERT(radius.width() > 0 || radius.height() > 0);
if (radius.fWidth > 0) {
- sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox,
- rect.width(), rect.height(),
- config, colorSpace));
- if (!dstDrawContext) {
+ sk_sp<GrRenderTargetContext> dstRenderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, rect.width(), rect.height(), config, colorSpace));
+ if (!dstRenderTargetContext) {
return nullptr;
}
- apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(),
+ apply_morphology_pass(dstRenderTargetContext.get(), clip, srcTexture.get(),
srcRect, dstRect, radius.fWidth, morphType,
Gr1DKernelEffect::kX_Direction);
SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
@@ -505,24 +504,23 @@ static sk_sp<SkSpecialImage> apply_morphology(
GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphType
? SK_ColorWHITE
: SK_ColorTRANSPARENT;
- dstDrawContext->clear(&clearRect, clearColor, false);
+ dstRenderTargetContext->clear(&clearRect, clearColor, false);
- srcTexture = dstDrawContext->asTexture();
+ srcTexture = dstRenderTargetContext->asTexture();
srcRect = dstRect;
}
if (radius.fHeight > 0) {
- sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox,
- rect.width(), rect.height(),
- config, colorSpace));
- if (!dstDrawContext) {
+ sk_sp<GrRenderTargetContext> dstRenderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, rect.width(), rect.height(), config, colorSpace));
+ if (!dstRenderTargetContext) {
return nullptr;
}
- apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(),
+ apply_morphology_pass(dstRenderTargetContext.get(), clip, srcTexture.get(),
srcRect, dstRect, radius.fHeight, morphType,
Gr1DKernelEffect::kY_Direction);
- srcTexture = dstDrawContext->asTexture();
+ srcTexture = dstRenderTargetContext->asTexture();
}
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 2ceba4b385..6587b749f9 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -17,7 +17,7 @@
#include "SkXfermode.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "effects/GrConstColorProcessor.h"
#include "effects/GrTextureDomain.h"
#include "effects/GrSimpleTextureEffect.h"
@@ -301,23 +301,23 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- sk_sp<GrDrawContext> drawContext(
- context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(),
- GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
- sk_ref_sp(outputProperties.colorSpace())));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, bounds.width(), bounds.height(),
+ GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
+ sk_ref_sp(outputProperties.colorSpace())));
+ if (!renderTargetContext) {
return nullptr;
}
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
- drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
+ renderTargetContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()));
+ renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()));
}
sk_sp<GrFragmentProcessor>