Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: src/gpu/GrAppliedClip.h

Issue 2312173002: Revert of Improve usage of window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_drawsinreducedclip
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/private/GrSurfaceProxy.h ('k') | src/gpu/GrClipStackClip.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrAppliedClip_DEFINED 8 #ifndef GrAppliedClip_DEFINED
9 #define GrAppliedClip_DEFINED 9 #define GrAppliedClip_DEFINED
10 10
11 #include "GrScissorState.h" 11 #include "GrTypesPriv.h"
12 #include "GrWindowRectsState.h" 12 #include "GrWindowRectangles.h"
13 13
14 class GrFragmentProcessor; 14 class GrFragmentProcessor;
15 15
16 /** 16 /**
17 * Produced by GrClip. It provides a set of modifications to the drawing state t hat are used to 17 * Produced by GrClip. It provides a set of modifications to the drawing state t hat are used to
18 * create the final GrPipeline for a GrBatch. 18 * create the final GrPipeline for a GrBatch.
19 */ 19 */
20 class GrAppliedClip : public SkNoncopyable { 20 class GrAppliedClip : public SkNoncopyable {
21 public: 21 public:
22 GrAppliedClip(const SkRect& drawBounds) 22 GrAppliedClip(const SkRect& drawBounds)
23 : fHasStencilClip(false) 23 : fHasStencilClip(false)
24 , fClippedDrawBounds(drawBounds) { 24 , fClippedDrawBounds(drawBounds) {
25 } 25 }
26 26
27 const GrScissorState& scissorState() const { return fScissorState; } 27 const GrScissorState& scissorState() const { return fScissorState; }
28 const GrWindowRectsState& windowRectsState() const { return fWindowRectsStat e; } 28 const GrWindowRectangles& windowRects() const { return fWindowRects; }
29 GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fClipCov erageFP.get(); } 29 GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fClipCov erageFP.get(); }
30 bool hasStencilClip() const { return fHasStencilClip; } 30 bool hasStencilClip() const { return fHasStencilClip; }
31 31
32 /** 32 /**
33 * Intersects the applied clip with the provided rect. Returns false if the draw became empty. 33 * Intersects the applied clip with the provided rect. Returns false if the draw became empty.
34 */ 34 */
35 bool addScissor(const SkIRect& irect) { 35 bool addScissor(const SkIRect& irect) {
36 return fScissorState.intersect(irect) && fClippedDrawBounds.intersect(Sk Rect::Make(irect)); 36 return fScissorState.intersect(irect) && fClippedDrawBounds.intersect(Sk Rect::Make(irect));
37 } 37 }
38 38
39 void addWindowRectangles(const GrWindowRectsState& windowState) { 39 /**
40 SkASSERT(!fWindowRectsState.enabled()); 40 * Adds an exclusive window rectangle to the clip. It is not currently suppo rted to switch the
41 fWindowRectsState = windowState; 41 * windows to inclusive mode.
42 } 42 */
43 43 void addWindowRectangle(const SkIRect& window) {
44 void addWindowRectangles(const GrWindowRectangles& windows, const SkIPoint& origin, 44 fWindowRects.addWindow(window);
45 GrWindowRectsState::Mode mode) {
46 SkASSERT(!fWindowRectsState.enabled());
47 fWindowRectsState.set(windows, origin, mode);
48 } 45 }
49 46
50 void addCoverageFP(sk_sp<GrFragmentProcessor> fp) { 47 void addCoverageFP(sk_sp<GrFragmentProcessor> fp) {
51 SkASSERT(!fClipCoverageFP); 48 SkASSERT(!fClipCoverageFP);
52 fClipCoverageFP = fp; 49 fClipCoverageFP = fp;
53 } 50 }
54 51
55 void addStencilClip() { 52 void addStencilClip() {
56 SkASSERT(!fHasStencilClip); 53 SkASSERT(!fHasStencilClip);
57 fHasStencilClip = true; 54 fHasStencilClip = true;
58 } 55 }
59 56
60 /** 57 /**
61 * Returns the device bounds of the draw after clip has been applied. TODO: Ideally this would 58 * Returns the device bounds of the draw after clip has been applied. TODO: Ideally this would
62 * consider the combined effect of all clipping techniques in play (scissor, stencil, fp, etc.). 59 * consider the combined effect of all clipping techniques in play (scissor, stencil, fp, etc.).
63 */ 60 */
64 const SkRect& clippedDrawBounds() const { return fClippedDrawBounds; } 61 const SkRect& clippedDrawBounds() const { return fClippedDrawBounds; }
65 62
66 private: 63 private:
67 GrScissorState fScissorState; 64 GrScissorState fScissorState;
68 GrWindowRectsState fWindowRectsState; 65 GrWindowRectangles fWindowRects;
69 sk_sp<GrFragmentProcessor> fClipCoverageFP; 66 sk_sp<GrFragmentProcessor> fClipCoverageFP;
70 bool fHasStencilClip; 67 bool fHasStencilClip;
71 SkRect fClippedDrawBounds; 68 SkRect fClippedDrawBounds;
72 typedef SkNoncopyable INHERITED; 69 typedef SkNoncopyable INHERITED;
73 }; 70 };
74 71
75 #endif 72 #endif
OLDNEW
« no previous file with comments | « include/private/GrSurfaceProxy.h ('k') | src/gpu/GrClipStackClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698