OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkTypeface.h" | 10 #include "SkTypeface.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 // Black text is the testcase, eg. the text. | 133 // Black text is the testcase, eg. the text. |
134 paint.setColor(SK_ColorBLACK); | 134 paint.setColor(SK_ColorBLACK); |
135 paint.setStrokeWidth(fStrokeWidth); | 135 paint.setStrokeWidth(fStrokeWidth); |
136 paint.setStyle(fStrokeStyle); | 136 paint.setStyle(fStrokeStyle); |
137 canvas->drawText(kText, sizeof(kText) - 1, 0.0f, 0.0f, paint); | 137 canvas->drawText(kText, sizeof(kText) - 1, 0.0f, 0.0f, paint); |
138 | 138 |
139 if (drawRef) { | 139 if (drawRef) { |
140 SkScalar widths[sizeof(kText) - 1]; | 140 SkScalar widths[sizeof(kText) - 1]; |
141 paint.getTextWidths(kText, sizeof(kText) - 1, widths, NULL); | 141 paint.getTextWidths(kText, sizeof(kText) - 1, widths, nullptr); |
142 | 142 |
143 paint.setStrokeWidth(0.0f); | 143 paint.setStrokeWidth(0.0f); |
144 paint.setStyle(SkPaint::kStroke_Style); | 144 paint.setStyle(SkPaint::kStroke_Style); |
145 | 145 |
146 // Magenta lines are the positions for the characters. | 146 // Magenta lines are the positions for the characters. |
147 paint.setColor(SK_ColorMAGENTA); | 147 paint.setColor(SK_ColorMAGENTA); |
148 SkScalar w = bounds.x(); | 148 SkScalar w = bounds.x(); |
149 for (size_t i = 0; i < sizeof(kText) - 1; ++i) { | 149 for (size_t i = 0; i < sizeof(kText) - 1; ++i) { |
150 canvas->drawLine(w, 0.0f, w, 5.0f, paint); | 150 canvas->drawLine(w, 0.0f, w, 5.0f, paint); |
151 w += widths[i]; | 151 w += widths[i]; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); | 184 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); |
185 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); | 185 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); |
186 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); | 186 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); |
187 static GMRegistry reg4(GlyphPosStrokeFactory); | 187 static GMRegistry reg4(GlyphPosStrokeFactory); |
188 static GMRegistry reg5(GlyphPosHairlineFillFactory); | 188 static GMRegistry reg5(GlyphPosHairlineFillFactory); |
189 static GMRegistry reg6(GlyphPosFillFactory); | 189 static GMRegistry reg6(GlyphPosFillFactory); |
190 | 190 |
191 | 191 |
192 } | 192 } |
OLD | NEW |