Line data Source code
1 : /*
2 : * Copyright 2011 Google Inc.
3 : *
4 : * Use of this source code is governed by a BSD-style license that can be
5 : * found in the LICENSE file.
6 : */
7 :
8 :
9 : #ifndef GrStencilAttachment_DEFINED
10 : #define GrStencilAttachment_DEFINED
11 :
12 : #include "GrGpuResource.h"
13 : #include "SkClipStack.h"
14 :
15 : class GrRenderTarget;
16 : class GrResourceKey;
17 :
18 : class GrStencilAttachment : public GrGpuResource {
19 : public:
20 :
21 :
22 0 : virtual ~GrStencilAttachment() {
23 : // TODO: allow SB to be purged and detach itself from rts
24 0 : }
25 :
26 0 : int width() const { return fWidth; }
27 0 : int height() const { return fHeight; }
28 0 : int bits() const { return fBits; }
29 0 : int numSamples() const { return fSampleCnt; }
30 :
31 : // We create a unique stencil buffer at each width, height and sampleCnt and share it for
32 : // all render targets that require a stencil with those params.
33 : static void ComputeSharedStencilAttachmentKey(int width, int height, int sampleCnt,
34 : GrUniqueKey* key);
35 :
36 : protected:
37 0 : GrStencilAttachment(GrGpu* gpu, int width, int height, int bits, int sampleCnt)
38 0 : : GrGpuResource(gpu)
39 : , fWidth(width)
40 : , fHeight(height)
41 : , fBits(bits)
42 0 : , fSampleCnt(sampleCnt) {
43 0 : }
44 :
45 : private:
46 :
47 : int fWidth;
48 : int fHeight;
49 : int fBits;
50 : int fSampleCnt;
51 :
52 : typedef GrGpuResource INHERITED;
53 : };
54 :
55 : #endif
|