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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 SkScalar xformedRadius = this->computeXformedRadius(context->getMatrix()); | 405 SkScalar xformedRadius = this->computeXformedRadius(context->getMatrix()); |
406 SkASSERT(xformedRadius > 0); | 406 SkASSERT(xformedRadius > 0); |
407 | 407 |
408 float sigma = SkScalarToFloat(xformedRadius) * kBLUR_SIGMA_SCALE; | 408 float sigma = SkScalarToFloat(xformedRadius) * kBLUR_SIGMA_SCALE; |
409 | 409 |
410 // If we're doing a normal blur, we can clobber the pathTexture in the | 410 // 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. | 411 // gaussianBlur. Otherwise, we need to save it for later compositing. |
412 bool isNormalBlur = (SkBlurMaskFilter::kNormal_BlurStyle == fBlurStyle); | 412 bool isNormalBlur = (SkBlurMaskFilter::kNormal_BlurStyle == fBlurStyle); |
413 *result = context->gaussianBlur(src, isNormalBlur && canOverwriteSrc, | 413 *result = context->gaussianBlur(src, isNormalBlur && canOverwriteSrc, |
414 clipRect, sigma, sigma); | 414 clipRect, sigma, sigma); |
415 if (NULL == result) { | 415 if (NULL == *result) { |
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()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } else { | 471 } else { |
472 str->append("None"); | 472 str->append("None"); |
473 } | 473 } |
474 str->append("))"); | 474 str->append("))"); |
475 } | 475 } |
476 #endif | 476 #endif |
477 | 477 |
478 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 478 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
479 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 479 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
480 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 480 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |