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

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

Issue 1083133002: Rename GrStencilBuffer to GrStencilAttachment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Align data member Created 5 years, 8 months 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/GrStencilAttachment.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
(Empty)
1
2 /*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10 #ifndef GrStencilBuffer_DEFINED
11 #define GrStencilBuffer_DEFINED
12
13 #include "GrClip.h"
14 #include "GrGpuResource.h"
15
16 class GrRenderTarget;
17 class GrResourceKey;
18
19 class GrStencilBuffer : public GrGpuResource {
20 public:
21 SK_DECLARE_INST_COUNT(GrStencilBuffer);
22
23 virtual ~GrStencilBuffer() {
24 // TODO: allow SB to be purged and detach itself from rts
25 }
26
27 int width() const { return fWidth; }
28 int height() const { return fHeight; }
29 int bits() const { return fBits; }
30 int numSamples() const { return fSampleCnt; }
31
32 // called to note the last clip drawn to this buffer.
33 void setLastClip(int32_t clipStackGenID,
34 const SkIRect& clipSpaceRect,
35 const SkIPoint clipSpaceToStencilOffset) {
36 fLastClipStackGenID = clipStackGenID;
37 fLastClipStackRect = clipSpaceRect;
38 fLastClipSpaceOffset = clipSpaceToStencilOffset;
39 }
40
41 // called to determine if we have to render the clip into SB.
42 bool mustRenderClip(int32_t clipStackGenID,
43 const SkIRect& clipSpaceRect,
44 const SkIPoint clipSpaceToStencilOffset) const {
45 return fLastClipStackGenID != clipStackGenID ||
46 fLastClipSpaceOffset != clipSpaceToStencilOffset ||
47 !fLastClipStackRect.contains(clipSpaceRect);
48 }
49
50 // We create a unique stencil buffer at each width, height and sampleCnt and share it for
51 // all render targets that require a stencil with those params.
52 static void ComputeSharedStencilBufferKey(int width, int height, int sampleC nt,
53 GrUniqueKey* key);
54
55 protected:
56 GrStencilBuffer(GrGpu* gpu, LifeCycle lifeCycle, int width, int height, int bits, int sampleCnt)
57 : GrGpuResource(gpu, lifeCycle)
58 , fWidth(width)
59 , fHeight(height)
60 , fBits(bits)
61 , fSampleCnt(sampleCnt)
62 , fLastClipStackGenID(SkClipStack::kInvalidGenID) {
63 fLastClipStackRect.setEmpty();
64 }
65
66 private:
67
68 int fWidth;
69 int fHeight;
70 int fBits;
71 int fSampleCnt;
72
73 int32_t fLastClipStackGenID;
74 SkIRect fLastClipStackRect;
75 SkIPoint fLastClipSpaceOffset;
76
77 typedef GrGpuResource INHERITED;
78 };
79
80 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrStencilAttachment.cpp ('k') | src/gpu/GrStencilBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698