| 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const SkIRect& clipSpaceRect, | 43 const SkIRect& clipSpaceRect, |
| 44 const SkIPoint clipSpaceToStencilOffset) const { | 44 const SkIPoint clipSpaceToStencilOffset) const { |
| 45 return fLastClipStackGenID != clipStackGenID || | 45 return fLastClipStackGenID != clipStackGenID || |
| 46 fLastClipSpaceOffset != clipSpaceToStencilOffset || | 46 fLastClipSpaceOffset != clipSpaceToStencilOffset || |
| 47 !fLastClipStackRect.contains(clipSpaceRect); | 47 !fLastClipStackRect.contains(clipSpaceRect); |
| 48 } | 48 } |
| 49 | 49 |
| 50 static void ComputeKey(int width, int height, int sampleCnt, GrScratchKey* k
ey); | 50 static void ComputeKey(int width, int height, int sampleCnt, GrScratchKey* k
ey); |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 GrStencilBuffer(GrGpu* gpu, int width, int height, int bits, int sampleCnt) | 53 GrStencilBuffer(GrGpu* gpu, LifeCycle lifeCycle, int width, int height, int
bits, int sampleCnt) |
| 54 : GrGpuResource(gpu, kCached_LifeCycle) | 54 : GrGpuResource(gpu, lifeCycle) |
| 55 , fWidth(width) | 55 , fWidth(width) |
| 56 , fHeight(height) | 56 , fHeight(height) |
| 57 , fBits(bits) | 57 , fBits(bits) |
| 58 , fSampleCnt(sampleCnt) | 58 , fSampleCnt(sampleCnt) |
| 59 , fLastClipStackGenID(SkClipStack::kInvalidGenID) { | 59 , fLastClipStackGenID(SkClipStack::kInvalidGenID) { |
| 60 GrScratchKey key; | 60 if (kCached_LifeCycle == lifeCycle) { |
| 61 ComputeKey(width, height, sampleCnt, &key); | 61 GrScratchKey key; |
| 62 this->setScratchKey(key); | 62 ComputeKey(width, height, sampleCnt, &key); |
| 63 this->setScratchKey(key); |
| 64 } |
| 63 fLastClipStackRect.setEmpty(); | 65 fLastClipStackRect.setEmpty(); |
| 64 } | 66 } |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 | 69 |
| 68 int fWidth; | 70 int fWidth; |
| 69 int fHeight; | 71 int fHeight; |
| 70 int fBits; | 72 int fBits; |
| 71 int fSampleCnt; | 73 int fSampleCnt; |
| 72 | 74 |
| 73 int32_t fLastClipStackGenID; | 75 int32_t fLastClipStackGenID; |
| 74 SkIRect fLastClipStackRect; | 76 SkIRect fLastClipStackRect; |
| 75 SkIPoint fLastClipSpaceOffset; | 77 SkIPoint fLastClipSpaceOffset; |
| 76 | 78 |
| 77 typedef GrGpuResource INHERITED; | 79 typedef GrGpuResource INHERITED; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 #endif | 82 #endif |
| OLD | NEW |