OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, }; | 105 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, }; |
106 const SkScalar pos[] = { SK_Scalar1/4, SK_Scalar1*3/4 }; | 106 const SkScalar pos[] = { SK_Scalar1/4, SK_Scalar1*3/4 }; |
107 SkMatrix scale; | 107 SkMatrix scale; |
108 scale.setScale(0.5f, 0.5f); | 108 scale.setScale(0.5f, 0.5f); |
109 scale.postTranslate(5.f, 5.f); | 109 scale.postTranslate(5.f, 5.f); |
110 SkPoint center0, center1; | 110 SkPoint center0, center1; |
111 center0.set(SkScalarAve(pts[0].fX, pts[1].fX), | 111 center0.set(SkScalarAve(pts[0].fX, pts[1].fX), |
112 SkScalarAve(pts[0].fY, pts[1].fY)); | 112 SkScalarAve(pts[0].fY, pts[1].fY)); |
113 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), | 113 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), |
114 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); | 114 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); |
115 return SkGradientShader::CreateTwoPointRadial(center1, (pts[1].fX - pts[0].f
X) / 7, | 115 return SkGradientShader::CreateTwoPointConical(center1, (pts[1].fX - pts[0].
fX) / 7, |
116 center0, (pts[1].fX - pts[0].f
X) / 2, | 116 center0, (pts[1].fX - pts[0].
fX) / 2, |
117 colors, pos, SK_ARRAY_COUNT(co
lors), tm, | 117 colors, pos, SK_ARRAY_COUNT(c
olors), tm, |
118 0, &scale); | 118 0, &scale); |
119 } | 119 } |
120 | 120 |
121 // Simpler blurred RR test cases where all the radii are the same. | 121 // Simpler blurred RR test cases where all the radii are the same. |
122 class SimpleBlurRoundRectGM : public skiagm::GM { | 122 class SimpleBlurRoundRectGM : public skiagm::GM { |
123 public: | 123 public: |
124 SimpleBlurRoundRectGM() | 124 SimpleBlurRoundRectGM() |
125 : fName("simpleblurroundrect") { | 125 : fName("simpleblurroundrect") { |
126 } | 126 } |
127 | 127 |
128 protected: | 128 protected: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // TODO(scroggo): Disabled in an attempt to rememdy | 180 // TODO(scroggo): Disabled in an attempt to rememdy |
181 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai
ling GenerateGMs: | 181 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai
ling GenerateGMs: |
182 // ran wrong number of tests') | 182 // ran wrong number of tests') |
183 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);) | 183 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);) |
184 | 184 |
185 // Rounded rect with two opposite corners with large radii, the other two | 185 // Rounded rect with two opposite corners with large radii, the other two |
186 // small. | 186 // small. |
187 DEF_GM(return new BlurRoundRectGM(100, 100);) | 187 DEF_GM(return new BlurRoundRectGM(100, 100);) |
188 | 188 |
189 DEF_GM(return new SimpleBlurRoundRectGM();) | 189 DEF_GM(return new SimpleBlurRoundRectGM();) |
OLD | NEW |