diff options
author | bsalomon <bsalomon@google.com> | 2016-08-26 10:48:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-26 10:48:19 -0700 |
commit | cb31e51d9355adb1d25ce3e121cde21b05ecf63e (patch) | |
tree | 7a99387e384262d2c33f68301a42dc7911d4b3cc /include | |
parent | e3031b607c7816980d13a3805382afb403fdfa04 (diff) |
Converts a drawPaint through a rrect clip to a drawRRect in GrDrawContext.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2271053004
Review-Url: https://codereview.chromium.org/2271053004
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkClipStack.h | 15 | ||||
-rw-r--r-- | include/gpu/GrClip.h | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index fb0b278405..f34283dc27 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -365,6 +365,21 @@ public: bool isWideOpen() const { return this->getTopmostGenID() == kWideOpenGenID; } /** + * This method quickly and conservatively determines whether the entire stack is equivalent to + * intersection with a rrect given a bounds, where the rrect must not contain the entire bounds. + * + * @param bounds A bounds on what will be drawn through the clip. The clip only need be + * equivalent to a intersection with a rrect for draws within the bounds. The + * returned rrect must intersect the bounds but need not be contained by the + * bounds. + * @param rrect If return is true rrect will contain the rrect equivalent to the stack. + * @param aa If return is true aa will indicate whether the equivalent rrect clip is + * antialiased. + * @return true if the stack is equivalent to a single rrect intersect clip, false otherwise. + */ + bool isRRect(const SkRect& bounds, SkRRect* rrect, bool* aa) const; + + /** * The generation ID has three reserved values to indicate special * (potentially ignorable) cases */ diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h index 168827b9f8..a7505f99b2 100644 --- a/include/gpu/GrClip.h +++ b/include/gpu/GrClip.h @@ -33,6 +33,21 @@ public: virtual ~GrClip() {} /** + * This method quickly and conservatively determines whether the entire clip is equivalent to + * intersection with a rrect. This will only return true if the rrect does not fully contain + * the render target bounds. Moreover, the returned rrect need not be contained by the render + * target bounds. We assume all draws will be implicitly clipped by the render target bounds. + * + * @param rtBounds The bounds of the render target that the clip will be applied to. + * @param rrect If return is true rrect will contain the rrect equivalent to the clip within + * rtBounds. + * @param aa If return is true aa will indicate whether the rrect clip is antialiased. + * @return true if the clip is equivalent to a single rrect, false otherwise. + * + */ + virtual bool isRRect(const SkRect& rtBounds, SkRRect* rrect, bool* aa) const = 0; + + /** * This is the maximum distance that a draw may extend beyond a clip's boundary and still count * count as "on the other side". We leave some slack because floating point rounding error is * likely to blame. The rationale for 1e-3 is that in the coverage case (and barring unexpected @@ -122,6 +137,7 @@ private: bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const final { return true; } + bool isRRect(const SkRect&, SkRRect*, bool*) const override { return false; }; }; #endif |