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 | 8 |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 } | 1659 } |
1660 } | 1660 } |
1661 } | 1661 } |
1662 } | 1662 } |
1663 #endif | 1663 #endif |
1664 | 1664 |
1665 void SkCanvas::replayClips(ClipVisitor* visitor) const { | 1665 void SkCanvas::replayClips(ClipVisitor* visitor) const { |
1666 SkClipStack::B2TIter iter(fClipStack); | 1666 SkClipStack::B2TIter iter(fClipStack); |
1667 const SkClipStack::Element* element; | 1667 const SkClipStack::Element* element; |
1668 | 1668 |
1669 static const SkRect kEmpty = { 0, 0, 0, 0 }; | |
1670 while ((element = iter.next()) != NULL) { | 1669 while ((element = iter.next()) != NULL) { |
1671 switch (element->getType()) { | 1670 element->replay(visitor); |
1672 case SkClipStack::Element::kPath_Type: | |
1673 visitor->clipPath(element->getPath(), element->getOp(), element-
>isAA()); | |
1674 break; | |
1675 case SkClipStack::Element::kRRect_Type: | |
1676 visitor->clipRRect(element->getRRect(), element->getOp(), elemen
t->isAA()); | |
1677 break; | |
1678 case SkClipStack::Element::kRect_Type: | |
1679 visitor->clipRect(element->getRect(), element->getOp(), element-
>isAA()); | |
1680 break; | |
1681 case SkClipStack::Element::kEmpty_Type: | |
1682 visitor->clipRect(kEmpty, SkRegion::kIntersect_Op, false); | |
1683 break; | |
1684 } | |
1685 } | 1671 } |
1686 } | 1672 } |
1687 | 1673 |
1688 /////////////////////////////////////////////////////////////////////////////// | 1674 /////////////////////////////////////////////////////////////////////////////// |
1689 | 1675 |
1690 bool SkCanvas::isClipEmpty() const { | 1676 bool SkCanvas::isClipEmpty() const { |
1691 return fMCRec->fRasterClip->isEmpty(); | 1677 return fMCRec->fRasterClip->isEmpty(); |
1692 } | 1678 } |
1693 | 1679 |
1694 bool SkCanvas::isClipRect() const { | 1680 bool SkCanvas::isClipRect() const { |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 } | 2535 } |
2550 return *paint; | 2536 return *paint; |
2551 } | 2537 } |
2552 | 2538 |
2553 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } | 2539 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } |
2554 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } | 2540 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } |
2555 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } | 2541 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } |
2556 | 2542 |
2557 /////////////////////////////////////////////////////////////////////////////// | 2543 /////////////////////////////////////////////////////////////////////////////// |
2558 | 2544 |
2559 SkCanvas::ClipVisitor::~ClipVisitor() { } | 2545 SkCanvasClipVisitor::~SkCanvasClipVisitor() { } |
2560 | 2546 |
2561 /////////////////////////////////////////////////////////////////////////////// | 2547 /////////////////////////////////////////////////////////////////////////////// |
2562 | 2548 |
2563 static bool supported_for_raster_canvas(const SkImageInfo& info) { | 2549 static bool supported_for_raster_canvas(const SkImageInfo& info) { |
2564 switch (info.alphaType()) { | 2550 switch (info.alphaType()) { |
2565 case kPremul_SkAlphaType: | 2551 case kPremul_SkAlphaType: |
2566 case kOpaque_SkAlphaType: | 2552 case kOpaque_SkAlphaType: |
2567 break; | 2553 break; |
2568 default: | 2554 default: |
2569 return false; | 2555 return false; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 if (!supported_for_raster_canvas(info)) { | 2588 if (!supported_for_raster_canvas(info)) { |
2603 return NULL; | 2589 return NULL; |
2604 } | 2590 } |
2605 | 2591 |
2606 SkBitmap bitmap; | 2592 SkBitmap bitmap; |
2607 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2593 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2608 return NULL; | 2594 return NULL; |
2609 } | 2595 } |
2610 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2596 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2611 } | 2597 } |
OLD | NEW |