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

Side by Side Diff: src/effects/SkBlurMaskFilter.cpp

Issue 2268583002: Fix Ganesh analytic blurred rect draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice_drawTexture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBlurMaskFilter.h" 8 #include "SkBlurMaskFilter.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkGpuBlurUtils.h" 10 #include "SkGpuBlurUtils.h"
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 SkASSERT(mask); 1151 SkASSERT(mask);
1152 context->textureProvider()->assignUniqueKeyToTexture(key, mask.get()); 1152 context->textureProvider()->assignUniqueKeyToTexture(key, mask.get());
1153 } 1153 }
1154 1154
1155 return mask; 1155 return mask;
1156 } 1156 }
1157 1157
1158 sk_sp<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context, 1158 sk_sp<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context,
1159 float sigma, float xformedSig ma, 1159 float sigma, float xformedSig ma,
1160 const SkRRect& srcRRect, cons t SkRRect& devRRect) { 1160 const SkRRect& srcRRect, cons t SkRRect& devRRect) {
1161 SkASSERT(!devRRect.isCircle()); // Should've been caught up-stream 1161 SkASSERT(!devRRect.isCircle() && !devRRect.isRect()); // Should've been caug ht up-stream
1162 1162
1163 // TODO: loosen this up 1163 // TODO: loosen this up
1164 if (!devRRect.isSimpleCircular()) { 1164 if (!devRRect.isSimpleCircular()) {
1165 return nullptr; 1165 return nullptr;
1166 } 1166 }
1167 1167
1168 // Make sure we can successfully ninepatch this rrect -- the blur sigma has to be 1168 // Make sure we can successfully ninepatch this rrect -- the blur sigma has to be
1169 // sufficiently small relative to both the size of the corner radius and the 1169 // sufficiently small relative to both the size of the corner radius and the
1170 // width (and height) of the rrect. 1170 // width (and height) of the rrect.
1171 SkRRect rrectToDraw; 1171 SkRRect rrectToDraw;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 if (fBlurStyle != kNormal_SkBlurStyle) { 1344 if (fBlurStyle != kNormal_SkBlurStyle) {
1345 return false; 1345 return false;
1346 } 1346 }
1347 1347
1348 if (!strokeRec.isFillStyle()) { 1348 if (!strokeRec.isFillStyle()) {
1349 return false; 1349 return false;
1350 } 1350 }
1351 1351
1352 SkScalar xformedSigma = this->computeXformedSigma(viewMatrix); 1352 SkScalar xformedSigma = this->computeXformedSigma(viewMatrix);
1353 1353
1354 if (devRRect.isCircle()) { 1354 if (devRRect.isRect() || devRRect.isCircle()) {
1355 sk_sp<GrFragmentProcessor> fp(GrCircleBlurFragmentProcessor::Make( 1355 if (this->ignoreXform()) {
1356 context- >textureProvider(), 1356 return false;
1357 devRRect .rect(), 1357 }
1358 xformedS igma)); 1358
1359 sk_sp<GrFragmentProcessor> fp;
1360 if (devRRect.isRect()) {
1361 SkScalar pad = 3.0f * xformedSigma;
1362 const SkRect dstCoverageRect = devRRect.rect().makeOutset(pad, pad);
1363
1364 fp = GrRectBlurEffect::Make(context->textureProvider(), dstCoverageR ect, xformedSigma);
1365 } else {
1366 fp = GrCircleBlurFragmentProcessor::Make(context->textureProvider(),
1367 devRRect.rect(),
1368 xformedSigma);
1369 }
1370
1359 if (!fp) { 1371 if (!fp) {
1360 return false; 1372 return false;
1361 } 1373 }
1362 1374
1363 GrPaint newPaint(*grp); 1375 GrPaint newPaint(*grp);
1364 newPaint.addCoverageFragmentProcessor(std::move(fp)); 1376 newPaint.addCoverageFragmentProcessor(std::move(fp));
1365 newPaint.setAntiAlias(false); 1377 newPaint.setAntiAlias(false);
1366 1378
1367 SkRect srcProxyRect = srcRRect.rect(); 1379 SkRect srcProxyRect = srcRRect.rect();
1368 srcProxyRect.outset(3.0f*fSigma, 3.0f*fSigma); 1380 srcProxyRect.outset(3.0f*fSigma, 3.0f*fSigma);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 } else { 1562 } else {
1551 str->append("None"); 1563 str->append("None");
1552 } 1564 }
1553 str->append("))"); 1565 str->append("))");
1554 } 1566 }
1555 #endif 1567 #endif
1556 1568
1557 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1569 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1558 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1570 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1559 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1571 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice_drawTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698