aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrClip.h
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-08-17 10:00:21 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-17 10:00:22 -0700
commit28341fad8438b294ed7311edbc68d8cb34a990ab (patch)
tree7f4573e0cbf2c58c8e44496bf3b1e5136f6f3702 /include/gpu/GrClip.h
parent8d3f92a92be713cedfee48e01987264bd4f3083f (diff)
Implement difference clip rects with window rectangles
Plumbs the pipeline for window rectangles and uses them for a very basic implementation of difference clip rects. This puts a common Blink pattern on fast path, but we will still eventually need to make more comprehensive use of window rectangles during clipping. GTX 960 perf result: gpu glinst4 glinst16 desk_jsfiddlebigcar.skp 0.254 -> 0.177 [70%] 0.279 -> 0.197 [71%] 0.577 -> 0.196 [34%] keymobi_sfgate_com_.skp 0.697 -> 0.513 [74%] 0.766 -> 0.451 [59%] 0.769 -> 0.597 [78%] keymobi_blogger.skp 0.406 -> 0.314 [77%] 0.436 -> 0.292 [67%] 0.696 -> 0.319 [46%] desk_pokemonwiki.skp 0.121 -> 0.098 [81%] 0.13 -> 0.105 [81%] 0.216 -> 0.097 [45%] desk_wikipedia.skp 0.121 -> 0.098 [81%] 0.13 -> 0.104 [80%] 0.199 -> 0.104 [52%] keymobi_androidpolice_co... 0.443 -> 0.382 [86%] 0.447 -> 0.398 [89%] 0.444 -> 0.396 [89%] keymobi_booking_com_sear... 1 .15 -> 1.03 [90%] 1.17 -> 1.06 [91%] 1.17 -> 1.05 [90%] keymobi_theverge_com.skp 0.417 -> 0.396 [95%] 0.426 -> 0.405 [95%] 0.429 -> 0.4 [93%] BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2251573002 Review-Url: https://codereview.chromium.org/2251573002
Diffstat (limited to 'include/gpu/GrClip.h')
-rw-r--r--include/gpu/GrClip.h47
1 files changed, 1 insertions, 46 deletions
diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h
index a6a0a665bd..6457d03051 100644
--- a/include/gpu/GrClip.h
+++ b/include/gpu/GrClip.h
@@ -11,55 +11,10 @@
#include "GrFragmentProcessor.h"
#include "GrTypesPriv.h"
+class GrAppliedClip;
class GrDrawContext;
/**
- * Produced by GrClip. It provides a set of modifications to the drawing state that are used to
- * create the final GrPipeline for a GrBatch.
- */
-class GrAppliedClip : public SkNoncopyable {
-public:
- GrAppliedClip(const SkRect& drawBounds)
- : fHasStencilClip(false)
- , fClippedDrawBounds(drawBounds) {
- }
-
- const GrScissorState& scissorState() const { return fScissorState; }
- GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fClipCoverageFP.get(); }
- bool hasStencilClip() const { return fHasStencilClip; }
-
- /**
- * Intersects the applied clip with the provided rect. Returns false if the draw became empty.
- */
- bool addScissor(const SkIRect& irect) {
- return fScissorState.intersect(irect) && fClippedDrawBounds.intersect(SkRect::Make(irect));
- }
-
- void addCoverageFP(sk_sp<GrFragmentProcessor> fp) {
- SkASSERT(!fClipCoverageFP);
- fClipCoverageFP = fp;
- }
-
- void addStencilClip() {
- SkASSERT(!fHasStencilClip);
- fHasStencilClip = true;
- }
-
- /**
- * Returns the device bounds of the draw after clip has been applied. TODO: Ideally this would
- * consider the combined effect of all clipping techniques in play (scissor, stencil, fp, etc.).
- */
- const SkRect& clippedDrawBounds() const { return fClippedDrawBounds; }
-
-private:
- GrScissorState fScissorState;
- sk_sp<GrFragmentProcessor> fClipCoverageFP;
- bool fHasStencilClip;
- SkRect fClippedDrawBounds;
- typedef SkNoncopyable INHERITED;
-};
-
-/**
* GrClip is an abstract base class for applying a clip. It constructs a clip mask if necessary, and
* fills out a GrAppliedClip instructing the caller on how to set up the draw state.
*/