Revert of option to quick-accept clipRect calls (patchset #3 id:40001 of https://codereview.chromium.org/1458913005/ )

Reason for revert:
Breaking tests on Android:

D/skia    ( 4469):
D/skia    ( 4469): Failures:
D/skia    ( 4469): 	../../../tests/CanvasStateTest.cpp:325	clipStackBounds.width() == WIDTH
D/skia    ( 4469): 	../../../tests/CanvasStateTest.cpp:326	clipStackBounds.height() == HEIGHT
D/skia    ( 4469): 2 failures

http://build.chromium.org/p/client.skia.android/builders/Test-Android-GCC-NexusPlayer-CPU-SSE4-x86-Debug/builds/1387/steps/dm/logs/stdio

Original issue's description:
> option to quick-accept clipRect calls
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/90ba095c459e38581353073826785074b5953b8c

TBR=robertphillips@google.com,fmalita@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1471513002
This commit is contained in:
bsalomon 2015-11-20 18:53:07 -08:00 committed by Commit bot
parent f234272cbd
commit ac8cabd729

View File

@ -1508,44 +1508,24 @@ void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg
}
#endif
if (!fAllowSoftClip) {
edgeStyle = kHard_ClipEdgeStyle;
}
const bool rectStaysRect = fMCRec->fMatrix.rectStaysRect();
SkRect devR;
if (rectStaysRect) {
fMCRec->fMatrix.mapRect(&devR, rect);
}
// Check if we can quick-accept the clip call (and do nothing)
//
// TODO: investigate if a (conservative) version of this could be done in ::clipRect,
// so that subclasses (like PictureRecording) didn't see unnecessary clips, which in turn
// might allow lazy save/restores to eliminate entire save/restore blocks.
//
if (SkRegion::kIntersect_Op == op &&
kHard_ClipEdgeStyle == edgeStyle
&& rectStaysRect)
{
if (devR.round().contains(fMCRec->fRasterClip.getBounds())) {
#if 0
SkDebugf("------- ignored clipRect [%g %g %g %g]\n",
rect.left(), rect.top(), rect.right(), rect.bottom());
#endif
return;
}
}
AutoValidateClip avc(this);
fDeviceCMDirty = true;
fCachedLocalClipBoundsDirty = true;
if (!fAllowSoftClip) {
edgeStyle = kHard_ClipEdgeStyle;
}
if (rectStaysRect) {
const bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
fClipStack->clipDevRect(devR, op, isAA);
fMCRec->fRasterClip.op(devR, this->getBaseLayerSize(), op, isAA);
if (fMCRec->fMatrix.rectStaysRect()) {
// for these simpler matrices, we can stay a rect even after applying
// the matrix. This means we don't have to a) make a path, and b) tell
// the region code to scan-convert the path, only to discover that it
// is really just a rect.
SkRect r;
fMCRec->fMatrix.mapRect(&r, rect);
fClipStack->clipDevRect(r, op, kSoft_ClipEdgeStyle == edgeStyle);
fMCRec->fRasterClip.op(r, this->getBaseLayerSize(), op, kSoft_ClipEdgeStyle == edgeStyle);
} else {
// since we're rotated or some such thing, we convert the rect to a path
// and clip against that, since it can handle any matrix. However, to