Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index 47d3cca81edc8ee2c5acf3f469187e3fec51fdb1..feeba758fa3592bb1200116af3ef65d760af249a 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -19,7 +19,6 @@ |
#include "SkPicture.h" |
#include "SkRasterClip.h" |
#include "SkRRect.h" |
-#include "SkScalarCompare.h" |
#include "SkSurface_Base.h" |
#include "SkTemplates.h" |
#include "SkTextFormatParams.h" |
@@ -485,8 +484,8 @@ private: |
SkBaseDevice* SkCanvas::init(SkBaseDevice* device) { |
fBounder = NULL; |
- fLocalBoundsCompareType.setEmpty(); |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBounds.setEmpty(); |
+ fCachedLocalClipBoundsDirty = true; |
fAllowSoftClip = true; |
fAllowSimplifyClip = false; |
fDeviceCMDirty = false; |
@@ -897,7 +896,7 @@ void SkCanvas::internalRestore() { |
SkASSERT(fMCStack.count() != 0); |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
if (SkCanvas::kClip_SaveFlag & fMCRec->fFlags) { |
fClipStack.restore(); |
@@ -1056,37 +1055,37 @@ void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, |
bool SkCanvas::translate(SkScalar dx, SkScalar dy) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
return fMCRec->fMatrix->preTranslate(dx, dy); |
} |
bool SkCanvas::scale(SkScalar sx, SkScalar sy) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
return fMCRec->fMatrix->preScale(sx, sy); |
} |
bool SkCanvas::rotate(SkScalar degrees) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
return fMCRec->fMatrix->preRotate(degrees); |
} |
bool SkCanvas::skew(SkScalar sx, SkScalar sy) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
return fMCRec->fMatrix->preSkew(sx, sy); |
} |
bool SkCanvas::concat(const SkMatrix& matrix) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
return fMCRec->fMatrix->preConcat(matrix); |
} |
void SkCanvas::setMatrix(const SkMatrix& matrix) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
*fMCRec->fMatrix = matrix; |
} |
@@ -1110,7 +1109,7 @@ bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { |
if (this->quickReject(rect)) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
fClipStack.clipEmpty(); |
return fMCRec->fRasterClip->setEmpty(); |
@@ -1121,7 +1120,7 @@ bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { |
AutoValidateClip avc(this); |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
doAA &= fAllowSoftClip; |
if (fMCRec->fMatrix->rectStaysRect()) { |
@@ -1206,7 +1205,7 @@ bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |
if (this->quickReject(path.getBounds())) { |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
fClipStack.clipEmpty(); |
return fMCRec->fRasterClip->setEmpty(); |
@@ -1217,7 +1216,7 @@ bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |
AutoValidateClip avc(this); |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
doAA &= fAllowSoftClip; |
SkPath devPath; |
@@ -1350,7 +1349,7 @@ bool SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) { |
AutoValidateClip avc(this); |
fDeviceCMDirty = true; |
- fLocalBoundsCompareTypeDirty = true; |
+ fCachedLocalClipBoundsDirty = true; |
// todo: signal fClipStack that we have a region, and therefore (I guess) |
// we have to ignore it, and use the region directly? |
@@ -1423,19 +1422,6 @@ void SkCanvas::replayClips(ClipVisitor* visitor) const { |
/////////////////////////////////////////////////////////////////////////////// |
-void SkCanvas::computeLocalClipBoundsCompareType() const { |
- SkRect r; |
- |
- if (!this->getClipBounds(&r)) { |
- fLocalBoundsCompareType.setEmpty(); |
- } else { |
- fLocalBoundsCompareType.set(SkScalarToCompareType(r.fLeft), |
- SkScalarToCompareType(r.fTop), |
- SkScalarToCompareType(r.fRight), |
- SkScalarToCompareType(r.fBottom)); |
- } |
-} |
- |
bool SkCanvas::quickReject(const SkRect& rect) const { |
if (!rect.isFinite()) |
@@ -1452,17 +1438,14 @@ bool SkCanvas::quickReject(const SkRect& rect) const { |
dst.roundOut(&idst); |
return !SkIRect::Intersects(idst, fMCRec->fRasterClip->getBounds()); |
} else { |
- const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType(); |
+ const SkRect& clipR = this->getLocalClipBounds(); |
// for speed, do the most likely reject compares first |
- SkScalarCompareType userT = SkScalarToCompareType(rect.fTop); |
- SkScalarCompareType userB = SkScalarToCompareType(rect.fBottom); |
- if (userT >= clipR.fBottom || userB <= clipR.fTop) { |
+ // TODO: should we use | instead, or compare all 4 at once? |
+ if (rect.fTop >= clipR.fBottom || rect.fBottom <= clipR.fTop) { |
return true; |
} |
- SkScalarCompareType userL = SkScalarToCompareType(rect.fLeft); |
- SkScalarCompareType userR = SkScalarToCompareType(rect.fRight); |
- if (userL >= clipR.fRight || userR <= clipR.fLeft) { |
+ if (rect.fLeft >= clipR.fRight || rect.fRight <= clipR.fLeft) { |
return true; |
} |
return false; |