Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1178)

Unified Diff: src/effects/SkBlurMaskFilter.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkArithmeticMode_gpu.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkBlurMaskFilter.cpp
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 2ec5b90a409ba8a8338e35e6de63a38a2a3f2ac2..0098366b2fbb1aa1fd3d4bde551f3a29e889d085 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -612,7 +612,7 @@ public:
const char* name() const override { return "RectBlur"; }
static GrFragmentProcessor* Create(GrTextureProvider *textureProvider,
- const SkRect& rect, float sigma) {
+ const SkRect& rect, float sigma, GrRenderTarget* dst) {
int doubleProfileSize = SkScalarCeilToInt(12*sigma);
if (doubleProfileSize >= rect.width() || doubleProfileSize >= rect.height()) {
@@ -645,7 +645,7 @@ public:
else {
precision = kDefault_GrSLPrecision;
}
- return new GrRectBlurEffect(rect, sigma, blurProfile, precision);
+ return new GrRectBlurEffect(rect, sigma, blurProfile, precision, dst);
}
const SkRect& getRect() const { return fRect; }
@@ -653,7 +653,7 @@ public:
private:
GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blurProfile,
- GrSLPrecision fPrecision);
+ GrSLPrecision fPrecision, GrRenderTarget* dstRT);
GrGLFragmentProcessor* onCreateGLInstance() const override;
@@ -800,16 +800,17 @@ GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
if (blurProfile) {
textureProvider->assignUniqueKeyToTexture(key, blurProfile);
}
+ blurProfile->setFromRawPixels(true);
}
return blurProfile;
}
GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blurProfile,
- GrSLPrecision precision)
+ GrSLPrecision precision, GrRenderTarget* dst)
: fRect(rect)
, fSigma(sigma)
- , fBlurProfileAccess(blurProfile)
+ , fBlurProfileAccess(blurProfile, GrTextureParams::kNone_FilterMode,SkShader::kClamp_TileMode, dst)
, fPrecision(precision) {
this->initClassID<GrRectBlurEffect>();
this->addTextureAccess(&fBlurProfileAccess);
@@ -841,7 +842,7 @@ const GrFragmentProcessor* GrRectBlurEffect::TestCreate(GrProcessorTestData* d)
float width = d->fRandom->nextRangeF(200,300);
float height = d->fRandom->nextRangeF(200,300);
return GrRectBlurEffect::Create(d->fContext->textureProvider(), SkRect::MakeWH(width, height),
- sigma);
+ sigma, NULL);
}
@@ -872,9 +873,9 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
int pad = SkScalarCeilToInt(6*xformedSigma)/2;
rect.outset(SkIntToScalar(pad), SkIntToScalar(pad));
- fp.reset(GrRectBlurEffect::Create(texProvider, rect, xformedSigma));
+ fp.reset(GrRectBlurEffect::Create(texProvider, rect, xformedSigma, drawContext->rt_remove_me()));
} else if (path.isOval(&rect) && SkScalarNearlyEqual(rect.width(), rect.height())) {
- fp.reset(GrCircleBlurFragmentProcessor::Create(texProvider, rect, xformedSigma));
+ fp.reset(GrCircleBlurFragmentProcessor::Create(texProvider, rect, xformedSigma, drawContext->rt_remove_me()));
// expand the rect for the coverage geometry
int pad = SkScalarCeilToInt(6*xformedSigma)/2;
@@ -903,7 +904,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
class GrRRectBlurEffect : public GrFragmentProcessor {
public:
- static const GrFragmentProcessor* Create(GrTextureProvider*, float sigma, const SkRRect&);
+ static const GrFragmentProcessor* Create(GrTextureProvider*, float sigma, const SkRRect&, GrRenderTarget* dst);
virtual ~GrRRectBlurEffect() {};
const char* name() const override { return "GrRRectBlur"; }
@@ -914,7 +915,7 @@ public:
private:
GrGLFragmentProcessor* onCreateGLInstance() const override;
- GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture);
+ GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture, GrRenderTarget* dst);
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
@@ -934,9 +935,9 @@ private:
const GrFragmentProcessor* GrRRectBlurEffect::Create(GrTextureProvider* texProvider, float sigma,
- const SkRRect& rrect) {
+ const SkRRect& rrect, GrRenderTarget* dst) {
if (rrect.isCircle()) {
- return GrCircleBlurFragmentProcessor::Create(texProvider, rrect.rect(), sigma);
+ return GrCircleBlurFragmentProcessor::Create(texProvider, rrect.rect(), sigma, dst);
}
if (!rrect.isSimpleCircular()) {
@@ -1005,18 +1006,19 @@ const GrFragmentProcessor* GrRRectBlurEffect::Create(GrTextureProvider* texProvi
return nullptr;
}
texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture);
+ blurNinePatchTexture->setFromRawPixels(true);
}
- return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture);
+ return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture, dst);
}
void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
inout->mulByUnknownSingleComponent();
}
-GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture *ninePatchTexture)
+GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture *ninePatchTexture, GrRenderTarget* dst)
: fRRect(rrect),
fSigma(sigma),
- fNinePatchAccess(ninePatchTexture) {
+ fNinePatchAccess(ninePatchTexture, GrTextureParams::kNone_FilterMode,SkShader::kClamp_TileMode, dst) {
this->initClassID<GrRRectBlurEffect>();
this->addTextureAccess(&fNinePatchAccess);
this->setWillReadFragmentPosition();
@@ -1038,7 +1040,7 @@ const GrFragmentProcessor* GrRRectBlurEffect::TestCreate(GrProcessorTestData* d)
SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f);
SkRRect rrect;
rrect.setRectXY(SkRect::MakeWH(w, h), r, r);
- return GrRRectBlurEffect::Create(d->fContext->textureProvider(), sigma, rrect);
+ return GrRRectBlurEffect::Create(d->fContext->textureProvider(), sigma, rrect, NULL);
}
//////////////////////////////////////////////////////////////////////////////
@@ -1163,7 +1165,7 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrTextureProvider* texProvid
proxyRect.outset(extra, extra);
SkAutoTUnref<const GrFragmentProcessor> fp(GrRRectBlurEffect::Create(texProvider,
- xformedSigma, rrect));
+ xformedSigma, rrect, drawContext->rt_remove_me()));
if (!fp) {
return false;
}
@@ -1221,6 +1223,8 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRRect& devRRect,
return true;
}
+#include "GrDrawTarget.h"
+
bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
const SkMatrix& ctm,
const SkRect& maskRect,
@@ -1248,7 +1252,10 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
SkMatrix matrix;
matrix.setIDiv(src->width(), src->height());
// Blend pathTexture over blurTexture.
- paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(src, matrix))->unref();
+ paint.addCoverageFragmentProcessor(
+ GrSimpleTextureEffect::Create(src, matrix, kLocal_GrCoordSet,
+ (*result)->asRenderTarget()))->unref();
+
if (kInner_SkBlurStyle == fBlurStyle) {
// inner: dst = dst * src
paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op);
@@ -1262,6 +1269,12 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
paint.setCoverageSetOpXPFactory(SkRegion::kDifference_Op);
}
+ GrRenderTarget* rt = (*result)->asRenderTarget();
+ SkASSERT(rt);
+ GrDrawTarget* dt = rt->getLastDrawTarget();
+ SkASSERT(dt);
+ SkASSERT(!dt->isClosed());
+
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext((*result)->asRenderTarget()));
if (!drawContext) {
return false;
« no previous file with comments | « src/effects/SkArithmeticMode_gpu.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698