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 GrStencilBuffer; |
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 { |
25 public: | 25 public: |
26 SK_DECLARE_INST_COUNT(GrRenderTarget) | 26 SK_DECLARE_INST_COUNT(GrRenderTarget) |
27 | 27 |
28 // GrSurface overrides | 28 // GrSurface overrides |
29 GrRenderTarget* asRenderTarget() SK_OVERRIDE { return this; } | 29 GrRenderTarget* asRenderTarget() override { return this; } |
30 const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return this; } | 30 const GrRenderTarget* asRenderTarget() const override { return this; } |
31 | 31 |
32 // GrRenderTarget | 32 // GrRenderTarget |
33 /** | 33 /** |
34 * @return true if the surface is multisampled, false otherwise | 34 * @return true if the surface is multisampled, false otherwise |
35 */ | 35 */ |
36 bool isMultisampled() const { return 0 != fDesc.fSampleCnt; } | 36 bool isMultisampled() const { return 0 != fDesc.fSampleCnt; } |
37 | 37 |
38 /** | 38 /** |
39 * @return the number of samples-per-pixel or zero if non-MSAA. | 39 * @return the number of samples-per-pixel or zero if non-MSAA. |
40 */ | 40 */ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 , fStencilBuffer(NULL) { |
100 fResolveRect.setLargestInverted(); | 100 fResolveRect.setLargestInverted(); |
101 } | 101 } |
102 | 102 |
103 // override of GrResource | 103 // override of GrResource |
104 void onAbandon() SK_OVERRIDE; | 104 void onAbandon() override; |
105 void onRelease() SK_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 GrStencilBuffer* fStencilBuffer; |
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 |