| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 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 SkRasterClip_DEFINED | 8 #ifndef SkRasterClip_DEFINED |
| 9 #define SkRasterClip_DEFINED | 9 #define SkRasterClip_DEFINED |
| 10 | 10 |
| 11 #include "SkRegion.h" | 11 #include "SkRegion.h" |
| 12 #include "SkAAClip.h" | 12 #include "SkAAClip.h" |
| 13 | 13 |
| 14 class SkRRect; | 14 class SkRRect; |
| 15 | 15 |
| 16 /** |
| 17 * Wraps a SkRegion and SkAAClip, so we have a single object that can represent
either our |
| 18 * BW or antialiased clips. |
| 19 * |
| 20 * This class is optimized for the raster backend of canvas, but can be expense
to keep up2date, |
| 21 * so it supports a runtime option (force-conservative-rects) to turn it into a
super-fast |
| 22 * rect-only tracker. The gpu backend uses this since it does not need the resu
lt (it uses |
| 23 * SkClipStack instead). |
| 24 */ |
| 16 class SkRasterClip { | 25 class SkRasterClip { |
| 17 public: | 26 public: |
| 18 SkRasterClip(bool forceConservativeRects = false); | 27 SkRasterClip(bool forceConservativeRects = false); |
| 19 SkRasterClip(const SkIRect&, bool forceConservativeRects = false); | 28 SkRasterClip(const SkIRect&, bool forceConservativeRects = false); |
| 29 SkRasterClip(const SkRegion&); |
| 20 SkRasterClip(const SkRasterClip&); | 30 SkRasterClip(const SkRasterClip&); |
| 21 ~SkRasterClip(); | 31 ~SkRasterClip(); |
| 22 | 32 |
| 33 // Only compares the current state. Does not compare isForceConservativeRect
s(), so that field |
| 34 // could be different but this could still return true. |
| 35 bool operator==(const SkRasterClip&) const; |
| 36 bool operator!=(const SkRasterClip& other) const { |
| 37 return !(*this == other); |
| 38 } |
| 39 |
| 23 bool isForceConservativeRects() const { return fForceConservativeRects; } | 40 bool isForceConservativeRects() const { return fForceConservativeRects; } |
| 24 | 41 |
| 25 bool isBW() const { return fIsBW; } | 42 bool isBW() const { return fIsBW; } |
| 26 bool isAA() const { return !fIsBW; } | 43 bool isAA() const { return !fIsBW; } |
| 27 const SkRegion& bwRgn() const { SkASSERT(fIsBW); return fBW; } | 44 const SkRegion& bwRgn() const { SkASSERT(fIsBW); return fBW; } |
| 28 const SkAAClip& aaRgn() const { SkASSERT(!fIsBW); return fAA; } | 45 const SkAAClip& aaRgn() const { SkASSERT(!fIsBW); return fAA; } |
| 29 | 46 |
| 30 bool isEmpty() const { | 47 bool isEmpty() const { |
| 31 SkASSERT(this->computeIsEmpty() == fIsEmpty); | 48 SkASSERT(this->computeIsEmpty() == fIsEmpty); |
| 32 return fIsEmpty; | 49 return fIsEmpty; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 186 |
| 170 private: | 187 private: |
| 171 SkRegion fBWRgn; | 188 SkRegion fBWRgn; |
| 172 SkAAClipBlitter fAABlitter; | 189 SkAAClipBlitter fAABlitter; |
| 173 // what we return | 190 // what we return |
| 174 const SkRegion* fClipRgn; | 191 const SkRegion* fClipRgn; |
| 175 SkBlitter* fBlitter; | 192 SkBlitter* fBlitter; |
| 176 }; | 193 }; |
| 177 | 194 |
| 178 #endif | 195 #endif |
| OLD | NEW |