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 "SkPatchGrid.h" | 8 #include "SkPatchGrid.h" |
9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 | 10 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 } | 168 } |
169 // Draw the patches by generating their geometry with the maximum level of d
etail per axis. | 169 // Draw the patches by generating their geometry with the maximum level of d
etail per axis. |
170 for (int x = 0; x < fCols; x++) { | 170 for (int x = 0; x < fCols; x++) { |
171 for (int y = 0; y < fRows; y++) { | 171 for (int y = 0; y < fRows; y++) { |
172 SkPoint cubics[12]; | 172 SkPoint cubics[12]; |
173 SkPoint texCoords[4]; | 173 SkPoint texCoords[4]; |
174 SkColor colors[4]; | 174 SkColor colors[4]; |
175 this->getPatch(x, y, cubics, colors, texCoords); | 175 this->getPatch(x, y, cubics, colors, texCoords); |
176 SkPatchUtils::VertexData data; | 176 SkPatchUtils::VertexData data; |
177 SkPatchUtils::getVertexData(&data, cubics, | 177 if (SkPatchUtils::getVertexData(&data, cubics, |
178 fModeFlags & kColors_VertexType ? colors
: NULL, | 178 fModeFlags & kColors_VertexType ? co
lors : NULL, |
179 fModeFlags & kTexs_VertexType ? texCoord
s : NULL, | 179 fModeFlags & kTexs_VertexType ? texC
oords : NULL, |
180 maxCols[x], maxRows[y]); | 180 maxCols[x], maxRows[y])) { |
181 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, data.fVertexCo
unt, | 181 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, data.fVert
exCount, |
182 data.fPoints, data.fTexCoords, data.fColors, fX
ferMode, | 182 data.fPoints, data.fTexCoords, data.fColors
, fXferMode, |
183 data.fIndices, data.fIndexCount, paint); | 183 data.fIndices, data.fIndexCount, paint); |
| 184 } |
184 } | 185 } |
185 } | 186 } |
186 SkDELETE_ARRAY(maxCols); | 187 SkDELETE_ARRAY(maxCols); |
187 SkDELETE_ARRAY(maxRows); | 188 SkDELETE_ARRAY(maxRows); |
188 } | 189 } |
OLD | NEW |