OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 for (int j = 0; j < 2; j++) { | 49 for (int j = 0; j < 2; j++) { |
50 canvas->save(); | 50 canvas->save(); |
51 paint.setColor(SK_ColorBLUE); | 51 paint.setColor(SK_ColorBLUE); |
52 for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) { | 52 for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) { |
53 if (gRecs[i].fStyle != NONE) { | 53 if (gRecs[i].fStyle != NONE) { |
54 SkMaskFilter* mf = SkBlurMaskFilter::Create(gRecs[i].fStyle, | 54 SkMaskFilter* mf = SkBlurMaskFilter::Create(gRecs[i].fStyle, |
55 SkBlurMask::ConvertRadiusToSigma(SkIn
tToScalar(20)), | 55 SkBlurMask::ConvertRadiusToSigma(SkIn
tToScalar(20)), |
56 flags); | 56 flags); |
57 paint.setMaskFilter(mf)->unref(); | 57 paint.setMaskFilter(mf)->unref(); |
58 } else { | 58 } else { |
59 paint.setMaskFilter(NULL); | 59 paint.setMaskFilter(nullptr); |
60 } | 60 } |
61 canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100), | 61 canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100), |
62 SkIntToScalar(200 + gRecs[i].fCy*100), | 62 SkIntToScalar(200 + gRecs[i].fCy*100), |
63 SkIntToScalar(50), | 63 SkIntToScalar(50), |
64 paint); | 64 paint); |
65 } | 65 } |
66 // draw text | 66 // draw text |
67 { | 67 { |
68 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 68 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
69 SkBlurMask::ConvertRadiusToSigma(SkIn
tToScalar(4)), | 69 SkBlurMask::ConvertRadiusToSigma(SkIn
tToScalar(4)), |
70 flags); | 70 flags); |
71 paint.setMaskFilter(mf)->unref(); | 71 paint.setMaskFilter(mf)->unref(); |
72 SkScalar x = SkIntToScalar(70); | 72 SkScalar x = SkIntToScalar(70); |
73 SkScalar y = SkIntToScalar(400); | 73 SkScalar y = SkIntToScalar(400); |
74 paint.setColor(SK_ColorBLACK); | 74 paint.setColor(SK_ColorBLACK); |
75 canvas->drawText("Hamburgefons Style", 18, x, y, paint); | 75 canvas->drawText("Hamburgefons Style", 18, x, y, paint); |
76 canvas->drawText("Hamburgefons Style", 18, | 76 canvas->drawText("Hamburgefons Style", 18, |
77 x, y + SkIntToScalar(50), paint); | 77 x, y + SkIntToScalar(50), paint); |
78 paint.setMaskFilter(NULL); | 78 paint.setMaskFilter(nullptr); |
79 paint.setColor(SK_ColorWHITE); | 79 paint.setColor(SK_ColorWHITE); |
80 x -= SkIntToScalar(2); | 80 x -= SkIntToScalar(2); |
81 y -= SkIntToScalar(2); | 81 y -= SkIntToScalar(2); |
82 canvas->drawText("Hamburgefons Style", 18, x, y, paint); | 82 canvas->drawText("Hamburgefons Style", 18, x, y, paint); |
83 } | 83 } |
84 canvas->restore(); | 84 canvas->restore(); |
85 flags = SkBlurMaskFilter::kHighQuality_BlurFlag; | 85 flags = SkBlurMaskFilter::kHighQuality_BlurFlag; |
86 canvas->translate(SkIntToScalar(350), SkIntToScalar(0)); | 86 canvas->translate(SkIntToScalar(350), SkIntToScalar(0)); |
87 } | 87 } |
88 } | 88 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 canvas->translate(dx, 0); | 158 canvas->translate(dx, 0); |
159 canvas->drawPath(path, paint); | 159 canvas->drawPath(path, paint); |
160 | 160 |
161 // Translate to outside of clip bounds. | 161 // Translate to outside of clip bounds. |
162 canvas->translate(-dx, 0); | 162 canvas->translate(-dx, 0); |
163 canvas->translate(-30, -150); | 163 canvas->translate(-30, -150); |
164 canvas->drawPath(path, paint); | 164 canvas->drawPath(path, paint); |
165 } | 165 } |
166 }; | 166 }; |
167 DEF_GM( return new Blur2RectsNonNinePatchGM; ) | 167 DEF_GM( return new Blur2RectsNonNinePatchGM; ) |
OLD | NEW |