OLD | NEW |
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" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 return false; | 416 return false; |
417 } | 417 } |
418 | 418 |
419 if (!isNormalBlur) { | 419 if (!isNormalBlur) { |
420 context->setIdentityMatrix(); | 420 context->setIdentityMatrix(); |
421 GrPaint paint; | 421 GrPaint paint; |
422 SkMatrix matrix; | 422 SkMatrix matrix; |
423 matrix.setIDiv(src->width(), src->height()); | 423 matrix.setIDiv(src->width(), src->height()); |
424 // Blend pathTexture over blurTexture. | 424 // Blend pathTexture over blurTexture. |
425 GrContext::AutoRenderTarget art(context, (*result)->asRenderTarget()); | 425 GrContext::AutoRenderTarget art(context, (*result)->asRenderTarget()); |
426 paint.colorStage(0)->setEffect( | 426 paint.addColorEffect(GrSimpleTextureEffect::Create(src, matrix))->unref(
); |
427 GrSimpleTextureEffect::Create(src, matrix))->unref(); | |
428 if (SkBlurMaskFilter::kInner_BlurStyle == fBlurStyle) { | 427 if (SkBlurMaskFilter::kInner_BlurStyle == fBlurStyle) { |
429 // inner: dst = dst * src | 428 // inner: dst = dst * src |
430 paint.setBlendFunc(kDC_GrBlendCoeff, kZero_GrBlendCoeff); | 429 paint.setBlendFunc(kDC_GrBlendCoeff, kZero_GrBlendCoeff); |
431 } else if (SkBlurMaskFilter::kSolid_BlurStyle == fBlurStyle) { | 430 } else if (SkBlurMaskFilter::kSolid_BlurStyle == fBlurStyle) { |
432 // solid: dst = src + dst - src * dst | 431 // solid: dst = src + dst - src * dst |
433 // = (1 - dst) * src + 1 * dst | 432 // = (1 - dst) * src + 1 * dst |
434 paint.setBlendFunc(kIDC_GrBlendCoeff, kOne_GrBlendCoeff); | 433 paint.setBlendFunc(kIDC_GrBlendCoeff, kOne_GrBlendCoeff); |
435 } else if (SkBlurMaskFilter::kOuter_BlurStyle == fBlurStyle) { | 434 } else if (SkBlurMaskFilter::kOuter_BlurStyle == fBlurStyle) { |
436 // outer: dst = dst * (1 - src) | 435 // outer: dst = dst * (1 - src) |
437 // = 0 * src + (1 - src) * dst | 436 // = 0 * src + (1 - src) * dst |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } else { | 470 } else { |
472 str->append("None"); | 471 str->append("None"); |
473 } | 472 } |
474 str->append("))"); | 473 str->append("))"); |
475 } | 474 } |
476 #endif | 475 #endif |
477 | 476 |
478 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 477 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
479 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 478 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
480 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 479 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |