Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: src/core/SkCanvas.cpp

Issue 174243003: add SkCanvas::drawDRRect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // We don't have this method (yet), but technically this is what we should
1602 // be able to assert...
1603 // SkASSERT(outer.contains(inner));
1604 //
1605 // For now at least check for containment of bounds
1606 SkASSERT(outer.getBounds().contains(inner.getBounds()));
1607
1608 if (outer.isEmpty()) {
1609 return;
1610 }
1611 if (inner.isEmpty()) {
1612 this->drawRRect(outer, paint);
1613 return;
1614 }
1615 this->onDrawDRRect(outer, inner, paint);
1616 }
1617
1599 ////////////////////////////////////////////////////////////////////////////// 1618 //////////////////////////////////////////////////////////////////////////////
1600 // These are the virtual drawing methods 1619 // These are the virtual drawing methods
1601 ////////////////////////////////////////////////////////////////////////////// 1620 //////////////////////////////////////////////////////////////////////////////
1602 1621
1603 void SkCanvas::clear(SkColor color) { 1622 void SkCanvas::clear(SkColor color) {
1604 SkDrawIter iter(this); 1623 SkDrawIter iter(this);
1605 this->predrawNotify(); 1624 this->predrawNotify();
1606 while (iter.next()) { 1625 while (iter.next()) {
1607 iter.fDevice->clear(color); 1626 iter.fDevice->clear(color);
1608 } 1627 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 1743
1725 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) 1744 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds)
1726 1745
1727 while (iter.next()) { 1746 while (iter.next()) {
1728 iter.fDevice->drawRRect(iter, rrect, looper.paint()); 1747 iter.fDevice->drawRRect(iter, rrect, looper.paint());
1729 } 1748 }
1730 1749
1731 LOOPER_END 1750 LOOPER_END
1732 } 1751 }
1733 1752
1753 void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
1754 const SkPaint& paint) {
1755 CHECK_SHADER_NOSETCONTEXT(paint);
1756
1757 SkRect storage;
1758 const SkRect* bounds = NULL;
1759 if (paint.canComputeFastBounds()) {
1760 bounds = &paint.computeFastBounds(outer.getBounds(), &storage);
1761 if (this->quickReject(*bounds)) {
1762 return;
1763 }
1764 }
1765
robertphillips 2014/02/20 19:47:46 kDRRect_Type?
1766 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds)
1767
1768 while (iter.next()) {
1769 iter.fDevice->drawDRRect(iter, outer, inner, looper.paint());
1770 }
1771
1772 LOOPER_END
1773 }
1734 1774
1735 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { 1775 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
1736 CHECK_SHADER_NOSETCONTEXT(paint); 1776 CHECK_SHADER_NOSETCONTEXT(paint);
1737 1777
1738 if (!path.isFinite()) { 1778 if (!path.isFinite()) {
1739 return; 1779 return;
1740 } 1780 }
1741 1781
1742 SkRect storage; 1782 SkRect storage;
1743 const SkRect* bounds = NULL; 1783 const SkRect* bounds = NULL;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 return *paint; 2283 return *paint;
2244 } 2284 }
2245 2285
2246 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } 2286 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); }
2247 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } 2287 int SkCanvas::LayerIter::x() const { return fImpl->getX(); }
2248 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } 2288 int SkCanvas::LayerIter::y() const { return fImpl->getY(); }
2249 2289
2250 /////////////////////////////////////////////////////////////////////////////// 2290 ///////////////////////////////////////////////////////////////////////////////
2251 2291
2252 SkCanvas::ClipVisitor::~ClipVisitor() { } 2292 SkCanvas::ClipVisitor::~ClipVisitor() { }
OLDNEW
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698