OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTessellatingPathRenderer.h" | 8 #include "GrTessellatingPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1585 | 1585 |
1586 TessellatingPathBatch(const GrColor& color, | 1586 TessellatingPathBatch(const GrColor& color, |
1587 const SkPath& path, | 1587 const SkPath& path, |
1588 const GrStrokeInfo& stroke, | 1588 const GrStrokeInfo& stroke, |
1589 const SkMatrix& viewMatrix, | 1589 const SkMatrix& viewMatrix, |
1590 const SkRect& clipBounds) | 1590 const SkRect& clipBounds) |
1591 : INHERITED(ClassID()) | 1591 : INHERITED(ClassID()) |
1592 , fColor(color) | 1592 , fColor(color) |
1593 , fPath(path) | 1593 , fPath(path) |
1594 , fStroke(stroke) | 1594 , fStroke(stroke) |
1595 , fViewMatrix(viewMatrix) | 1595 , fViewMatrix(viewMatrix) { |
1596 , fClipBounds(clipBounds) { | 1596 const SkRect& pathBounds = path.getBounds(); |
1597 fBounds = path.getBounds(); | 1597 fClipBounds = clipBounds; |
1598 // Because the clip bounds are used to add a contour for inverse fills, they must also | |
1599 // include the path bounds. | |
robertphillips
2015/11/23 17:22:55
// This will increase the size of the resulting ge
bsalomon
2015/11/23 17:59:34
It's not fundamentally for clipping. The current c
| |
1600 fClipBounds.join(pathBounds); | |
1601 if (path.isInverseFillType()) { | |
1602 fBounds = fClipBounds; | |
1603 } else { | |
1604 fBounds = path.getBounds(); | |
1605 } | |
1598 if (!stroke.isFillStyle()) { | 1606 if (!stroke.isFillStyle()) { |
1599 SkScalar radius = SkScalarHalf(stroke.getWidth()); | 1607 SkScalar radius = SkScalarHalf(stroke.getWidth()); |
1600 if (stroke.getJoin() == SkPaint::kMiter_Join) { | 1608 if (stroke.getJoin() == SkPaint::kMiter_Join) { |
1601 SkScalar scale = stroke.getMiter(); | 1609 SkScalar scale = stroke.getMiter(); |
1602 if (scale > SK_Scalar1) { | 1610 if (scale > SK_Scalar1) { |
1603 radius = SkScalarMul(radius, scale); | 1611 radius = SkScalarMul(radius, scale); |
1604 } | 1612 } |
1605 } | 1613 } |
1606 fBounds.outset(radius, radius); | 1614 fBounds.outset(radius, radius); |
1607 } | 1615 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1654 bool result = viewMatrix.invert(&vmi); | 1662 bool result = viewMatrix.invert(&vmi); |
1655 if (!result) { | 1663 if (!result) { |
1656 SkFAIL("Cannot invert matrix\n"); | 1664 SkFAIL("Cannot invert matrix\n"); |
1657 } | 1665 } |
1658 vmi.mapRect(&clipBounds); | 1666 vmi.mapRect(&clipBounds); |
1659 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); | 1667 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); |
1660 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds); | 1668 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds); |
1661 } | 1669 } |
1662 | 1670 |
1663 #endif | 1671 #endif |
OLD | NEW |