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

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

Issue 766653008: Revert of Make all blending up to GrOptDrawState be handled by the xp/xp factory. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: Created 6 years 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 | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/gpu/GrBitmapTextContext.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
11 #include "SkGpuBlurUtils.h" 11 #include "SkGpuBlurUtils.h"
12 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
13 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
14 #include "SkMaskFilter.h" 14 #include "SkMaskFilter.h"
15 #include "SkRRect.h" 15 #include "SkRRect.h"
16 #include "SkRTConf.h" 16 #include "SkRTConf.h"
17 #include "SkStringUtils.h" 17 #include "SkStringUtils.h"
18 #include "SkStrokeRec.h" 18 #include "SkStrokeRec.h"
19 19
20 #if SK_SUPPORT_GPU 20 #if SK_SUPPORT_GPU
21 #include "GrContext.h" 21 #include "GrContext.h"
22 #include "GrTexture.h" 22 #include "GrTexture.h"
23 #include "GrFragmentProcessor.h" 23 #include "GrFragmentProcessor.h"
24 #include "GrInvariantOutput.h" 24 #include "GrInvariantOutput.h"
25 #include "SkGrPixelRef.h" 25 #include "SkGrPixelRef.h"
26 #include "SkDraw.h" 26 #include "SkDraw.h"
27 #include "effects/GrPorterDuffXferProcessor.h"
28 #include "effects/GrSimpleTextureEffect.h" 27 #include "effects/GrSimpleTextureEffect.h"
29 #include "gl/GrGLProcessor.h" 28 #include "gl/GrGLProcessor.h"
30 #include "gl/builders/GrGLProgramBuilder.h" 29 #include "gl/builders/GrGLProgramBuilder.h"
31 #endif 30 #endif
32 31
33 SkScalar SkBlurMaskFilter::ConvertRadiusToSigma(SkScalar radius) { 32 SkScalar SkBlurMaskFilter::ConvertRadiusToSigma(SkScalar radius) {
34 return SkBlurMask::ConvertRadiusToSigma(radius); 33 return SkBlurMask::ConvertRadiusToSigma(radius);
35 } 34 }
36 35
37 class SkBlurMaskFilterImpl : public SkMaskFilter { 36 class SkBlurMaskFilterImpl : public SkMaskFilter {
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 if (!isNormalBlur) { 1211 if (!isNormalBlur) {
1213 context->setIdentityMatrix(); 1212 context->setIdentityMatrix();
1214 GrPaint paint; 1213 GrPaint paint;
1215 SkMatrix matrix; 1214 SkMatrix matrix;
1216 matrix.setIDiv(src->width(), src->height()); 1215 matrix.setIDiv(src->width(), src->height());
1217 // Blend pathTexture over blurTexture. 1216 // Blend pathTexture over blurTexture.
1218 GrContext::AutoRenderTarget art(context, (*result)->asRenderTarget()); 1217 GrContext::AutoRenderTarget art(context, (*result)->asRenderTarget());
1219 paint.addColorProcessor(GrSimpleTextureEffect::Create(src, matrix))->unr ef(); 1218 paint.addColorProcessor(GrSimpleTextureEffect::Create(src, matrix))->unr ef();
1220 if (kInner_SkBlurStyle == fBlurStyle) { 1219 if (kInner_SkBlurStyle == fBlurStyle) {
1221 // inner: dst = dst * src 1220 // inner: dst = dst * src
1222 paint.setPorterDuffXPFactory(kDC_GrBlendCoeff, kZero_GrBlendCoeff); 1221 paint.setBlendFunc(kDC_GrBlendCoeff, kZero_GrBlendCoeff);
1223 } else if (kSolid_SkBlurStyle == fBlurStyle) { 1222 } else if (kSolid_SkBlurStyle == fBlurStyle) {
1224 // solid: dst = src + dst - src * dst 1223 // solid: dst = src + dst - src * dst
1225 // = (1 - dst) * src + 1 * dst 1224 // = (1 - dst) * src + 1 * dst
1226 paint.setPorterDuffXPFactory(kIDC_GrBlendCoeff, kOne_GrBlendCoeff); 1225 paint.setBlendFunc(kIDC_GrBlendCoeff, kOne_GrBlendCoeff);
1227 } else if (kOuter_SkBlurStyle == fBlurStyle) { 1226 } else if (kOuter_SkBlurStyle == fBlurStyle) {
1228 // outer: dst = dst * (1 - src) 1227 // outer: dst = dst * (1 - src)
1229 // = 0 * src + (1 - src) * dst 1228 // = 0 * src + (1 - src) * dst
1230 paint.setPorterDuffXPFactory(kZero_GrBlendCoeff, kISC_GrBlendCoeff); 1229 paint.setBlendFunc(kZero_GrBlendCoeff, kISC_GrBlendCoeff);
1231 } 1230 }
1232 context->drawRect(paint, clipRect); 1231 context->drawRect(paint, clipRect);
1233 } 1232 }
1234 1233
1235 return true; 1234 return true;
1236 } 1235 }
1237 1236
1238 #endif // SK_SUPPORT_GPU 1237 #endif // SK_SUPPORT_GPU
1239 1238
1240 1239
(...skipping 22 matching lines...) Expand all
1263 } else { 1262 } else {
1264 str->append("None"); 1263 str->append("None");
1265 } 1264 }
1266 str->append("))"); 1265 str->append("))");
1267 } 1266 }
1268 #endif 1267 #endif
1269 1268
1270 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1269 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1271 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1270 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1271 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698