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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 canvas->save(); | 95 canvas->save(); |
96 | 96 |
97 // draw a letter "M" with a green & red striped texture and a | 97 // draw a letter "M" with a green & red striped texture and a |
98 // stipple mask with a round rect soft clip | 98 // stipple mask with a round rect soft clip |
99 SkPaint paint; | 99 SkPaint paint; |
100 paint.setAntiAlias(true); | 100 paint.setAntiAlias(true); |
101 paint.setTextSize(72); | 101 paint.setTextSize(72); |
102 paint.setShader(fShader.get()); | 102 paint.setShader(fShader.get()); |
103 paint.setMaskFilter(fMaskFilter.get()); | 103 paint.setMaskFilter(fMaskFilter.get()); |
| 104 sk_tool_utils::set_portable_typeface(&paint); |
104 | 105 |
105 SkRect temp; | 106 SkRect temp; |
106 temp.set(SkIntToScalar(115), | 107 temp.set(SkIntToScalar(115), |
107 SkIntToScalar(75), | 108 SkIntToScalar(75), |
108 SkIntToScalar(144), | 109 SkIntToScalar(144), |
109 SkIntToScalar(110)); | 110 SkIntToScalar(110)); |
110 | 111 |
111 SkPath path; | 112 SkPath path; |
112 path.addRoundRect(temp, SkIntToScalar(5), SkIntToScalar(5)); | 113 path.addRoundRect(temp, SkIntToScalar(5), SkIntToScalar(5)); |
113 | 114 |
(...skipping 10 matching lines...) Expand all Loading... |
124 SkPaint paint2; | 125 SkPaint paint2; |
125 paint2.setColor(SK_ColorBLACK); | 126 paint2.setColor(SK_ColorBLACK); |
126 paint2.setAntiAlias(true); | 127 paint2.setAntiAlias(true); |
127 paint2.setTextSize(72); | 128 paint2.setTextSize(72); |
128 paint2.setStyle(SkPaint::kStroke_Style); | 129 paint2.setStyle(SkPaint::kStroke_Style); |
129 paint2.setStrokeWidth(1); | 130 paint2.setStrokeWidth(1); |
130 canvas->drawText("M", 1, | 131 canvas->drawText("M", 1, |
131 SkIntToScalar(100), SkIntToScalar(100), | 132 SkIntToScalar(100), SkIntToScalar(100), |
132 paint2); | 133 paint2); |
133 | 134 |
134 paint2.setColor(SK_ColorGRAY); | 135 paint2.setColor(sk_tool_utils::color_to_565(SK_ColorGRAY)); |
135 | 136 |
136 canvas->drawPath(path, paint2); | 137 canvas->drawPath(path, paint2); |
137 } | 138 } |
138 | 139 |
139 private: | 140 private: |
140 SkBitmap fTexture; | 141 SkBitmap fTexture; |
141 bool fTextureCreated; | 142 bool fTextureCreated; |
142 SkAutoTUnref<SkShader> fShader; | 143 SkAutoTUnref<SkShader> fShader; |
143 SkAutoTUnref<SkMaskFilter> fMaskFilter; | 144 SkAutoTUnref<SkMaskFilter> fMaskFilter; |
144 | 145 |
145 typedef GM INHERITED; | 146 typedef GM INHERITED; |
146 }; | 147 }; |
147 | 148 |
148 ////////////////////////////////////////////////////////////////////////////// | 149 ////////////////////////////////////////////////////////////////////////////// |
149 | 150 |
150 static GM* MyFactory(void*) { return new SamplerStressGM; } | 151 static GM* MyFactory(void*) { return new SamplerStressGM; } |
151 static GMRegistry reg(MyFactory); | 152 static GMRegistry reg(MyFactory); |
152 | 153 |
153 } | 154 } |
OLD | NEW |