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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/effects/SkPerlinNoiseShader.h ('k') | include/gpu/GrContext.h » ('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 GrDrawContext; 15 class GrDrawContext;
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 : public SkNoncopyable { 22 class GrAppliedClip : public SkNoncopyable {
23 public: 23 public:
24 GrAppliedClip() : fHasStencilClip(false) {} 24 GrAppliedClip() : fHasStencilClip(false) {}
25 const GrFragmentProcessor* clipCoverageFragmentProcessor() const { 25 GrFragmentProcessor* getClipCoverageFragmentProcessor() const {
26 return fClipCoverageFP.get(); 26 return fClipCoverageFP.get();
27 } 27 }
28 const GrScissorState& scissorState() const { return fScissorState; } 28 const GrScissorState& scissorState() const { return fScissorState; }
29 bool hasStencilClip() const { return fHasStencilClip; } 29 bool hasStencilClip() const { return fHasStencilClip; }
30 30
31 void makeStencil(bool hasStencil) { 31 void makeStencil(bool hasStencil) {
32 fClipCoverageFP = nullptr; 32 fClipCoverageFP = nullptr;
33 fScissorState.setDisabled(); 33 fScissorState.setDisabled();
34 fHasStencilClip = hasStencil; 34 fHasStencilClip = hasStencil;
35 } 35 }
36 36
37 void makeScissoredStencil(bool hasStencil, const SkIRect& scissor) { 37 void makeScissoredStencil(bool hasStencil, const SkIRect& scissor) {
38 fClipCoverageFP = nullptr; 38 fClipCoverageFP = nullptr;
39 fScissorState.set(scissor); 39 fScissorState.set(scissor);
40 fHasStencilClip = hasStencil; 40 fHasStencilClip = hasStencil;
41 } 41 }
42 42
43 void makeFPBased(sk_sp<const GrFragmentProcessor> fp) { 43 void makeFPBased(sk_sp<GrFragmentProcessor> fp) {
44 fClipCoverageFP = fp; 44 fClipCoverageFP = fp;
45 fScissorState.setDisabled(); 45 fScissorState.setDisabled();
46 fHasStencilClip = false; 46 fHasStencilClip = false;
47 } 47 }
48 48
49 void makeScissoredFPBased(sk_sp<const GrFragmentProcessor> fp, SkIRect& scis sor) { 49 void makeScissoredFPBased(sk_sp<GrFragmentProcessor> fp, SkIRect& scissor) {
50 fClipCoverageFP = fp; 50 fClipCoverageFP = fp;
51 fScissorState.set(scissor); 51 fScissorState.set(scissor);
52 fHasStencilClip = false; 52 fHasStencilClip = false;
53 } 53 }
54 54
55 private: 55 private:
56 sk_sp<const GrFragmentProcessor> fClipCoverageFP; 56 sk_sp<GrFragmentProcessor> fClipCoverageFP;
57 GrScissorState fScissorState; 57 GrScissorState fScissorState;
58 bool fHasStencilClip; 58 bool fHasStencilClip;
59 59
60 typedef SkNoncopyable INHERITED; 60 typedef SkNoncopyable INHERITED;
61 }; 61 };
62 62
63 /** 63 /**
64 * 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
65 * 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.
66 */ 66 */
67 class GrClip { 67 class GrClip {
68 public: 68 public:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool* isIntersectionOfRects) const final; 146 bool* isIntersectionOfRects) const final;
147 bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*, 147 bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*,
148 const SkRect* devBounds, GrAppliedClip*) const final; 148 const SkRect* devBounds, GrAppliedClip*) const final;
149 149
150 private: 150 private:
151 SkIPoint fOrigin; 151 SkIPoint fOrigin;
152 SkAutoTUnref<const SkClipStack> fStack; 152 SkAutoTUnref<const SkClipStack> fStack;
153 }; 153 };
154 154
155 #endif 155 #endif
OLDNEW
« no previous file with comments | « include/effects/SkPerlinNoiseShader.h ('k') | include/gpu/GrContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698