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

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

Issue 269693003: SkClipStack::Element tweaks. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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
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 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 } 1715 }
1716 } 1716 }
1717 } 1717 }
1718 } 1718 }
1719 #endif 1719 #endif
1720 1720
1721 void SkCanvas::replayClips(ClipVisitor* visitor) const { 1721 void SkCanvas::replayClips(ClipVisitor* visitor) const {
1722 SkClipStack::B2TIter iter(fClipStack); 1722 SkClipStack::B2TIter iter(fClipStack);
1723 const SkClipStack::Element* element; 1723 const SkClipStack::Element* element;
1724 1724
1725 static const SkRect kEmpty = { 0, 0, 0, 0 };
1726 while ((element = iter.next()) != NULL) { 1725 while ((element = iter.next()) != NULL) {
1727 switch (element->getType()) { 1726 element->replay(visitor);
1728 case SkClipStack::Element::kPath_Type:
1729 visitor->clipPath(element->getPath(), element->getOp(), element- >isAA());
1730 break;
1731 case SkClipStack::Element::kRRect_Type:
1732 visitor->clipRRect(element->getRRect(), element->getOp(), elemen t->isAA());
1733 break;
1734 case SkClipStack::Element::kRect_Type:
1735 visitor->clipRect(element->getRect(), element->getOp(), element- >isAA());
1736 break;
1737 case SkClipStack::Element::kEmpty_Type:
1738 visitor->clipRect(kEmpty, SkRegion::kIntersect_Op, false);
1739 break;
1740 }
1741 } 1727 }
1742 } 1728 }
1743 1729
1744 /////////////////////////////////////////////////////////////////////////////// 1730 ///////////////////////////////////////////////////////////////////////////////
1745 1731
1746 bool SkCanvas::isClipEmpty() const { 1732 bool SkCanvas::isClipEmpty() const {
1747 return fMCRec->fRasterClip->isEmpty(); 1733 return fMCRec->fRasterClip->isEmpty();
1748 } 1734 }
1749 1735
1750 bool SkCanvas::isClipRect() const { 1736 bool SkCanvas::isClipRect() const {
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 } 2583 }
2598 return *paint; 2584 return *paint;
2599 } 2585 }
2600 2586
2601 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } 2587 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); }
2602 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } 2588 int SkCanvas::LayerIter::x() const { return fImpl->getX(); }
2603 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } 2589 int SkCanvas::LayerIter::y() const { return fImpl->getY(); }
2604 2590
2605 /////////////////////////////////////////////////////////////////////////////// 2591 ///////////////////////////////////////////////////////////////////////////////
2606 2592
2607 SkCanvas::ClipVisitor::~ClipVisitor() { } 2593 SkCanvasClipVisitor::~SkCanvasClipVisitor() { }
2608 2594
2609 /////////////////////////////////////////////////////////////////////////////// 2595 ///////////////////////////////////////////////////////////////////////////////
2610 2596
2611 static bool supported_for_raster_canvas(const SkImageInfo& info) { 2597 static bool supported_for_raster_canvas(const SkImageInfo& info) {
2612 switch (info.alphaType()) { 2598 switch (info.alphaType()) {
2613 case kPremul_SkAlphaType: 2599 case kPremul_SkAlphaType:
2614 case kOpaque_SkAlphaType: 2600 case kOpaque_SkAlphaType:
2615 break; 2601 break;
2616 default: 2602 default:
2617 return false; 2603 return false;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 if (!supported_for_raster_canvas(info)) { 2636 if (!supported_for_raster_canvas(info)) {
2651 return NULL; 2637 return NULL;
2652 } 2638 }
2653 2639
2654 SkBitmap bitmap; 2640 SkBitmap bitmap;
2655 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2641 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2656 return NULL; 2642 return NULL;
2657 } 2643 }
2658 return SkNEW_ARGS(SkCanvas, (bitmap)); 2644 return SkNEW_ARGS(SkCanvas, (bitmap));
2659 } 2645 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698