OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 | 338 |
339 ~SkDrawIter() { | 339 ~SkDrawIter() { |
340 if (fMultiDeviceCS) { | 340 if (fMultiDeviceCS) { |
341 fMultiDeviceCS->restore(); | 341 fMultiDeviceCS->restore(); |
342 } | 342 } |
343 } | 343 } |
344 | 344 |
345 bool next() { | 345 bool next() { |
346 if (fMultiDeviceCS && fDevice) { | 346 if (fMultiDeviceCS && fDevice) { |
347 // remove the previous device's bounds | 347 // remove the previous device's bounds |
348 fMultiDeviceCS->clipDevRect(compute_device_bounds(fDevice), | 348 fMultiDeviceCS->clipDevRect(compute_device_bounds(fDevice), SkCanvas ::kDifference_Op); |
349 SkRegion::kDifference_Op); | |
350 } | 349 } |
351 | 350 |
352 // skip over recs with empty clips | 351 // skip over recs with empty clips |
353 while (fCurrLayer && fCurrLayer->fClip.isEmpty()) { | 352 while (fCurrLayer && fCurrLayer->fClip.isEmpty()) { |
354 fCurrLayer = fCurrLayer->fNext; | 353 fCurrLayer = fCurrLayer->fNext; |
355 } | 354 } |
356 | 355 |
357 const DeviceCM* rec = fCurrLayer; | 356 const DeviceCM* rec = fCurrLayer; |
358 if (rec && rec->fDevice) { | 357 if (rec && rec->fDevice) { |
359 | 358 |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1104 } | 1103 } |
1105 return false; | 1104 return false; |
1106 } | 1105 } |
1107 } else { // no user bounds, so just use the clip | 1106 } else { // no user bounds, so just use the clip |
1108 ir = clipBounds; | 1107 ir = clipBounds; |
1109 } | 1108 } |
1110 SkASSERT(!ir.isEmpty()); | 1109 SkASSERT(!ir.isEmpty()); |
1111 | 1110 |
1112 if (BoundsAffectsClip(saveLayerFlags)) { | 1111 if (BoundsAffectsClip(saveLayerFlags)) { |
1113 // Simplify the current clips since they will be applied properly during restore() | 1112 // Simplify the current clips since they will be applied properly during restore() |
1114 fClipStack->clipDevRect(ir, SkRegion::kReplace_Op); | 1113 fClipStack->clipDevRect(ir, kReplace_Op); |
1115 fMCRec->fRasterClip.setRect(ir); | 1114 fMCRec->fRasterClip.setRect(ir); |
1116 fDeviceClipBounds = qr_clip_bounds(ir); | 1115 fDeviceClipBounds = qr_clip_bounds(ir); |
1117 } | 1116 } |
1118 | 1117 |
1119 if (intersection) { | 1118 if (intersection) { |
1120 *intersection = ir; | 1119 *intersection = ir; |
1121 } | 1120 } |
1122 return true; | 1121 return true; |
1123 } | 1122 } |
1124 | 1123 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1536 this->fLights = lights; | 1535 this->fLights = lights; |
1537 } | 1536 } |
1538 | 1537 |
1539 sk_sp<SkLights> SkCanvas::getLights() const { | 1538 sk_sp<SkLights> SkCanvas::getLights() const { |
1540 return this->fLights; | 1539 return this->fLights; |
1541 } | 1540 } |
1542 #endif | 1541 #endif |
1543 | 1542 |
1544 ////////////////////////////////////////////////////////////////////////////// | 1543 ////////////////////////////////////////////////////////////////////////////// |
1545 | 1544 |
1546 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { | 1545 void SkCanvas::clipRect(const SkRect& rect, ClipOp op, bool doAA) { |
1547 if (!fAllowSoftClip) { | 1546 if (!fAllowSoftClip) { |
1548 doAA = false; | 1547 doAA = false; |
1549 } | 1548 } |
1550 | 1549 |
1551 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT | 1550 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT |
1552 // Check if we can quick-accept the clip call (and do nothing) | 1551 // Check if we can quick-accept the clip call (and do nothing) |
1553 // | 1552 // |
1554 if (SkRegion::kIntersect_Op == op && !doAA && fMCRec->fMatrix.isScaleTransla te()) { | 1553 if (SkRegion::kIntersect_Op == op && !doAA && fMCRec->fMatrix.isScaleTransla te()) { |
f(malita)
2016/09/19 19:43:25
kIntersect_Op
reed1
2016/09/19 20:42:50
deleted
| |
1555 SkRect devR; | 1554 SkRect devR; |
1556 fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect); | 1555 fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect); |
1557 // NOTE: this check is CTM specific, since we might round differently wi th a different | 1556 // NOTE: this check is CTM specific, since we might round differently wi th a different |
1558 // CTM. Thus this is only 100% reliable if there is not global CTM scale to be | 1557 // CTM. Thus this is only 100% reliable if there is not global CTM scale to be |
1559 // applied later (i.e. if this is going into a picture). | 1558 // applied later (i.e. if this is going into a picture). |
1560 if (devR.round().contains(fMCRec->fRasterClip.getBounds())) { | 1559 if (devR.round().contains(fMCRec->fRasterClip.getBounds())) { |
1561 #if 0 | 1560 #if 0 |
1562 SkDebugf("ignored clipRect [%g %g %g %g]\n", | 1561 SkDebugf("ignored clipRect [%g %g %g %g]\n", |
1563 rect.left(), rect.top(), rect.right(), rect.bottom()); | 1562 rect.left(), rect.top(), rect.right(), rect.bottom()); |
1564 #endif | 1563 #endif |
1565 return; | 1564 return; |
1566 } | 1565 } |
1567 } | 1566 } |
1568 #endif | 1567 #endif |
1569 | 1568 |
1570 this->checkForDeferredSave(); | 1569 this->checkForDeferredSave(); |
1571 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; | 1570 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; |
1572 this->onClipRect(rect, op, edgeStyle); | 1571 this->onClipRect(rect, op, edgeStyle); |
1573 } | 1572 } |
1574 | 1573 |
1575 void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg eStyle) { | 1574 void SkCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle ) { |
1576 #ifdef SK_ENABLE_CLIP_QUICKREJECT | 1575 #ifdef SK_ENABLE_CLIP_QUICKREJECT |
1577 if (SkRegion::kIntersect_Op == op) { | 1576 if (SkRegion::kIntersect_Op == op) { |
f(malita)
2016/09/19 19:43:25
kIntersect_Op
reed1
2016/09/19 20:42:50
deleted
| |
1578 if (fMCRec->fRasterClip.isEmpty()) { | 1577 if (fMCRec->fRasterClip.isEmpty()) { |
1579 return; | 1578 return; |
1580 } | 1579 } |
1581 | 1580 |
1582 if (this->quickReject(rect)) { | 1581 if (this->quickReject(rect)) { |
1583 fDeviceCMDirty = true; | 1582 fDeviceCMDirty = true; |
1584 fCachedLocalClipBoundsDirty = true; | 1583 fCachedLocalClipBoundsDirty = true; |
1585 | 1584 |
1586 fClipStack->clipEmpty(); | 1585 fClipStack->clipEmpty(); |
1587 (void)fMCRec->fRasterClip.setEmpty(); | 1586 (void)fMCRec->fRasterClip.setEmpty(); |
1588 fDeviceClipBounds.setEmpty(); | 1587 fDeviceClipBounds.setEmpty(); |
1589 return; | 1588 return; |
1590 } | 1589 } |
1591 } | 1590 } |
1592 #endif | 1591 #endif |
1593 | 1592 |
1594 const bool isScaleTrans = fMCRec->fMatrix.isScaleTranslate(); | 1593 const bool isScaleTrans = fMCRec->fMatrix.isScaleTranslate(); |
1595 SkRect devR; | 1594 SkRect devR; |
1596 if (isScaleTrans) { | 1595 if (isScaleTrans) { |
1597 fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect); | 1596 fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect); |
1598 } | 1597 } |
1599 | 1598 |
1600 #ifndef SK_SUPPORT_PRECHECK_CLIPRECT | 1599 #ifndef SK_SUPPORT_PRECHECK_CLIPRECT |
1601 if (SkRegion::kIntersect_Op == op && | 1600 if (kIntersect_Op == op && kHard_ClipEdgeStyle == edgeStyle && isScaleTrans) { |
1602 kHard_ClipEdgeStyle == edgeStyle | |
1603 && isScaleTrans) | |
1604 { | |
1605 if (devR.round().contains(fMCRec->fRasterClip.getBounds())) { | 1601 if (devR.round().contains(fMCRec->fRasterClip.getBounds())) { |
1606 #if 0 | 1602 #if 0 |
1607 SkDebugf("------- ignored clipRect [%g %g %g %g]\n", | 1603 SkDebugf("------- ignored clipRect [%g %g %g %g]\n", |
1608 rect.left(), rect.top(), rect.right(), rect.bottom()); | 1604 rect.left(), rect.top(), rect.right(), rect.bottom()); |
1609 #endif | 1605 #endif |
1610 return; | 1606 return; |
1611 } | 1607 } |
1612 } | 1608 } |
1613 #endif | 1609 #endif |
1614 | 1610 |
1615 AutoValidateClip avc(this); | 1611 AutoValidateClip avc(this); |
1616 | 1612 |
1617 fDeviceCMDirty = true; | 1613 fDeviceCMDirty = true; |
1618 | 1614 |
1619 if (isScaleTrans) { | 1615 if (isScaleTrans) { |
1620 const bool isAA = kSoft_ClipEdgeStyle == edgeStyle; | 1616 const bool isAA = kSoft_ClipEdgeStyle == edgeStyle; |
1621 fClipStack->clipDevRect(devR, op, isAA); | 1617 fClipStack->clipDevRect(devR, op, isAA); |
1622 fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), op, isAA); | 1618 fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), (SkRegion::Op)op , isAA); |
f(malita)
2016/09/19 19:43:25
Maybe add static asserts for all ClipOp values mat
reed1
2016/09/19 20:42:50
Done.
| |
1623 } else { | 1619 } else { |
1624 // since we're rotated or some such thing, we convert the rect to a path | 1620 // since we're rotated or some such thing, we convert the rect to a path |
1625 // and clip against that, since it can handle any matrix. However, to | 1621 // and clip against that, since it can handle any matrix. However, to |
1626 // avoid recursion in the case where we are subclassed (e.g. Pictures) | 1622 // avoid recursion in the case where we are subclassed (e.g. Pictures) |
1627 // we explicitly call "our" version of clipPath. | 1623 // we explicitly call "our" version of clipPath. |
1628 SkPath path; | 1624 SkPath path; |
1629 | 1625 |
1630 path.addRect(rect); | 1626 path.addRect(rect); |
1631 path.setIsVolatile(true); | 1627 path.setIsVolatile(true); |
1632 this->SkCanvas::onClipPath(path, op, edgeStyle); | 1628 this->SkCanvas::onClipPath(path, op, edgeStyle); |
1633 } | 1629 } |
1634 | 1630 |
1635 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); | 1631 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); |
1636 } | 1632 } |
1637 | 1633 |
1638 void SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { | 1634 void SkCanvas::clipRRect(const SkRRect& rrect, ClipOp op, bool doAA) { |
1639 this->checkForDeferredSave(); | 1635 this->checkForDeferredSave(); |
1640 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; | 1636 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; |
1641 if (rrect.isRect()) { | 1637 if (rrect.isRect()) { |
1642 this->onClipRect(rrect.getBounds(), op, edgeStyle); | 1638 this->onClipRect(rrect.getBounds(), op, edgeStyle); |
1643 } else { | 1639 } else { |
1644 this->onClipRRect(rrect, op, edgeStyle); | 1640 this->onClipRRect(rrect, op, edgeStyle); |
1645 } | 1641 } |
1646 } | 1642 } |
1647 | 1643 |
1648 void SkCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) { | 1644 void SkCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeSt yle) { |
1649 SkRRect transformedRRect; | 1645 SkRRect transformedRRect; |
1650 if (rrect.transform(fMCRec->fMatrix, &transformedRRect)) { | 1646 if (rrect.transform(fMCRec->fMatrix, &transformedRRect)) { |
1651 AutoValidateClip avc(this); | 1647 AutoValidateClip avc(this); |
1652 | 1648 |
1653 fDeviceCMDirty = true; | 1649 fDeviceCMDirty = true; |
1654 if (!fAllowSoftClip) { | 1650 if (!fAllowSoftClip) { |
1655 edgeStyle = kHard_ClipEdgeStyle; | 1651 edgeStyle = kHard_ClipEdgeStyle; |
1656 } | 1652 } |
1657 | 1653 |
1658 fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == ed geStyle); | 1654 fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == ed geStyle); |
1659 | 1655 |
1660 fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), op, | 1656 fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), (SkR egion::Op)op, |
1661 kSoft_ClipEdgeStyle == edgeStyle); | 1657 kSoft_ClipEdgeStyle == edgeStyle); |
1662 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); | 1658 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); |
1663 return; | 1659 return; |
1664 } | 1660 } |
1665 | 1661 |
1666 SkPath path; | 1662 SkPath path; |
1667 path.addRRect(rrect); | 1663 path.addRRect(rrect); |
1668 path.setIsVolatile(true); | 1664 path.setIsVolatile(true); |
1669 // call the non-virtual version | 1665 // call the non-virtual version |
1670 this->SkCanvas::onClipPath(path, op, edgeStyle); | 1666 this->SkCanvas::onClipPath(path, op, edgeStyle); |
1671 } | 1667 } |
1672 | 1668 |
1673 void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { | 1669 void SkCanvas::clipPath(const SkPath& path, ClipOp op, bool doAA) { |
1674 this->checkForDeferredSave(); | 1670 this->checkForDeferredSave(); |
1675 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; | 1671 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; |
1676 | 1672 |
1677 if (!path.isInverseFillType() && fMCRec->fMatrix.rectStaysRect()) { | 1673 if (!path.isInverseFillType() && fMCRec->fMatrix.rectStaysRect()) { |
1678 SkRect r; | 1674 SkRect r; |
1679 if (path.isRect(&r)) { | 1675 if (path.isRect(&r)) { |
1680 this->onClipRect(r, op, edgeStyle); | 1676 this->onClipRect(r, op, edgeStyle); |
1681 return; | 1677 return; |
1682 } | 1678 } |
1683 SkRRect rrect; | 1679 SkRRect rrect; |
1684 if (path.isOval(&r)) { | 1680 if (path.isOval(&r)) { |
1685 rrect.setOval(r); | 1681 rrect.setOval(r); |
1686 this->onClipRRect(rrect, op, edgeStyle); | 1682 this->onClipRRect(rrect, op, edgeStyle); |
1687 return; | 1683 return; |
1688 } | 1684 } |
1689 if (path.isRRect(&rrect)) { | 1685 if (path.isRRect(&rrect)) { |
1690 this->onClipRRect(rrect, op, edgeStyle); | 1686 this->onClipRRect(rrect, op, edgeStyle); |
1691 return; | 1687 return; |
1692 } | 1688 } |
1693 } | 1689 } |
1694 | 1690 |
1695 this->onClipPath(path, op, edgeStyle); | 1691 this->onClipPath(path, op, edgeStyle); |
1696 } | 1692 } |
1697 | 1693 |
1698 void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edg eStyle) { | 1694 void SkCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle ) { |
1699 #ifdef SK_ENABLE_CLIP_QUICKREJECT | 1695 #ifdef SK_ENABLE_CLIP_QUICKREJECT |
1700 if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) { | 1696 if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) { |
f(malita)
2016/09/19 19:43:25
kIntersect_Op
reed1
2016/09/19 20:42:50
deleted
| |
1701 if (fMCRec->fRasterClip.isEmpty()) { | 1697 if (fMCRec->fRasterClip.isEmpty()) { |
1702 return; | 1698 return; |
1703 } | 1699 } |
1704 | 1700 |
1705 if (this->quickReject(path.getBounds())) { | 1701 if (this->quickReject(path.getBounds())) { |
1706 fDeviceCMDirty = true; | 1702 fDeviceCMDirty = true; |
1707 fCachedLocalClipBoundsDirty = true; | 1703 fCachedLocalClipBoundsDirty = true; |
1708 | 1704 |
1709 fClipStack->clipEmpty(); | 1705 fClipStack->clipEmpty(); |
1710 (void)fMCRec->fRasterClip.setEmpty(); | 1706 (void)fMCRec->fRasterClip.setEmpty(); |
(...skipping 30 matching lines...) Expand all Loading... | |
1741 | 1737 |
1742 // if we called path.swap() we could avoid a deep copy of this path | 1738 // if we called path.swap() we could avoid a deep copy of this path |
1743 fClipStack->clipDevPath(devPath, op, kSoft_ClipEdgeStyle == edgeStyle); | 1739 fClipStack->clipDevPath(devPath, op, kSoft_ClipEdgeStyle == edgeStyle); |
1744 | 1740 |
1745 if (fAllowSimplifyClip) { | 1741 if (fAllowSimplifyClip) { |
1746 bool clipIsAA = getClipStack()->asPath(&devPath); | 1742 bool clipIsAA = getClipStack()->asPath(&devPath); |
1747 if (clipIsAA) { | 1743 if (clipIsAA) { |
1748 edgeStyle = kSoft_ClipEdgeStyle; | 1744 edgeStyle = kSoft_ClipEdgeStyle; |
1749 } | 1745 } |
1750 | 1746 |
1751 op = SkRegion::kReplace_Op; | 1747 op = kReplace_Op; |
1752 } | 1748 } |
1753 | 1749 |
1754 fMCRec->fRasterClip.op(devPath, this->getTopLayerBounds(), op, edgeStyle); | 1750 fMCRec->fRasterClip.op(devPath, this->getTopLayerBounds(), (SkRegion::Op)op, edgeStyle); |
1755 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); | 1751 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); |
1756 } | 1752 } |
1757 | 1753 |
1758 void SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) { | 1754 void SkCanvas::clipRegion(const SkRegion& rgn, ClipOp op) { |
1759 this->checkForDeferredSave(); | 1755 this->checkForDeferredSave(); |
1760 this->onClipRegion(rgn, op); | 1756 this->onClipRegion(rgn, op); |
1761 } | 1757 } |
1762 | 1758 |
1763 void SkCanvas::onClipRegion(const SkRegion& rgn, SkRegion::Op op) { | 1759 void SkCanvas::onClipRegion(const SkRegion& rgn, ClipOp op) { |
1764 AutoValidateClip avc(this); | 1760 AutoValidateClip avc(this); |
1765 | 1761 |
1766 fDeviceCMDirty = true; | 1762 fDeviceCMDirty = true; |
1767 | 1763 |
1768 // todo: signal fClipStack that we have a region, and therefore (I guess) | 1764 // todo: signal fClipStack that we have a region, and therefore (I guess) |
1769 // we have to ignore it, and use the region directly? | 1765 // we have to ignore it, and use the region directly? |
1770 fClipStack->clipDevRect(rgn.getBounds(), op); | 1766 fClipStack->clipDevRect(rgn.getBounds(), op); |
1771 | 1767 |
1772 fMCRec->fRasterClip.op(rgn, op); | 1768 fMCRec->fRasterClip.op(rgn, (SkRegion::Op)op); |
1773 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); | 1769 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); |
1774 } | 1770 } |
1775 | 1771 |
1776 #ifdef SK_DEBUG | 1772 #ifdef SK_DEBUG |
1777 void SkCanvas::validateClip() const { | 1773 void SkCanvas::validateClip() const { |
1778 // construct clipRgn from the clipstack | 1774 // construct clipRgn from the clipstack |
1779 const SkBaseDevice* device = this->getDevice(); | 1775 const SkBaseDevice* device = this->getDevice(); |
1780 if (!device) { | 1776 if (!device) { |
1781 SkASSERT(this->isClipEmpty()); | 1777 SkASSERT(this->isClipEmpty()); |
1782 return; | 1778 return; |
1783 } | 1779 } |
1784 | 1780 |
1785 SkIRect ir; | 1781 SkIRect ir; |
1786 ir.set(0, 0, device->width(), device->height()); | 1782 ir.set(0, 0, device->width(), device->height()); |
1787 SkRasterClip tmpClip(ir, fConservativeRasterClip); | 1783 SkRasterClip tmpClip(ir, fConservativeRasterClip); |
1788 | 1784 |
1789 SkClipStack::B2TIter iter(*fClipStack); | 1785 SkClipStack::B2TIter iter(*fClipStack); |
1790 const SkClipStack::Element* element; | 1786 const SkClipStack::Element* element; |
1791 while ((element = iter.next()) != nullptr) { | 1787 while ((element = iter.next()) != nullptr) { |
1792 switch (element->getType()) { | 1788 switch (element->getType()) { |
1793 case SkClipStack::Element::kRect_Type: | 1789 case SkClipStack::Element::kRect_Type: |
1794 element->getRect().round(&ir); | 1790 element->getRect().round(&ir); |
1795 tmpClip.op(ir, element->getOp()); | 1791 tmpClip.op(ir, (SkRegion::Op)element->getOp()); |
1796 break; | 1792 break; |
1797 case SkClipStack::Element::kEmpty_Type: | 1793 case SkClipStack::Element::kEmpty_Type: |
1798 tmpClip.setEmpty(); | 1794 tmpClip.setEmpty(); |
1799 break; | 1795 break; |
1800 default: { | 1796 default: { |
1801 SkPath path; | 1797 SkPath path; |
1802 element->asPath(&path); | 1798 element->asPath(&path); |
1803 tmpClip.op(path, this->getTopLayerBounds(), element->getOp(), el ement->isAA()); | 1799 tmpClip.op(path, this->getTopLayerBounds(), (SkRegion::Op)elemen t->getOp(), |
1800 element->isAA()); | |
1804 break; | 1801 break; |
1805 } | 1802 } |
1806 } | 1803 } |
1807 } | 1804 } |
1808 } | 1805 } |
1809 #endif | 1806 #endif |
1810 | 1807 |
1811 void SkCanvas::replayClips(ClipVisitor* visitor) const { | 1808 void SkCanvas::replayClips(ClipVisitor* visitor) const { |
1812 SkClipStack::B2TIter iter(*fClipStack); | 1809 SkClipStack::B2TIter iter(*fClipStack); |
1813 const SkClipStack::Element* element; | 1810 const SkClipStack::Element* element; |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3504 | 3501 |
3505 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3502 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3506 fCanvas->restoreToCount(fSaveCount); | 3503 fCanvas->restoreToCount(fSaveCount); |
3507 } | 3504 } |
3508 | 3505 |
3509 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3506 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3510 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { | 3507 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { |
3511 return this->makeSurface(info, props).release(); | 3508 return this->makeSurface(info, props).release(); |
3512 } | 3509 } |
3513 #endif | 3510 #endif |
3511 | |
3512 ///////////////////////////////// | |
3513 | |
3514 #ifdef SK_SUPPORT_LEGACY_CLIP_REGIONOPS | |
3515 const SkCanvas::ClipOp SkCanvas::kDifference_Op; | |
3516 const SkCanvas::ClipOp SkCanvas::kIntersect_Op; | |
3517 const SkCanvas::ClipOp SkCanvas::kUnion_Op; | |
3518 const SkCanvas::ClipOp SkCanvas::kXOR_Op; | |
3519 const SkCanvas::ClipOp SkCanvas::kReverseDifference_Op; | |
3520 const SkCanvas::ClipOp SkCanvas::kReplace_Op; | |
3521 #else | |
3522 const SkCanvas::ClipOp SkCanvas::kDifference_Op; | |
3523 const SkCanvas::ClipOp SkCanvas::kIntersect_Op; | |
3524 const SkCanvas::ClipOp SkCanvas::kUnion_Op; | |
3525 const SkCanvas::ClipOp SkCanvas::kXOR_Op; | |
3526 const SkCanvas::ClipOp SkCanvas::kReverseDifference_Op; | |
3527 const SkCanvas::ClipOp SkCanvas::kReplace_Op; | |
3528 #endif | |
OLD | NEW |