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 | 9 |
10 class SkJSCanvas { | 10 class SkJSCanvas { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 ctx.fillText("As Expected - line width 1", 10, 10); | 174 ctx.fillText("As Expected - line width 1", 10, 10); |
175 } | 175 } |
176 | 176 |
177 class Poly2PolyGM : public skiagm::GM { | 177 class Poly2PolyGM : public skiagm::GM { |
178 public: | 178 public: |
179 Poly2PolyGM() {} | 179 Poly2PolyGM() {} |
180 | 180 |
181 protected: | 181 protected: |
182 | 182 |
183 SkString onShortName() SK_OVERRIDE { | 183 SkString onShortName() override { |
184 return SkString("poly2poly"); | 184 return SkString("poly2poly"); |
185 } | 185 } |
186 | 186 |
187 SkISize onISize() SK_OVERRIDE { | 187 SkISize onISize() override { |
188 return SkISize::Make(835, 840); | 188 return SkISize::Make(835, 840); |
189 } | 189 } |
190 | 190 |
191 static void doDraw(SkCanvas* canvas, SkPaint* paint, const int isrc[], | 191 static void doDraw(SkCanvas* canvas, SkPaint* paint, const int isrc[], |
192 const int idst[], int count) { | 192 const int idst[], int count) { |
193 SkMatrix matrix; | 193 SkMatrix matrix; |
194 SkPoint src[4], dst[4]; | 194 SkPoint src[4], dst[4]; |
195 | 195 |
196 for (int i = 0; i < count; i++) { | 196 for (int i = 0; i < count; i++) { |
197 src[i].set(SkIntToScalar(isrc[2*i+0]), SkIntToScalar(isrc[2*i+1])); | 197 src[i].set(SkIntToScalar(isrc[2*i+0]), SkIntToScalar(isrc[2*i+1])); |
(...skipping 17 matching lines...) Expand all Loading... |
215 paint->setStyle(SkPaint::kFill_Style); | 215 paint->setStyle(SkPaint::kFill_Style); |
216 SkScalar x = D/2; | 216 SkScalar x = D/2; |
217 SkScalar y = D/2 - (fm.fAscent + fm.fDescent)/2; | 217 SkScalar y = D/2 - (fm.fAscent + fm.fDescent)/2; |
218 SkString str; | 218 SkString str; |
219 str.appendS32(count); | 219 str.appendS32(count); |
220 canvas->drawText(str.c_str(), str.size(), x, y, *paint); | 220 canvas->drawText(str.c_str(), str.size(), x, y, *paint); |
221 | 221 |
222 canvas->restore(); | 222 canvas->restore(); |
223 } | 223 } |
224 | 224 |
225 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 225 void onDraw(SkCanvas* canvas) override { |
226 if (false) { test_stroke(canvas); return; } | 226 if (false) { test_stroke(canvas); return; } |
227 | 227 |
228 SkPaint paint; | 228 SkPaint paint; |
229 paint.setAntiAlias(true); | 229 paint.setAntiAlias(true); |
230 sk_tool_utils::set_portable_typeface(&paint); | 230 sk_tool_utils::set_portable_typeface(&paint); |
231 paint.setStrokeWidth(SkIntToScalar(4)); | 231 paint.setStrokeWidth(SkIntToScalar(4)); |
232 paint.setTextSize(SkIntToScalar(40)); | 232 paint.setTextSize(SkIntToScalar(40)); |
233 paint.setTextAlign(SkPaint::kCenter_Align); | 233 paint.setTextAlign(SkPaint::kCenter_Align); |
234 | 234 |
235 canvas->save(); | 235 canvas->save(); |
(...skipping 29 matching lines...) Expand all Loading... |
265 canvas->restore(); | 265 canvas->restore(); |
266 } | 266 } |
267 | 267 |
268 private: | 268 private: |
269 typedef skiagm::GM INHERITED; | 269 typedef skiagm::GM INHERITED; |
270 }; | 270 }; |
271 | 271 |
272 ////////////////////////////////////////////////////////////////////////////// | 272 ////////////////////////////////////////////////////////////////////////////// |
273 | 273 |
274 DEF_GM( return new Poly2PolyGM; ) | 274 DEF_GM( return new Poly2PolyGM; ) |
OLD | NEW |