Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: src/gpu/GrStencilBuffer.h

Issue 747043004: Use scratch keys for stencil buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/GrStencilBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 40
41 // called to determine if we have to render the clip into SB. 41 // called to determine if we have to render the clip into SB.
42 bool mustRenderClip(int32_t clipStackGenID, 42 bool mustRenderClip(int32_t clipStackGenID,
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 // Places the sb in the cache. The cache takes a ref of the stencil buffer.
51 void transferToCache();
52
53 static GrResourceKey ComputeKey(int width, int height, int sampleCnt); 50 static GrResourceKey ComputeKey(int width, int height, int sampleCnt);
54 51
55 protected: 52 protected:
56 GrStencilBuffer(GrGpu* gpu, bool isWrapped, int width, int height, int bits, int sampleCnt) 53 GrStencilBuffer(GrGpu* gpu, bool isWrapped, int width, int height, int bits, int sampleCnt)
57 : GrGpuResource(gpu, isWrapped) 54 : GrGpuResource(gpu, isWrapped)
58 , fWidth(width) 55 , fWidth(width)
59 , fHeight(height) 56 , fHeight(height)
60 , fBits(bits) 57 , fBits(bits)
61 , fSampleCnt(sampleCnt) 58 , fSampleCnt(sampleCnt)
62 , fLastClipStackGenID(SkClipStack::kInvalidGenID) { 59 , fLastClipStackGenID(SkClipStack::kInvalidGenID) {
60 this->setScratchKey(ComputeKey(width, height, sampleCnt));
63 fLastClipStackRect.setEmpty(); 61 fLastClipStackRect.setEmpty();
64 } 62 }
65 63
66 private: 64 private:
67 65
68 int fWidth; 66 int fWidth;
69 int fHeight; 67 int fHeight;
70 int fBits; 68 int fBits;
71 int fSampleCnt; 69 int fSampleCnt;
72 70
73 int32_t fLastClipStackGenID; 71 int32_t fLastClipStackGenID;
74 SkIRect fLastClipStackRect; 72 SkIRect fLastClipStackRect;
75 SkIPoint fLastClipSpaceOffset; 73 SkIPoint fLastClipSpaceOffset;
76 74
77 typedef GrGpuResource INHERITED; 75 typedef GrGpuResource INHERITED;
78 }; 76 };
79 77
80 #endif 78 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/GrStencilBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698