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" |
| 11 #include "SkGpuBlurUtils.h" |
11 #include "SkFlattenableBuffers.h" | 12 #include "SkFlattenableBuffers.h" |
12 #include "SkMaskFilter.h" | 13 #include "SkMaskFilter.h" |
13 #include "SkRTConf.h" | 14 #include "SkRTConf.h" |
14 #include "SkStringUtils.h" | 15 #include "SkStringUtils.h" |
15 #include "SkStrokeRec.h" | 16 #include "SkStrokeRec.h" |
16 | 17 |
17 #if SK_SUPPORT_GPU | 18 #if SK_SUPPORT_GPU |
18 #include "GrContext.h" | 19 #include "GrContext.h" |
19 #include "GrTexture.h" | 20 #include "GrTexture.h" |
20 #include "effects/GrSimpleTextureEffect.h" | 21 #include "effects/GrSimpleTextureEffect.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 GrContext::AutoWideOpenIdentityDraw awo(context, NULL); | 404 GrContext::AutoWideOpenIdentityDraw awo(context, NULL); |
404 | 405 |
405 SkScalar xformedRadius = this->computeXformedRadius(context->getMatrix()); | 406 SkScalar xformedRadius = this->computeXformedRadius(context->getMatrix()); |
406 SkASSERT(xformedRadius > 0); | 407 SkASSERT(xformedRadius > 0); |
407 | 408 |
408 float sigma = SkScalarToFloat(xformedRadius) * kBLUR_SIGMA_SCALE; | 409 float sigma = SkScalarToFloat(xformedRadius) * kBLUR_SIGMA_SCALE; |
409 | 410 |
410 // If we're doing a normal blur, we can clobber the pathTexture in the | 411 // If we're doing a normal blur, we can clobber the pathTexture in the |
411 // gaussianBlur. Otherwise, we need to save it for later compositing. | 412 // gaussianBlur. Otherwise, we need to save it for later compositing. |
412 bool isNormalBlur = (SkBlurMaskFilter::kNormal_BlurStyle == fBlurStyle); | 413 bool isNormalBlur = (SkBlurMaskFilter::kNormal_BlurStyle == fBlurStyle); |
413 *result = context->gaussianBlur(src, isNormalBlur && canOverwriteSrc, | 414 *result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOver
writeSrc, |
414 clipRect, sigma, sigma); | 415 clipRect, sigma, sigma); |
415 if (NULL == *result) { | 416 if (NULL == *result) { |
416 return false; | 417 return false; |
417 } | 418 } |
418 | 419 |
419 if (!isNormalBlur) { | 420 if (!isNormalBlur) { |
420 context->setIdentityMatrix(); | 421 context->setIdentityMatrix(); |
421 GrPaint paint; | 422 GrPaint paint; |
422 SkMatrix matrix; | 423 SkMatrix matrix; |
423 matrix.setIDiv(src->width(), src->height()); | 424 matrix.setIDiv(src->width(), src->height()); |
424 // Blend pathTexture over blurTexture. | 425 // Blend pathTexture over blurTexture. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } else { | 471 } else { |
471 str->append("None"); | 472 str->append("None"); |
472 } | 473 } |
473 str->append("))"); | 474 str->append("))"); |
474 } | 475 } |
475 #endif | 476 #endif |
476 | 477 |
477 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 478 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
478 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 479 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
479 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 480 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |