Michael Ludwig | 417f3a5 | 2020-08-11 17:26:09 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "gm/gm.h" |
| 9 | #include "include/core/SkCanvas.h" |
| 10 | #include "include/core/SkPaint.h" |
| 11 | #include "include/core/SkPath.h" |
| 12 | #include "include/effects/SkDashPathEffect.h" |
| 13 | |
| 14 | DEF_SIMPLE_GM(crbug_1113794, canvas, 600, 200) { |
Mike Reed | 15a5403 | 2020-08-16 11:15:41 -0400 | [diff] [blame] | 15 | SkPath path = SkPath::Line({50.f, 80.f}, {50.f, 20.f}); |
Michael Ludwig | 417f3a5 | 2020-08-11 17:26:09 -0400 | [diff] [blame] | 16 | |
| 17 | SkPaint paint; |
| 18 | paint.setColor(SK_ColorBLACK); |
| 19 | paint.setAntiAlias(true); |
| 20 | paint.setStrokeWidth(0.25f); |
| 21 | paint.setStyle(SkPaint::kStroke_Style); |
| 22 | |
| 23 | static constexpr SkScalar kDash[2] = {10.f, 10.f}; |
| 24 | paint.setPathEffect(SkDashPathEffect::Make(kDash, 2, 0.f)); |
| 25 | |
| 26 | SkMatrix viewBox = SkMatrix::MakeRectToRect(SkRect::MakeWH(100, 100), SkRect::MakeWH(600, 200), SkMatrix::kFill_ScaleToFit); |
| 27 | canvas->concat(viewBox); |
| 28 | |
| 29 | canvas->drawPath(path, paint); |
| 30 | } |