aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-16 20:53:31 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-16 20:53:31 +0000
commit3b3e895df6f8ee0f33010367c215944cd16a8334 (patch)
tree49a2ae19700aa2d441bd688802369d33153b2070 /include
parentb6204b1ec4e4940db94bc40d4283ee77729170d6 (diff)
remove EdgeType enum. Unimportant distinction, and removing speeds up quickReject
Review URL: https://codereview.appspot.com/6448161 git-svn-id: http://skia.googlecode.com/svn/trunk@5140 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkCanvas.h56
1 files changed, 10 insertions, 46 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 2b1da3b009..01e0c75a24 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -386,33 +386,15 @@ public:
return this->clipRegion(deviceRgn, SkRegion::kReplace_Op);
}
- /** Enum describing how to treat edges when performing quick-reject tests
- of a geometry against the current clip. Treating them as antialiased
- (kAA_EdgeType) will take into account the extra pixels that may be drawn
- if the edge does not lie exactly on a device pixel boundary (after being
- transformed by the current matrix).
- */
- enum EdgeType {
- /** Treat the edges as B&W (not antialiased) for the purposes of testing
- against the current clip
- */
- kBW_EdgeType,
- /** Treat the edges as antialiased for the purposes of testing
- against the current clip
- */
- kAA_EdgeType
- };
-
/** Return true if the specified rectangle, after being transformed by the
current matrix, would lie completely outside of the current clip. Call
this to check if an area you intend to draw into is clipped out (and
therefore you can skip making the draw calls).
@param rect the rect to compare with the current clip
- @param et specifies how to treat the edges (see EdgeType)
@return true if the rect (transformed by the canvas' matrix) does not
intersect with the canvas' clip
*/
- bool quickReject(const SkRect& rect, EdgeType et) const;
+ bool quickReject(const SkRect& rect) const;
/** Return true if the specified path, after being transformed by the
current matrix, would lie completely outside of the current clip. Call
@@ -421,11 +403,10 @@ public:
return false even if the path itself might not intersect the clip
(i.e. the bounds of the path intersects, but the path does not).
@param path The path to compare with the current clip
- @param et specifies how to treat the edges (see EdgeType)
@return true if the path (transformed by the canvas' matrix) does not
intersect with the canvas' clip
*/
- bool quickReject(const SkPath& path, EdgeType et) const;
+ bool quickReject(const SkPath& path) const;
/** Return true if the horizontal band specified by top and bottom is
completely clipped out. This is a conservative calculation, meaning
@@ -437,9 +418,9 @@ public:
@return true if the horizontal band is completely clipped out (i.e. does
not intersect the current clip)
*/
- bool quickRejectY(SkScalar top, SkScalar bottom, EdgeType et) const {
+ bool quickRejectY(SkScalar top, SkScalar bottom) const {
SkASSERT(SkScalarToCompareType(top) <= SkScalarToCompareType(bottom));
- const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType(et);
+ const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType();
// In the case where the clip is empty and we are provided with a
// negative top and positive bottom parameter then this test will return
// false even though it will be clipped. We have chosen to exclude that
@@ -453,7 +434,7 @@ public:
in a way similar to quickReject, in that it tells you that drawing
outside of these bounds will be clipped out.
*/
- bool getClipBounds(SkRect* bounds, EdgeType et = kAA_EdgeType) const;
+ bool getClipBounds(SkRect* bounds) const;
/** Return the bounds of the current clip, in device coordinates; returns
true if non-empty. Maybe faster than getting the clip explicitly and
@@ -1024,31 +1005,14 @@ private:
mutable SkRectCompareType fLocalBoundsCompareType;
mutable bool fLocalBoundsCompareTypeDirty;
- mutable SkRectCompareType fLocalBoundsCompareTypeBW;
- mutable bool fLocalBoundsCompareTypeDirtyBW;
-
- /* Get the local clip bounds with an anti-aliased edge.
- */
const SkRectCompareType& getLocalClipBoundsCompareType() const {
- return getLocalClipBoundsCompareType(kAA_EdgeType);
- }
-
- const SkRectCompareType& getLocalClipBoundsCompareType(EdgeType et) const {
- if (et == kAA_EdgeType) {
- if (fLocalBoundsCompareTypeDirty) {
- this->computeLocalClipBoundsCompareType(et);
- fLocalBoundsCompareTypeDirty = false;
- }
- return fLocalBoundsCompareType;
- } else {
- if (fLocalBoundsCompareTypeDirtyBW) {
- this->computeLocalClipBoundsCompareType(et);
- fLocalBoundsCompareTypeDirtyBW = false;
- }
- return fLocalBoundsCompareTypeBW;
+ if (fLocalBoundsCompareTypeDirty) {
+ this->computeLocalClipBoundsCompareType();
+ fLocalBoundsCompareTypeDirty = false;
}
+ return fLocalBoundsCompareType;
}
- void computeLocalClipBoundsCompareType(EdgeType et) const;
+ void computeLocalClipBoundsCompareType() const;
SkMatrix fExternalMatrix, fExternalInverse;
bool fUseExternalMatrix;