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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | 553 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; |
554 | 554 |
555 /** | 555 /** |
556 * Create a simple filter effect with custom bicubic coefficients. | 556 * Create a simple filter effect with custom bicubic coefficients. |
557 */ | 557 */ |
558 static GrEffectRef* Create(GrContext *context, const SkRect& rect, | 558 static GrEffectRef* Create(GrContext *context, const SkRect& rect, |
559 float sigma) { | 559 float sigma) { |
560 GrTexture *blurProfileTexture = NULL; | 560 GrTexture *blurProfileTexture = NULL; |
561 int doubleProfileSize = SkScalarCeilToInt(12*sigma); | 561 int doubleProfileSize = SkScalarCeilToInt(12*sigma); |
562 | 562 |
563 if (doubleProfileSize <= rect.width() || doubleProfileSize <= rect.heigh
t()) { | 563 if (doubleProfileSize >= rect.width() || doubleProfileSize >= rect.heigh
t()) { |
564 // if the blur sigma is too large so the gaussian overlaps the whole | 564 // if the blur sigma is too large so the gaussian overlaps the whole |
565 // rect in either direction, fall back to CPU path for now. | 565 // rect in either direction, fall back to CPU path for now. |
566 | 566 |
567 return NULL; | 567 return NULL; |
568 } | 568 } |
569 | 569 |
570 bool createdBlurProfileTexture = CreateBlurProfileTexture(context, sigma
, &blurProfileTexture); | 570 bool createdBlurProfileTexture = CreateBlurProfileTexture(context, sigma
, &blurProfileTexture); |
571 SkAutoTUnref<GrTexture> hunref(blurProfileTexture); | 571 SkAutoTUnref<GrTexture> hunref(blurProfileTexture); |
572 if (!createdBlurProfileTexture) { | 572 if (!createdBlurProfileTexture) { |
573 return NULL; | 573 return NULL; |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 } else { | 1212 } else { |
1213 str->append("None"); | 1213 str->append("None"); |
1214 } | 1214 } |
1215 str->append("))"); | 1215 str->append("))"); |
1216 } | 1216 } |
1217 #endif | 1217 #endif |
1218 | 1218 |
1219 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1219 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1220 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1220 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1221 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1221 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |