| 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 "SkPatchGrid.h" | 9 #include "SkPatchGrid.h" |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 SkPoint vrtCtrl[6][5] = { | 99 SkPoint vrtCtrl[6][5] = { |
| 100 {{50,75},{150,75},{250,75},{350,75},{450,75}}, | 100 {{50,75},{150,75},{250,75},{350,75},{450,75}}, |
| 101 {{50,125},{150,125},{250,125},{350,125},{450,125}}, | 101 {{50,125},{150,125},{250,125},{350,125},{450,125}}, |
| 102 {{50,175},{150,175},{220,225},{350,175},{470,225}}, | 102 {{50,175},{150,175},{220,225},{350,175},{470,225}}, |
| 103 {{50,225},{150,225},{220,175},{350,225},{470,155}}, | 103 {{50,225},{150,225},{220,175},{350,225},{470,155}}, |
| 104 {{50,275},{150,275},{250,275},{350,275},{400,305}}, | 104 {{50,275},{150,275},{250,275},{350,275},{400,305}}, |
| 105 {{50,325},{150,325},{250,325},{350,325},{450,325}} | 105 {{50,325},{150,325},{250,325},{350,325},{450,325}} |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 static const int kRows = 3; | 108 constexpr int kRows = 3; |
| 109 static const int kCols = 4; | 109 constexpr int kCols = 4; |
| 110 | 110 |
| 111 canvas->scale(3, 3); | 111 canvas->scale(3, 3); |
| 112 SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr)
; | 112 SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr)
; |
| 113 for (int i = 0; i < kRows; i++) { | 113 for (int i = 0; i < kRows; i++) { |
| 114 for (int j = 0; j < kCols; j++) { | 114 for (int j = 0; j < kCols; j++) { |
| 115 SkPoint points[12]; | 115 SkPoint points[12]; |
| 116 | 116 |
| 117 //set corners | 117 //set corners |
| 118 points[SkPatchUtils::kTopP0_CubicCtrlPts] = vertices[i][j]; | 118 points[SkPatchUtils::kTopP0_CubicCtrlPts] = vertices[i][j]; |
| 119 points[SkPatchUtils::kTopP3_CubicCtrlPts] = vertices[i][j + 1]; | 119 points[SkPatchUtils::kTopP3_CubicCtrlPts] = vertices[i][j + 1]; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 typedef GM INHERITED; | 155 typedef GM INHERITED; |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 DEF_GM(return new SkPatchGridGM;) | 158 DEF_GM(return new SkPatchGridGM;) |
| 159 } | 159 } |
| OLD | NEW |