OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef GrStencilBuffer_DEFINED | 10 #ifndef GrStencilBuffer_DEFINED |
11 #define GrStencilBuffer_DEFINED | 11 #define GrStencilBuffer_DEFINED |
12 | 12 |
13 #include "GrClipData.h" | 13 #include "GrClipData.h" |
14 #include "GrGpuObject.h" | 14 #include "GrGpuResource.h" |
15 | 15 |
16 class GrRenderTarget; | 16 class GrRenderTarget; |
17 class GrResourceKey; | 17 class GrResourceKey; |
18 | 18 |
19 class GrStencilBuffer : public GrGpuObject { | 19 class GrStencilBuffer : public GrGpuResource { |
20 public: | 20 public: |
21 SK_DECLARE_INST_COUNT(GrStencilBuffer); | 21 SK_DECLARE_INST_COUNT(GrStencilBuffer); |
22 | 22 |
23 virtual ~GrStencilBuffer() { | 23 virtual ~GrStencilBuffer() { |
24 // TODO: allow SB to be purged and detach itself from rts | 24 // TODO: allow SB to be purged and detach itself from rts |
25 } | 25 } |
26 | 26 |
27 int width() const { return fWidth; } | 27 int width() const { return fWidth; } |
28 int height() const { return fHeight; } | 28 int height() const { return fHeight; } |
29 int bits() const { return fBits; } | 29 int bits() const { return fBits; } |
(...skipping 17 matching lines...) Expand all Loading... |
47 !fLastClipStackRect.contains(clipSpaceRect); | 47 !fLastClipStackRect.contains(clipSpaceRect); |
48 } | 48 } |
49 | 49 |
50 // Places the sb in the cache. The cache takes a ref of the stencil buffer. | 50 // Places the sb in the cache. The cache takes a ref of the stencil buffer. |
51 void transferToCache(); | 51 void transferToCache(); |
52 | 52 |
53 static GrResourceKey ComputeKey(int width, int height, int sampleCnt); | 53 static GrResourceKey ComputeKey(int width, int height, int sampleCnt); |
54 | 54 |
55 protected: | 55 protected: |
56 GrStencilBuffer(GrGpu* gpu, bool isWrapped, int width, int height, int bits,
int sampleCnt) | 56 GrStencilBuffer(GrGpu* gpu, bool isWrapped, int width, int height, int bits,
int sampleCnt) |
57 : GrGpuObject(gpu, isWrapped) | 57 : GrGpuResource(gpu, isWrapped) |
58 , fWidth(width) | 58 , fWidth(width) |
59 , fHeight(height) | 59 , fHeight(height) |
60 , fBits(bits) | 60 , fBits(bits) |
61 , fSampleCnt(sampleCnt) | 61 , fSampleCnt(sampleCnt) |
62 , fLastClipStackGenID(SkClipStack::kInvalidGenID) { | 62 , fLastClipStackGenID(SkClipStack::kInvalidGenID) { |
63 fLastClipStackRect.setEmpty(); | 63 fLastClipStackRect.setEmpty(); |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 | 67 |
68 int fWidth; | 68 int fWidth; |
69 int fHeight; | 69 int fHeight; |
70 int fBits; | 70 int fBits; |
71 int fSampleCnt; | 71 int fSampleCnt; |
72 | 72 |
73 int32_t fLastClipStackGenID; | 73 int32_t fLastClipStackGenID; |
74 SkIRect fLastClipStackRect; | 74 SkIRect fLastClipStackRect; |
75 SkIPoint fLastClipSpaceOffset; | 75 SkIPoint fLastClipSpaceOffset; |
76 | 76 |
77 typedef GrGpuObject INHERITED; | 77 typedef GrGpuResource INHERITED; |
78 }; | 78 }; |
79 | 79 |
80 #endif | 80 #endif |
OLD | NEW |