OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #include "SampleCode.h" | 8 #include "SampleCode.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 SkScalar y = SkIntToScalar(20); | 67 SkScalar y = SkIntToScalar(20); |
68 | 68 |
69 paint.setFlags(0x105); | 69 paint.setFlags(0x105); |
70 | 70 |
71 paint.setARGB(fByte, 0xFF, 0xFF, 0xFF); | 71 paint.setARGB(fByte, 0xFF, 0xFF, 0xFF); |
72 | 72 |
73 paint.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_B
lurStyle, | 73 paint.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_B
lurStyle, |
74 SkBlurMask::ConvertRadiusToSigma(SkIntToScal
ar(3)))); | 74 SkBlurMask::ConvertRadiusToSigma(SkIntToScal
ar(3)))); |
75 paint.getMaskFilter()->unref(); | 75 paint.getMaskFilter()->unref(); |
76 | 76 |
77 SkMWCRandom rand; | 77 SkRandom rand; |
78 | 78 |
79 for (int ps = 6; ps <= 35; ps++) { | 79 for (int ps = 6; ps <= 35; ps++) { |
80 paint.setColor(rand.nextU() | (0xFF << 24)); | 80 paint.setColor(rand.nextU() | (0xFF << 24)); |
81 paint.setTextSize(SkIntToScalar(ps)); | 81 paint.setTextSize(SkIntToScalar(ps)); |
82 paint.setTextSize(SkIntToScalar(24)); | 82 paint.setTextSize(SkIntToScalar(24)); |
83 canvas->drawText(str, strlen(str), x, y, paint); | 83 canvas->drawText(str, strlen(str), x, y, paint); |
84 y += paint.getFontMetrics(NULL); | 84 y += paint.getFontMetrics(NULL); |
85 } | 85 } |
86 if (false) { // avoid bit rot, suppress warning | 86 if (false) { // avoid bit rot, suppress warning |
87 check_for_nonwhite(canvas->getDevice()->accessBitmap(false), fByte); | 87 check_for_nonwhite(canvas->getDevice()->accessBitmap(false), fByte); |
(...skipping 26 matching lines...) Expand all Loading... |
114 private: | 114 private: |
115 int fByte; | 115 int fByte; |
116 | 116 |
117 typedef SampleView INHERITED; | 117 typedef SampleView INHERITED; |
118 }; | 118 }; |
119 | 119 |
120 ////////////////////////////////////////////////////////////////////////////// | 120 ////////////////////////////////////////////////////////////////////////////// |
121 | 121 |
122 static SkView* MyFactory() { return new TextAlphaView; } | 122 static SkView* MyFactory() { return new TextAlphaView; } |
123 static SkViewRegister reg(MyFactory); | 123 static SkViewRegister reg(MyFactory); |
OLD | NEW |