| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 if (NULL != renderTarget) { | 1589 if (NULL != renderTarget) { |
| 1590 return renderTarget->getContext(); | 1590 return renderTarget->getContext(); |
| 1591 } | 1591 } |
| 1592 } | 1592 } |
| 1593 #endif | 1593 #endif |
| 1594 | 1594 |
| 1595 return NULL; | 1595 return NULL; |
| 1596 | 1596 |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner, |
| 1600 const SkPaint& paint) { |
| 1601 if (outer.isEmpty()) { |
| 1602 return; |
| 1603 } |
| 1604 if (inner.isEmpty()) { |
| 1605 this->drawRRect(outer, paint); |
| 1606 return; |
| 1607 } |
| 1608 |
| 1609 // We don't have this method (yet), but technically this is what we should |
| 1610 // be able to assert... |
| 1611 // SkASSERT(outer.contains(inner)); |
| 1612 // |
| 1613 // For now at least check for containment of bounds |
| 1614 SkASSERT(outer.getBounds().contains(inner.getBounds())); |
| 1615 |
| 1616 this->onDrawDRRect(outer, inner, paint); |
| 1617 } |
| 1618 |
| 1599 ////////////////////////////////////////////////////////////////////////////// | 1619 ////////////////////////////////////////////////////////////////////////////// |
| 1600 // These are the virtual drawing methods | 1620 // These are the virtual drawing methods |
| 1601 ////////////////////////////////////////////////////////////////////////////// | 1621 ////////////////////////////////////////////////////////////////////////////// |
| 1602 | 1622 |
| 1603 void SkCanvas::clear(SkColor color) { | 1623 void SkCanvas::clear(SkColor color) { |
| 1604 SkDrawIter iter(this); | 1624 SkDrawIter iter(this); |
| 1605 this->predrawNotify(); | 1625 this->predrawNotify(); |
| 1606 while (iter.next()) { | 1626 while (iter.next()) { |
| 1607 iter.fDevice->clear(color); | 1627 iter.fDevice->clear(color); |
| 1608 } | 1628 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 | 1744 |
| 1725 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) | 1745 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) |
| 1726 | 1746 |
| 1727 while (iter.next()) { | 1747 while (iter.next()) { |
| 1728 iter.fDevice->drawRRect(iter, rrect, looper.paint()); | 1748 iter.fDevice->drawRRect(iter, rrect, looper.paint()); |
| 1729 } | 1749 } |
| 1730 | 1750 |
| 1731 LOOPER_END | 1751 LOOPER_END |
| 1732 } | 1752 } |
| 1733 | 1753 |
| 1754 void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, |
| 1755 const SkPaint& paint) { |
| 1756 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1757 |
| 1758 SkRect storage; |
| 1759 const SkRect* bounds = NULL; |
| 1760 if (paint.canComputeFastBounds()) { |
| 1761 bounds = &paint.computeFastBounds(outer.getBounds(), &storage); |
| 1762 if (this->quickReject(*bounds)) { |
| 1763 return; |
| 1764 } |
| 1765 } |
| 1766 |
| 1767 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) |
| 1768 |
| 1769 while (iter.next()) { |
| 1770 iter.fDevice->drawDRRect(iter, outer, inner, looper.paint()); |
| 1771 } |
| 1772 |
| 1773 LOOPER_END |
| 1774 } |
| 1734 | 1775 |
| 1735 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { | 1776 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
| 1736 CHECK_SHADER_NOSETCONTEXT(paint); | 1777 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1737 | 1778 |
| 1738 if (!path.isFinite()) { | 1779 if (!path.isFinite()) { |
| 1739 return; | 1780 return; |
| 1740 } | 1781 } |
| 1741 | 1782 |
| 1742 SkRect storage; | 1783 SkRect storage; |
| 1743 const SkRect* bounds = NULL; | 1784 const SkRect* bounds = NULL; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 return *paint; | 2284 return *paint; |
| 2244 } | 2285 } |
| 2245 | 2286 |
| 2246 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } | 2287 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } |
| 2247 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } | 2288 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } |
| 2248 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } | 2289 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } |
| 2249 | 2290 |
| 2250 /////////////////////////////////////////////////////////////////////////////// | 2291 /////////////////////////////////////////////////////////////////////////////// |
| 2251 | 2292 |
| 2252 SkCanvas::ClipVisitor::~ClipVisitor() { } | 2293 SkCanvas::ClipVisitor::~ClipVisitor() { } |
| OLD | NEW |