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

Side by Side Diff: include/gpu/GrClip.h

Issue 1993263002: Make GrAppliedClip friendless (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make GrAppliedClip friendless Created 4 years, 7 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 | « no previous file | src/gpu/GrClip.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 2010 Google Inc. 2 * Copyright 2010 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 GrClip_DEFINED 8 #ifndef GrClip_DEFINED
9 #define GrClip_DEFINED 9 #define GrClip_DEFINED
10 10
11 #include "GrFragmentProcessor.h" 11 #include "GrFragmentProcessor.h"
12 #include "GrTypesPriv.h" 12 #include "GrTypesPriv.h"
13 #include "SkClipStack.h" 13 #include "SkClipStack.h"
14 14
15 class GrClipMaskManager; 15 class GrClipMaskManager;
16 class GrPipelineBuilder; 16 class GrPipelineBuilder;
17 17
18 /** 18 /**
19 * Produced by GrClip. It provides a set of modifications to the drawing state t hat are used to 19 * Produced by GrClip. It provides a set of modifications to the drawing state t hat are used to
20 * create the final GrPipeline for a GrBatch. 20 * create the final GrPipeline for a GrBatch.
21 */ 21 */
22 class GrAppliedClip { 22 class GrAppliedClip : public SkNoncopyable {
23 public: 23 public:
24 GrAppliedClip() : fHasStencilClip(false) {} 24 GrAppliedClip() : fHasStencilClip(false) {}
25 const GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fC lipCoverageFP; } 25 const GrFragmentProcessor* clipCoverageFragmentProcessor() const {
26 return fClipCoverageFP.get();
27 }
26 const GrScissorState& scissorState() const { return fScissorState; } 28 const GrScissorState& scissorState() const { return fScissorState; }
27 bool hasStencilClip() const { return fHasStencilClip; } 29 bool hasStencilClip() const { return fHasStencilClip; }
28 30
31 void makeStencil(bool hasStencil) {
32 fClipCoverageFP = nullptr;
33 fScissorState.setDisabled();
34 fHasStencilClip = hasStencil;
35 }
36
37 void makeScissoredStencil(bool hasStencil, const SkIRect& scissor) {
38 fClipCoverageFP = nullptr;
39 fScissorState.set(scissor);
40 fHasStencilClip = hasStencil;
41 }
42
43 void makeFPBased(sk_sp<const GrFragmentProcessor> fp) {
44 fClipCoverageFP = fp;
45 fScissorState.setDisabled();
46 fHasStencilClip = false;
47 }
48
49 void makeScissoredFPBased(sk_sp<const GrFragmentProcessor> fp, SkIRect& scis sor) {
50 fClipCoverageFP = fp;
51 fScissorState.set(scissor);
52 fHasStencilClip = false;
53 }
54
29 private: 55 private:
30 SkAutoTUnref<const GrFragmentProcessor> fClipCoverageFP; 56 sk_sp<const GrFragmentProcessor> fClipCoverageFP;
31 GrScissorState fScissorState; 57 GrScissorState fScissorState;
32 bool fHasStencilClip; 58 bool fHasStencilClip;
33
34 friend class GrFixedClip;
35 friend class GrClipMaskManager;
36 59
37 typedef SkNoncopyable INHERITED; 60 typedef SkNoncopyable INHERITED;
38 }; 61 };
39 62
40 /** 63 /**
41 * GrClip is an abstract base class for applying a clip. It constructs a clip ma sk if necessary, and 64 * GrClip is an abstract base class for applying a clip. It constructs a clip ma sk if necessary, and
42 * fills out a GrAppliedClip instructing the caller on how to set up the draw st ate. 65 * fills out a GrAppliedClip instructing the caller on how to set up the draw st ate.
43 */ 66 */
44 class GrClip { 67 class GrClip {
45 public: 68 public:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool* isIntersectionOfRects) const final; 146 bool* isIntersectionOfRects) const final;
124 bool apply(GrClipMaskManager*, const GrPipelineBuilder&, 147 bool apply(GrClipMaskManager*, const GrPipelineBuilder&,
125 const SkRect* devBounds, GrAppliedClip*) const final; 148 const SkRect* devBounds, GrAppliedClip*) const final;
126 149
127 private: 150 private:
128 SkIPoint fOrigin; 151 SkIPoint fOrigin;
129 SkAutoTUnref<const SkClipStack> fStack; 152 SkAutoTUnref<const SkClipStack> fStack;
130 }; 153 };
131 154
132 #endif 155 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698