OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, }; | 67 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, }; |
68 const SkScalar pos[] = { SK_Scalar1/4, SK_Scalar1*3/4 }; | 68 const SkScalar pos[] = { SK_Scalar1/4, SK_Scalar1*3/4 }; |
69 SkMatrix scale; | 69 SkMatrix scale; |
70 scale.setScale(0.5f, 0.5f); | 70 scale.setScale(0.5f, 0.5f); |
71 scale.postTranslate(25.f, 25.f); | 71 scale.postTranslate(25.f, 25.f); |
72 SkPoint center0, center1; | 72 SkPoint center0, center1; |
73 center0.set(SkScalarAve(pts[0].fX, pts[1].fX), | 73 center0.set(SkScalarAve(pts[0].fX, pts[1].fX), |
74 SkScalarAve(pts[0].fY, pts[1].fY)); | 74 SkScalarAve(pts[0].fY, pts[1].fY)); |
75 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), | 75 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), |
76 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); | 76 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); |
77 return SkGradientShader::CreateTwoPointRadial(center1, (pts[1].fX - pts[0].f
X) / 7, | 77 return SkGradientShader::CreateTwoPointConical(center1, (pts[1].fX - pts[0].
fX) / 7, |
78 center0, (pts[1].fX - pts[0].f
X) / 2, | 78 center0, (pts[1].fX - pts[0].f
X) / 2, |
79 colors, pos, SK_ARRAY_COUNT(co
lors), tm, | 79 colors, pos, SK_ARRAY_COUNT(co
lors), tm, |
80 0, &scale); | 80 0, &scale); |
81 } | 81 } |
82 | 82 |
83 typedef void (*PaintProc)(SkPaint*, SkScalar width); | 83 typedef void (*PaintProc)(SkPaint*, SkScalar width); |
84 | 84 |
85 class BlurRectGM : public skiagm::GM { | 85 class BlurRectGM : public skiagm::GM { |
86 SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1]; | 86 SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1]; |
87 SkString fName; | 87 SkString fName; |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 411 } |
412 private: | 412 private: |
413 typedef BlurRectCompareGM INHERITED; | 413 typedef BlurRectCompareGM INHERITED; |
414 }; | 414 }; |
415 | 415 |
416 | 416 |
417 ////////////////////////////////////////////////////////////////////////////// | 417 ////////////////////////////////////////////////////////////////////////////// |
418 | 418 |
419 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) | 419 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) |
420 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");) | 420 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");) |
OLD | NEW |