| 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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 canvas->clipRect(clip); | 26 canvas->clipRect(clip); |
| 27 canvas->drawPath(path, paint); | 27 canvas->drawPath(path, paint); |
| 28 canvas->restore(); | 28 canvas->restore(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 static void draw(SkCanvas* canvas, bool doClose) { | 31 static void draw(SkCanvas* canvas, bool doClose) { |
| 32 struct FillAndName { | 32 struct FillAndName { |
| 33 SkPath::FillType fFill; | 33 SkPath::FillType fFill; |
| 34 const char* fName; | 34 const char* fName; |
| 35 }; | 35 }; |
| 36 static const FillAndName gFills[] = { | 36 constexpr FillAndName gFills[] = { |
| 37 {SkPath::kWinding_FillType, "Winding"}, | 37 {SkPath::kWinding_FillType, "Winding"}, |
| 38 {SkPath::kEvenOdd_FillType, "Even / Odd"}, | 38 {SkPath::kEvenOdd_FillType, "Even / Odd"}, |
| 39 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, | 39 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, |
| 40 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, | 40 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, |
| 41 }; | 41 }; |
| 42 struct StyleAndName { | 42 struct StyleAndName { |
| 43 SkPaint::Style fStyle; | 43 SkPaint::Style fStyle; |
| 44 const char* fName; | 44 const char* fName; |
| 45 }; | 45 }; |
| 46 static const StyleAndName gStyles[] = { | 46 constexpr StyleAndName gStyles[] = { |
| 47 {SkPaint::kFill_Style, "Fill"}, | 47 {SkPaint::kFill_Style, "Fill"}, |
| 48 {SkPaint::kStroke_Style, "Stroke"}, | 48 {SkPaint::kStroke_Style, "Stroke"}, |
| 49 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, | 49 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"}, |
| 50 }; | 50 }; |
| 51 struct CapAndName { | 51 struct CapAndName { |
| 52 SkPaint::Cap fCap; | 52 SkPaint::Cap fCap; |
| 53 SkPaint::Join fJoin; | 53 SkPaint::Join fJoin; |
| 54 const char* fName; | 54 const char* fName; |
| 55 }; | 55 }; |
| 56 static const CapAndName gCaps[] = { | 56 constexpr CapAndName gCaps[] = { |
| 57 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, | 57 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, |
| 58 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, | 58 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, |
| 59 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} | 59 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} |
| 60 }; | 60 }; |
| 61 struct PathAndName { | 61 struct PathAndName { |
| 62 SkPath fPath; | 62 SkPath fPath; |
| 63 const char* fName; | 63 const char* fName; |
| 64 }; | 64 }; |
| 65 PathAndName path; | 65 PathAndName path; |
| 66 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1); | 66 path.fPath.moveTo(25*SK_Scalar1, 15*SK_Scalar1); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 canvas->restore(); | 144 canvas->restore(); |
| 145 canvas->restore(); | 145 canvas->restore(); |
| 146 } | 146 } |
| 147 DEF_SIMPLE_GM(linepath, canvas, 1240, 390) { | 147 DEF_SIMPLE_GM(linepath, canvas, 1240, 390) { |
| 148 draw(canvas, false); | 148 draw(canvas, false); |
| 149 } | 149 } |
| 150 DEF_SIMPLE_GM(lineclosepath, canvas, 1240, 390) { | 150 DEF_SIMPLE_GM(lineclosepath, canvas, 1240, 390) { |
| 151 draw(canvas, true); | 151 draw(canvas, true); |
| 152 } | 152 } |
| OLD | NEW |