Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: include/core/SkCanvas.h

Issue 113193004: remove SkScalarCompare type and header (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/public_headers.gypi ('k') | include/core/SkScalarCompare.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 6c41680e3ed63ae01839e6a79cf37c5de9da5a3d..5a5cc65f0b3e69621582b0f72b45bc4c8c5dda8a 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -18,7 +18,6 @@
#include "SkRefCnt.h"
#include "SkPath.h"
#include "SkRegion.h"
-#include "SkScalarCompare.h"
#include "SkXfermode.h"
class SkBounder;
@@ -455,14 +454,13 @@ public:
not intersect the current clip)
*/
bool quickRejectY(SkScalar top, SkScalar bottom) const {
- SkASSERT(SkScalarToCompareType(top) <= SkScalarToCompareType(bottom));
- const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType();
+ SkASSERT(top <= bottom);
+ const SkRect& clipR = this->getLocalClipBounds();
// 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
// check as it is rare and would result double the comparisons.
- return SkScalarToCompareType(top) >= clipR.fBottom
- || SkScalarToCompareType(bottom) <= clipR.fTop;
+ return top >= clipR.fBottom || bottom <= clipR.fTop;
}
/** Return the bounds of the current clip (in local coordinates) in the
@@ -1100,20 +1098,20 @@ private:
/* These maintain a cache of the clip bounds in local coordinates,
(converted to 2s-compliment if floats are slow).
*/
- mutable SkRectCompareType fLocalBoundsCompareType;
- mutable bool fLocalBoundsCompareTypeDirty;
+ mutable SkRect fCachedLocalClipBounds;
+ mutable bool fCachedLocalClipBoundsDirty;
bool fAllowSoftClip;
bool fAllowSimplifyClip;
- const SkRectCompareType& getLocalClipBoundsCompareType() const {
- if (fLocalBoundsCompareTypeDirty) {
- this->computeLocalClipBoundsCompareType();
- fLocalBoundsCompareTypeDirty = false;
+ const SkRect& getLocalClipBounds() const {
+ if (fCachedLocalClipBoundsDirty) {
+ if (!this->getClipBounds(&fCachedLocalClipBounds)) {
+ fCachedLocalClipBounds.setEmpty();
+ }
+ fCachedLocalClipBoundsDirty = false;
}
- return fLocalBoundsCompareType;
+ return fCachedLocalClipBounds;
}
- void computeLocalClipBoundsCompareType() const;
-
class AutoValidateClip : ::SkNoncopyable {
public:
« no previous file with comments | « gyp/public_headers.gypi ('k') | include/core/SkScalarCompare.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698