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 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 void SkCanvas::internal_private_getTotalClipAsPath(SkPath* path) const { | 1786 void SkCanvas::internal_private_getTotalClipAsPath(SkPath* path) const { |
1787 path->reset(); | 1787 path->reset(); |
1788 | 1788 |
1789 const SkRegion& rgn = fMCRec->fRasterClip->forceGetBW(); | 1789 const SkRegion& rgn = fMCRec->fRasterClip->forceGetBW(); |
1790 if (rgn.isEmpty()) { | 1790 if (rgn.isEmpty()) { |
1791 return; | 1791 return; |
1792 } | 1792 } |
1793 (void)rgn.getBoundaryPath(path); | 1793 (void)rgn.getBoundaryPath(path); |
1794 } | 1794 } |
1795 | 1795 |
| 1796 void SkCanvas::getCurrentClipPath(SkPath* path) const { |
| 1797 |
| 1798 if (!path) |
| 1799 return; |
| 1800 |
| 1801 const SkClipStack* clipStack = getClipStack(); |
| 1802 SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart); |
| 1803 const SkClipStack::Element* element; |
| 1804 |
| 1805 SkPath totalClipPath; |
| 1806 totalClipPath.setFillType(SkPath::kInverseEvenOdd_FillType); |
| 1807 |
| 1808 while ((element = iter.next())) { |
| 1809 |
| 1810 SkClipStack::Element::Type type = element->getType(); |
| 1811 SkPath clipPath; |
| 1812 if (type != SkClipStack::Element::kEmpty_Type) |
| 1813 element->asPath(&clipPath); |
| 1814 |
| 1815 SkRegion::Op elementOp = element->getOp(); |
| 1816 if (elementOp == SkRegion::kReplace_Op) |
| 1817 totalClipPath = clipPath; |
| 1818 else |
| 1819 Op(totalClipPath, clipPath, (SkPathOp)elementOp, &totalClipPath); |
| 1820 } |
| 1821 |
| 1822 *path = totalClipPath; |
| 1823 } |
| 1824 |
1796 GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() { | 1825 GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() { |
1797 SkBaseDevice* dev = this->getTopDevice(); | 1826 SkBaseDevice* dev = this->getTopDevice(); |
1798 return dev ? dev->accessRenderTarget() : NULL; | 1827 return dev ? dev->accessRenderTarget() : NULL; |
1799 } | 1828 } |
1800 | 1829 |
1801 SkBaseDevice* SkCanvas::createLayerDevice(const SkImageInfo& info) { | 1830 SkBaseDevice* SkCanvas::createLayerDevice(const SkImageInfo& info) { |
1802 SkBaseDevice* device = this->getTopDevice(); | 1831 SkBaseDevice* device = this->getTopDevice(); |
1803 return device ? device->createCompatibleDeviceForSaveLayer(info) : NULL; | 1832 return device ? device->createCompatibleDeviceForSaveLayer(info) : NULL; |
1804 } | 1833 } |
1805 | 1834 |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 if (!supported_for_raster_canvas(info)) { | 2617 if (!supported_for_raster_canvas(info)) { |
2589 return NULL; | 2618 return NULL; |
2590 } | 2619 } |
2591 | 2620 |
2592 SkBitmap bitmap; | 2621 SkBitmap bitmap; |
2593 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2622 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2594 return NULL; | 2623 return NULL; |
2595 } | 2624 } |
2596 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2625 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2597 } | 2626 } |
OLD | NEW |