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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 canvas->clipRect(clip); | 37 canvas->clipRect(clip); |
38 canvas->drawPath(path, paint); | 38 canvas->drawPath(path, paint); |
39 canvas->restore(); | 39 canvas->restore(); |
40 } | 40 } |
41 | 41 |
42 virtual void onDraw(SkCanvas* canvas) { | 42 virtual void onDraw(SkCanvas* canvas) { |
43 struct FillAndName { | 43 struct FillAndName { |
44 SkPath::FillType fFill; | 44 SkPath::FillType fFill; |
45 const char* fName; | 45 const char* fName; |
46 }; | 46 }; |
47 static const FillAndName gFills[] = { | 47 constexpr FillAndName gFills[] = { |
48 {SkPath::kWinding_FillType, "Winding"}, | 48 {SkPath::kWinding_FillType, "Winding"}, |
49 {SkPath::kEvenOdd_FillType, "Even / Odd"}, | 49 {SkPath::kEvenOdd_FillType, "Even / Odd"}, |
50 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, | 50 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, |
51 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, | 51 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, |
52 }; | 52 }; |
53 struct StyleAndName { | 53 struct StyleAndName { |
54 SkPaint::Style fStyle; | 54 SkPaint::Style fStyle; |
55 const char* fName; | 55 const char* fName; |
56 }; | 56 }; |
57 static const StyleAndName gStyles[] = { | 57 constexpr StyleAndName gStyles[] = { |
58 {SkPaint::kFill_Style, "Fill"}, | 58 {SkPaint::kFill_Style, "Fill"}, |
59 {SkPaint::kStroke_Style, "Stroke"}, | 59 {SkPaint::kStroke_Style, "Stroke"}, |
60 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, | 60 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, |
61 }; | 61 }; |
62 | 62 |
63 SkPaint titlePaint; | 63 SkPaint titlePaint; |
64 titlePaint.setColor(SK_ColorBLACK); | 64 titlePaint.setColor(SK_ColorBLACK); |
65 titlePaint.setAntiAlias(true); | 65 titlePaint.setAntiAlias(true); |
66 sk_tool_utils::set_portable_typeface(&titlePaint); | 66 sk_tool_utils::set_portable_typeface(&titlePaint); |
67 titlePaint.setTextSize(15 * SK_Scalar1); | 67 titlePaint.setTextSize(15 * SK_Scalar1); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 canvas->translate(0, 40); | 200 canvas->translate(0, 40); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 private: | 204 private: |
205 typedef GM INHERITED; | 205 typedef GM INHERITED; |
206 }; | 206 }; |
207 DEF_GM( return new EmptyStrokeGM; ) | 207 DEF_GM( return new EmptyStrokeGM; ) |
208 | 208 |
209 } | 209 } |
OLD | NEW |