| 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 "GrResource.h" | 14 #include "GrGpuObject.h" |
| 15 | 15 |
| 16 class GrRenderTarget; | 16 class GrRenderTarget; |
| 17 class GrResourceEntry; | |
| 18 class GrResourceKey; | 17 class GrResourceKey; |
| 19 | 18 |
| 20 class GrStencilBuffer : public GrResource { | 19 class GrStencilBuffer : public GrGpuObject { |
| 21 public: | 20 public: |
| 22 SK_DECLARE_INST_COUNT(GrStencilBuffer); | 21 SK_DECLARE_INST_COUNT(GrStencilBuffer); |
| 23 | 22 |
| 24 virtual ~GrStencilBuffer() { | 23 virtual ~GrStencilBuffer() { |
| 25 // TODO: allow SB to be purged and detach itself from rts | 24 // TODO: allow SB to be purged and detach itself from rts |
| 26 } | 25 } |
| 27 | 26 |
| 28 int width() const { return fWidth; } | 27 int width() const { return fWidth; } |
| 29 int height() const { return fHeight; } | 28 int height() const { return fHeight; } |
| 30 int bits() const { return fBits; } | 29 int bits() const { return fBits; } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 48 !fLastClipStackRect.contains(clipSpaceRect); | 47 !fLastClipStackRect.contains(clipSpaceRect); |
| 49 } | 48 } |
| 50 | 49 |
| 51 // 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. |
| 52 void transferToCache(); | 51 void transferToCache(); |
| 53 | 52 |
| 54 static GrResourceKey ComputeKey(int width, int height, int sampleCnt); | 53 static GrResourceKey ComputeKey(int width, int height, int sampleCnt); |
| 55 | 54 |
| 56 protected: | 55 protected: |
| 57 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) |
| 58 : GrResource(gpu, isWrapped) | 57 : GrGpuObject(gpu, isWrapped) |
| 59 , fWidth(width) | 58 , fWidth(width) |
| 60 , fHeight(height) | 59 , fHeight(height) |
| 61 , fBits(bits) | 60 , fBits(bits) |
| 62 , fSampleCnt(sampleCnt) | 61 , fSampleCnt(sampleCnt) |
| 63 , fLastClipStackGenID(SkClipStack::kInvalidGenID) { | 62 , fLastClipStackGenID(SkClipStack::kInvalidGenID) { |
| 64 fLastClipStackRect.setEmpty(); | 63 fLastClipStackRect.setEmpty(); |
| 65 } | 64 } |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 | 67 |
| 69 int fWidth; | 68 int fWidth; |
| 70 int fHeight; | 69 int fHeight; |
| 71 int fBits; | 70 int fBits; |
| 72 int fSampleCnt; | 71 int fSampleCnt; |
| 73 | 72 |
| 74 int32_t fLastClipStackGenID; | 73 int32_t fLastClipStackGenID; |
| 75 SkIRect fLastClipStackRect; | 74 SkIRect fLastClipStackRect; |
| 76 SkIPoint fLastClipSpaceOffset; | 75 SkIPoint fLastClipSpaceOffset; |
| 77 | 76 |
| 78 typedef GrResource INHERITED; | 77 typedef GrGpuObject INHERITED; |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 #endif | 80 #endif |
| OLD | NEW |