diff options
author | Mike Reed <reed@google.com> | 2017-03-04 21:47:47 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-04 21:48:01 +0000 |
commit | 27d07f0acb85eea4062075dfbe9148ce12d92c66 (patch) | |
tree | 7328000f52b82a4c1478ddc79b8d383f2b832bed /src/core/SkClipStackDevice.cpp | |
parent | 5b4599f137ce0966a88d2ba2bdbb6aa72b1ae082 (diff) |
Revert "Revert "Revert "Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping."""""
This reverts commit 025e2444c1f5a0c3cdc0bf60d1fa59941a0b5db4.
Reason for revert: layouttest failures -- need to rebase these (tiny diffs in gradients)
https://storage.googleapis.com/chromium-layout-test-archives/linux_trusty_blink_rel/6018/layout-test-results/results.html
Original change's description:
> Revert "Revert "Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping.""""
>
> This reverts commit baf06bc89a0ee2ac4033281e7310f6c727faab79.
>
> Reason for revert: reland to diagnose possible g3 failure
>
> Original change's description:
> > Revert "Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping."""
> >
> > This reverts commit cfaa63237b152ae216f1351207bce3ea9808814c.
> >
> > Reason for revert: speculative revert to fix Google3
> >
> > Original change's description:
> > > Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping.""
> > >
> > > passes new (augmented) CanvasClipType unittest
> > > fixed rasterclipstack::setnewsize
> > >
> > > This reverts commit ea5e676a7b75600edcde3912886486004ccd7626.
> > >
> > > BUG=skia:
> > >
> > > Change-Id: I004653e0f4d01454662f8516fccab0046486f273
> > > Reviewed-on: https://skia-review.googlesource.com/9185
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> > >
> >
> > TBR=bsalomon@google.com,reed@google.com,reviews@skia.org
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=skia:
> >
> > Change-Id: Ibd7ee6383999f008eb6ee59c1c3f1c06a86044ea
> > Reviewed-on: https://skia-review.googlesource.com/9230
> > Reviewed-by: Cary Clark <caryclark@google.com>
> > Commit-Queue: Cary Clark <caryclark@google.com>
> >
>
> TBR=bsalomon@google.com,reviews@skia.org,caryclark@google.com,reed@google.com,mtklein@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Change-Id: I093fa8788056be39af01191bbf3a9e5de9f73954
> Reviewed-on: https://skia-review.googlesource.com/9244
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
>
TBR=mtklein@chromium.org,bsalomon@google.com,reviews@skia.org,caryclark@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Change-Id: I58f810a8ff241dbaf3133e2fe844548fcd0fa67a
Reviewed-on: https://skia-review.googlesource.com/9245
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkClipStackDevice.cpp')
-rw-r--r-- | src/core/SkClipStackDevice.cpp | 62 |
1 files changed, 9 insertions, 53 deletions
diff --git a/src/core/SkClipStackDevice.cpp b/src/core/SkClipStackDevice.cpp index dd5118d319..799850b839 100644 --- a/src/core/SkClipStackDevice.cpp +++ b/src/core/SkClipStackDevice.cpp @@ -9,16 +9,6 @@ #include "SkDraw.h" #include "SkRasterClip.h" -SkIRect SkClipStackDevice::devClipBounds() const { - SkIRect r = fClipStack.bounds(this->imageInfo().bounds()).roundOut(); - if (!r.isEmpty()) { - SkASSERT(this->imageInfo().bounds().contains(r)); - } - return r; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// - void SkClipStackDevice::onSave() { fClipStack.save(); } @@ -62,47 +52,13 @@ void SkClipStackDevice::onSetDeviceClipRestriction(SkIRect* clipRestriction) { } } -bool SkClipStackDevice::onClipIsAA() const { - SkClipStack::B2TIter iter(fClipStack); - const SkClipStack::Element* element; - - while ((element = iter.next()) != nullptr) { - if (element->isAA()) { - return true; - } - } - return false; -} - -void SkClipStackDevice::onAsRgnClip(SkRegion* rgn) const { - SkClipStack::BoundsType boundType; - bool isIntersectionOfRects; - SkRect bounds; - fClipStack.getBounds(&bounds, &boundType, &isIntersectionOfRects); - if (isIntersectionOfRects && SkClipStack::kNormal_BoundsType == boundType) { - rgn->setRect(bounds.round()); - } else { - SkPath path; - fClipStack.asPath(&path); - rgn->setPath(path, SkRegion(SkIRect::MakeWH(this->width(), this->height()))); - } -} - -SkBaseDevice::ClipType SkClipStackDevice::onGetClipType() const { - if (fClipStack.isWideOpen()) { - return kRect_ClipType; - } - if (fClipStack.isEmpty(SkIRect::MakeWH(this->width(), this->height()))) { - return kEmpty_ClipType; - } else { - SkClipStack::BoundsType boundType; - bool isIntersectionOfRects; - SkRect bounds; - fClipStack.getBounds(&bounds, &boundType, &isIntersectionOfRects); - if (isIntersectionOfRects && SkClipStack::kNormal_BoundsType == boundType) { - return kRect_ClipType; - } else { - return kComplex_ClipType; - } - } +SkIRect SkClipStackDevice::devClipBounds(const SkDraw& draw) const { +#ifdef SK_USE_DEVICE_CLIPPING + SkIRect r = fClipStack.bounds(this->imageInfo().bounds()).roundOut(); + SkASSERT(this->imageInfo().bounds().contains(r)); + SkASSERT(draw.fRC->getBounds().contains(r)); + return r; +#else + return draw.fRC->getBounds(); +#endif } |