OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrStrokePathRenderer.h" | 8 #include "GrStrokePathRenderer.h" |
9 | 9 |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 *idxs++ = vCount+2; | 259 *idxs++ = vCount+2; |
260 *idxs++ = vCount+3; | 260 *idxs++ = vCount+3; |
261 | 261 |
262 vCount += 4; | 262 vCount += 4; |
263 iCount += 6; | 263 iCount += 6; |
264 } | 264 } |
265 } | 265 } |
266 break; | 266 break; |
267 case SkPath::kQuad_Verb: | 267 case SkPath::kQuad_Verb: |
268 case SkPath::kCubic_Verb: | 268 case SkPath::kCubic_Verb: |
269 SkASSERT(!"Curves not supported!"); | 269 SkDEBUGFAIL("Curves not supported!"); |
270 default: | 270 default: |
271 // Unhandled cases | 271 // Unhandled cases |
272 SkASSERT(false); | 272 SkASSERT(false); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 if (isOpen) { | 276 if (isOpen) { |
277 // Add caps | 277 // Add caps |
278 switch (stroke.getCap()) { | 278 switch (stroke.getCap()) { |
279 case SkPaint::kSquare_Cap: | 279 case SkPaint::kSquare_Cap: |
280 firstPt[0] -= firstDir; | 280 firstPt[0] -= firstDir; |
281 firstPt[1] -= firstDir; | 281 firstPt[1] -= firstDir; |
282 lastPt [0] += dir; | 282 lastPt [0] += dir; |
283 lastPt [1] += dir; | 283 lastPt [1] += dir; |
284 break; | 284 break; |
285 case SkPaint::kRound_Cap: | 285 case SkPaint::kRound_Cap: |
286 SkASSERT(!"Round caps not supported!"); | 286 SkDEBUGFAIL("Round caps not supported!"); |
287 default: // No cap | 287 default: // No cap |
288 break; | 288 break; |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 SkASSERT(vCount <= maxVertexCount); | 292 SkASSERT(vCount <= maxVertexCount); |
293 SkASSERT(iCount <= maxIndexCount); | 293 SkASSERT(iCount <= maxIndexCount); |
294 | 294 |
295 if (vCount > 0) { | 295 if (vCount > 0) { |
296 target->drawIndexed(kTriangles_GrPrimitiveType, | 296 target->drawIndexed(kTriangles_GrPrimitiveType, |
297 0, // start vertex | 297 0, // start vertex |
298 0, // start index | 298 0, // start index |
299 vCount, | 299 vCount, |
300 iCount); | 300 iCount); |
301 } | 301 } |
302 | 302 |
303 return true; | 303 return true; |
304 } | 304 } |
OLD | NEW |