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 "GrAAHairLinePathRenderer.h" | 8 #include "GrAAHairLinePathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 338 } |
339 break; | 339 break; |
340 } | 340 } |
341 case SkPath::kCubic_Verb: | 341 case SkPath::kCubic_Verb: |
342 m.mapPoints(devPts, pathPts, 4); | 342 m.mapPoints(devPts, pathPts, 4); |
343 bounds.setBounds(devPts, 4); | 343 bounds.setBounds(devPts, 4); |
344 bounds.outset(SK_Scalar1, SK_Scalar1); | 344 bounds.outset(SK_Scalar1, SK_Scalar1); |
345 bounds.roundOut(&ibounds); | 345 bounds.roundOut(&ibounds); |
346 if (SkIRect::Intersects(devClipBounds, ibounds)) { | 346 if (SkIRect::Intersects(devClipBounds, ibounds)) { |
347 PREALLOC_PTARRAY(32) q; | 347 PREALLOC_PTARRAY(32) q; |
348 // we don't need a direction if we aren't constraining the s
ubdivision | |
349 const SkPathPriv::FirstDirection kDummyDir = SkPathPriv::kCC
W_FirstDirection; | |
350 // We convert cubics to quadratics (for now). | 348 // We convert cubics to quadratics (for now). |
351 // In perspective have to do conversion in src space. | 349 // In perspective have to do conversion in src space. |
352 if (persp) { | 350 if (persp) { |
353 SkScalar tolScale = | 351 SkScalar tolScale = |
354 GrPathUtils::scaleToleranceToSrc(SK_Scalar1, m, | 352 GrPathUtils::scaleToleranceToSrc(SK_Scalar1, m, path
.getBounds()); |
355 path.getBounds()); | 353 GrPathUtils::convertCubicToQuads(pathPts, tolScale, &q); |
356 GrPathUtils::convertCubicToQuads(pathPts, tolScale, fals
e, kDummyDir, &q); | |
357 } else { | 354 } else { |
358 GrPathUtils::convertCubicToQuads(devPts, SK_Scalar1, fal
se, kDummyDir, &q); | 355 GrPathUtils::convertCubicToQuads(devPts, SK_Scalar1, &q)
; |
359 } | 356 } |
360 for (int i = 0; i < q.count(); i += 3) { | 357 for (int i = 0; i < q.count(); i += 3) { |
361 SkPoint* qInDevSpace; | 358 SkPoint* qInDevSpace; |
362 // bounds has to be calculated in device space, but q is | 359 // bounds has to be calculated in device space, but q is |
363 // in src space when there is perspective. | 360 // in src space when there is perspective. |
364 if (persp) { | 361 if (persp) { |
365 m.mapPoints(devPts, &q[i], 3); | 362 m.mapPoints(devPts, &q[i], 3); |
366 bounds.setBounds(devPts, 3); | 363 bounds.setBounds(devPts, 3); |
367 qInDevSpace = devPts; | 364 qInDevSpace = devPts; |
368 } else { | 365 } else { |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 GrColor color = GrRandomColor(random); | 990 GrColor color = GrRandomColor(random); |
994 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 991 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
995 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 992 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
996 SkPath path = GrTest::TestPath(random); | 993 SkPath path = GrTest::TestPath(random); |
997 SkIRect devClipBounds; | 994 SkIRect devClipBounds; |
998 devClipBounds.setEmpty(); | 995 devClipBounds.setEmpty(); |
999 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 996 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
1000 } | 997 } |
1001 | 998 |
1002 #endif | 999 #endif |
OLD | NEW |