OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrRenderTarget_DEFINED | 8 #ifndef GrRenderTarget_DEFINED |
9 #define GrRenderTarget_DEFINED | 9 #define GrRenderTarget_DEFINED |
10 | 10 |
11 #include "GrSurface.h" | 11 #include "GrSurface.h" |
12 #include "SkRect.h" | 12 #include "SkRect.h" |
13 | 13 |
14 class GrStencilBuffer; | 14 class GrStencilAttachment; |
15 class GrRenderTargetPriv; | 15 class GrRenderTargetPriv; |
16 | 16 |
17 /** | 17 /** |
18 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. | 18 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. |
19 * A context's render target is set by setRenderTarget(). Render targets are | 19 * A context's render target is set by setRenderTarget(). Render targets are |
20 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. | 20 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. |
21 * Additionally, GrContext provides methods for creating GrRenderTargets | 21 * Additionally, GrContext provides methods for creating GrRenderTargets |
22 * that wrap externally created render targets. | 22 * that wrap externally created render targets. |
23 */ | 23 */ |
24 class GrRenderTarget : virtual public GrSurface { | 24 class GrRenderTarget : virtual public GrSurface { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 }; | 89 }; |
90 virtual ResolveType getResolveType() const = 0; | 90 virtual ResolveType getResolveType() const = 0; |
91 | 91 |
92 // Provides access to functions that aren't part of the public API. | 92 // Provides access to functions that aren't part of the public API. |
93 GrRenderTargetPriv renderTargetPriv(); | 93 GrRenderTargetPriv renderTargetPriv(); |
94 const GrRenderTargetPriv renderTargetPriv() const; | 94 const GrRenderTargetPriv renderTargetPriv() const; |
95 | 95 |
96 protected: | 96 protected: |
97 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) | 97 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) |
98 : INHERITED(gpu, lifeCycle, desc) | 98 : INHERITED(gpu, lifeCycle, desc) |
99 , fStencilBuffer(NULL) { | 99 , fStencilAttachment(NULL) { |
100 fResolveRect.setLargestInverted(); | 100 fResolveRect.setLargestInverted(); |
101 } | 101 } |
102 | 102 |
103 // override of GrResource | 103 // override of GrResource |
104 void onAbandon() override; | 104 void onAbandon() override; |
105 void onRelease() override; | 105 void onRelease() override; |
106 | 106 |
107 private: | 107 private: |
108 // Checked when this object is asked to attach a stencil buffer. | 108 // Checked when this object is asked to attach a stencil buffer. |
109 virtual bool canAttemptStencilAttachment() const = 0; | 109 virtual bool canAttemptStencilAttachment() const = 0; |
110 | 110 |
111 friend class GrRenderTargetPriv; | 111 friend class GrRenderTargetPriv; |
112 | 112 |
113 GrStencilBuffer* fStencilBuffer; | 113 GrStencilAttachment* fStencilAttachment; |
114 | 114 |
115 SkIRect fResolveRect; | 115 SkIRect fResolveRect; |
116 | 116 |
117 typedef GrSurface INHERITED; | 117 typedef GrSurface INHERITED; |
118 }; | 118 }; |
119 | 119 |
120 #endif | 120 #endif |
OLD | NEW |