OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrShape.h" | 8 #include "GrShape.h" |
9 | 9 |
10 GrShape& GrShape::operator=(const GrShape& that) { | 10 GrShape& GrShape::operator=(const GrShape& that) { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 fType = Type::kEmpty; | 396 fType = Type::kEmpty; |
397 return; | 397 return; |
398 } | 398 } |
399 if (!this->style().hasPathEffect()) { | 399 if (!this->style().hasPathEffect()) { |
400 fRRectData.fDir = kDefaultRRectDir; | 400 fRRectData.fDir = kDefaultRRectDir; |
401 fRRectData.fStart = kDefaultRRectStart; | 401 fRRectData.fStart = kDefaultRRectStart; |
402 } else if (fStyle.isDashed()) { | 402 } else if (fStyle.isDashed()) { |
403 // Dashing ignores the inverseness (currently). skbug.com/5421 | 403 // Dashing ignores the inverseness (currently). skbug.com/5421 |
404 fRRectData.fInverted = false; | 404 fRRectData.fInverted = false; |
405 } | 405 } |
| 406 // Turn a stroke-and-filled miter rect into a filled rect. TODO: more rrect
stroke shortcuts. |
| 407 if (!fStyle.hasPathEffect() && |
| 408 fStyle.strokeRec().getStyle() == SkStrokeRec::kStrokeAndFill_Style && |
| 409 fStyle.strokeRec().getJoin() == SkPaint::kMiter_Join && |
| 410 fStyle.strokeRec().getMiter() >= SK_ScalarSqrt2 && |
| 411 fRRectData.fRRect.isRect()) { |
| 412 SkScalar r = fStyle.strokeRec().getWidth() / 2; |
| 413 fRRectData.fRRect = SkRRect::MakeRect(fRRectData.fRRect.rect().makeOutse
t(r, r)); |
| 414 fStyle = GrStyle::SimpleFill(); |
| 415 } |
406 } | 416 } |
407 | 417 |
408 void GrShape::attemptToSimplifyLine() { | 418 void GrShape::attemptToSimplifyLine() { |
409 SkASSERT(Type::kLine == fType); | 419 SkASSERT(Type::kLine == fType); |
410 SkASSERT(!fInheritedKey.count()); | 420 SkASSERT(!fInheritedKey.count()); |
411 if (fStyle.isDashed()) { | 421 if (fStyle.isDashed()) { |
412 // Dashing ignores inverseness. | 422 // Dashing ignores inverseness. |
413 fLineData.fInverted = false; | 423 fLineData.fInverted = false; |
414 return; | 424 return; |
415 } else if (fStyle.hasPathEffect()) { | 425 } else if (fStyle.hasPathEffect()) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 fStyle = GrStyle::SimpleFill(); | 482 fStyle = GrStyle::SimpleFill(); |
473 return; | 483 return; |
474 } | 484 } |
475 } | 485 } |
476 // Only path effects could care about the order of the points. Otherwise can
onicalize | 486 // Only path effects could care about the order of the points. Otherwise can
onicalize |
477 // the point order. | 487 // the point order. |
478 if (pts[1].fY < pts[0].fY || (pts[1].fY == pts[0].fY && pts[1].fX < pts[0].f
X)) { | 488 if (pts[1].fY < pts[0].fY || (pts[1].fY == pts[0].fY && pts[1].fX < pts[0].f
X)) { |
479 SkTSwap(pts[0], pts[1]); | 489 SkTSwap(pts[0], pts[1]); |
480 } | 490 } |
481 } | 491 } |
OLD | NEW |