OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 #ifndef SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 * paint (or default if null) would overwrite the entire root device of the
canvas | 1598 * paint (or default if null) would overwrite the entire root device of the
canvas |
1599 * (i.e. the canvas' surface if it had one). | 1599 * (i.e. the canvas' surface if it had one). |
1600 */ | 1600 */ |
1601 bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*, ShaderOverri
deOpacity) const; | 1601 bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*, ShaderOverri
deOpacity) const; |
1602 | 1602 |
1603 /** | 1603 /** |
1604 * Returns true if the paint's imagefilter can be invoked directly, without
needed a layer. | 1604 * Returns true if the paint's imagefilter can be invoked directly, without
needed a layer. |
1605 */ | 1605 */ |
1606 bool canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const SkPai
nt&); | 1606 bool canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const SkPai
nt&); |
1607 | 1607 |
1608 /* These maintain a cache of the clip bounds in local coordinates, | 1608 |
1609 (converted to 2s-compliment if floats are slow). | 1609 /** |
| 1610 * Keep track of the device clip bounds and if the matrix is scale-translat
e. This allows |
| 1611 * us to do a fast quick reject in the common case. |
1610 */ | 1612 */ |
1611 mutable SkRect fCachedLocalClipBounds; | 1613 bool fConservativeIsScaleTranslate; |
1612 mutable bool fCachedLocalClipBoundsDirty; | 1614 SkRect fDeviceClipBounds; |
| 1615 |
1613 bool fAllowSoftClip; | 1616 bool fAllowSoftClip; |
1614 bool fAllowSimplifyClip; | 1617 bool fAllowSimplifyClip; |
1615 const bool fConservativeRasterClip; | 1618 const bool fConservativeRasterClip; |
1616 | 1619 |
1617 const SkRect& getLocalClipBounds() const { | |
1618 if (fCachedLocalClipBoundsDirty) { | |
1619 if (!this->getClipBounds(&fCachedLocalClipBounds)) { | |
1620 fCachedLocalClipBounds.setEmpty(); | |
1621 } | |
1622 fCachedLocalClipBoundsDirty = false; | |
1623 } | |
1624 return fCachedLocalClipBounds; | |
1625 } | |
1626 | |
1627 class AutoValidateClip : ::SkNoncopyable { | 1620 class AutoValidateClip : ::SkNoncopyable { |
1628 public: | 1621 public: |
1629 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { | 1622 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { |
1630 fCanvas->validateClip(); | 1623 fCanvas->validateClip(); |
1631 } | 1624 } |
1632 ~AutoValidateClip() { fCanvas->validateClip(); } | 1625 ~AutoValidateClip() { fCanvas->validateClip(); } |
1633 | 1626 |
1634 private: | 1627 private: |
1635 const SkCanvas* fCanvas; | 1628 const SkCanvas* fCanvas; |
1636 }; | 1629 }; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 | 1676 |
1684 class SkCanvasClipVisitor { | 1677 class SkCanvasClipVisitor { |
1685 public: | 1678 public: |
1686 virtual ~SkCanvasClipVisitor(); | 1679 virtual ~SkCanvasClipVisitor(); |
1687 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1680 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1688 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1681 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1689 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1682 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1690 }; | 1683 }; |
1691 | 1684 |
1692 #endif | 1685 #endif |
OLD | NEW |