OLD | NEW |
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 GrRenderTargetContextPriv_DEFINED | 8 #ifndef GrRenderTargetContextPriv_DEFINED |
9 #define GrRenderTargetContextPriv_DEFINED | 9 #define GrRenderTargetContextPriv_DEFINED |
10 | 10 |
11 #include "GrRenderTargetContext.h" | 11 #include "GrRenderTargetContext.h" |
12 #include "GrRenderTargetOpList.h" | 12 #include "GrRenderTargetOpList.h" |
13 #include "GrPathRendering.h" | 13 #include "GrPathRendering.h" |
14 | 14 |
15 class GrFixedClip; | 15 class GrFixedClip; |
16 class GrPath; | 16 class GrPath; |
17 struct GrUserStencilSettings; | 17 struct GrUserStencilSettings; |
18 | 18 |
19 /** Class that adds methods to GrRenderTargetContext that are only intended for
use internal to | 19 /** Class that adds methods to GrRenderTargetContext that are only intended for
use internal to |
20 Skia. This class is purely a privileged window into GrRenderTargetContext. I
t should never have | 20 Skia. This class is purely a privileged window into GrRenderTargetContext. I
t should never have |
21 additional data members or virtual methods. */ | 21 additional data members or virtual methods. */ |
22 class GrRenderTargetContextPriv { | 22 class GrRenderTargetContextPriv { |
23 public: | 23 public: |
24 gr_instanced::InstancedRendering* accessInstancedRendering() const { | 24 gr_instanced::InstancedRendering* accessInstancedRendering() const { |
25 return fRenderTargetContext->getOpList()->instancedRendering(); | 25 return fRenderTargetContext->getOpList()->instancedRendering(); |
26 } | 26 } |
27 | 27 |
| 28 // called to note the last clip drawn to the stencil buffer. |
| 29 // TODO: remove after clipping overhaul. |
| 30 void setLastClip(int32_t clipStackGenID, |
| 31 const SkIRect& clipSpaceRect, |
| 32 const SkIPoint clipOrigin) { |
| 33 GrRenderTargetOpList* opList = fRenderTargetContext->getOpList(); |
| 34 opList->fLastClipStackGenID = clipStackGenID; |
| 35 opList->fLastClipStackRect = clipSpaceRect; |
| 36 opList->fLastClipOrigin = clipOrigin; |
| 37 } |
| 38 |
| 39 // called to determine if we have to render the clip into SB. |
| 40 // TODO: remove after clipping overhaul. |
| 41 bool mustRenderClip(int32_t clipStackGenID, |
| 42 const SkIRect& clipSpaceRect, |
| 43 const SkIPoint& clipOrigin) const { |
| 44 GrRenderTargetOpList* opList = fRenderTargetContext->getOpList(); |
| 45 return opList->fLastClipStackGenID != clipStackGenID || |
| 46 opList->fLastClipOrigin != clipOrigin || |
| 47 !opList->fLastClipStackRect.contains(clipSpaceRect); |
| 48 } |
| 49 |
28 void clear(const GrFixedClip&, const GrColor, bool canIgnoreClip); | 50 void clear(const GrFixedClip&, const GrColor, bool canIgnoreClip); |
29 | 51 |
30 void clearStencilClip(const GrFixedClip&, bool insideStencilMask); | 52 void clearStencilClip(const GrFixedClip&, bool insideStencilMask); |
31 | 53 |
32 void stencilRect(const GrClip& clip, | 54 void stencilRect(const GrClip& clip, |
33 const GrUserStencilSettings* ss, | 55 const GrUserStencilSettings* ss, |
34 bool useHWAA, | 56 bool useHWAA, |
35 const SkMatrix& viewMatrix, | 57 const SkMatrix& viewMatrix, |
36 const SkRect& rect); | 58 const SkRect& rect); |
37 | 59 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 102 |
81 inline GrRenderTargetContextPriv GrRenderTargetContext::priv() { | 103 inline GrRenderTargetContextPriv GrRenderTargetContext::priv() { |
82 return GrRenderTargetContextPriv(this); | 104 return GrRenderTargetContextPriv(this); |
83 } | 105 } |
84 | 106 |
85 inline const GrRenderTargetContextPriv GrRenderTargetContext::priv() const { | 107 inline const GrRenderTargetContextPriv GrRenderTargetContext::priv() const { |
86 return GrRenderTargetContextPriv(const_cast<GrRenderTargetContext*>(this)); | 108 return GrRenderTargetContextPriv(const_cast<GrRenderTargetContext*>(this)); |
87 } | 109 } |
88 | 110 |
89 #endif | 111 #endif |
OLD | NEW |