Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2012 Google Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | #ifndef GrFBBindableObj_DEFINED |
michael@0 | 10 | #define GrFBBindableObj_DEFINED |
michael@0 | 11 | |
michael@0 | 12 | #include "SkTDArray.h" |
michael@0 | 13 | #include "GrFakeRefObj.h" |
michael@0 | 14 | |
michael@0 | 15 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 16 | // A common base class for render buffers and textures |
michael@0 | 17 | class GrFBBindableObj : public GrFakeRefObj { |
michael@0 | 18 | |
michael@0 | 19 | public: |
michael@0 | 20 | GrFBBindableObj() |
michael@0 | 21 | : GrFakeRefObj() { |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | virtual ~GrFBBindableObj() { |
michael@0 | 25 | GrAlwaysAssert(0 == fColorReferees.count()); |
michael@0 | 26 | GrAlwaysAssert(0 == fDepthReferees.count()); |
michael@0 | 27 | GrAlwaysAssert(0 == fStencilReferees.count()); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | void setColorBound(GrFakeRefObj *referee) { |
michael@0 | 31 | fColorReferees.append(1, &referee); |
michael@0 | 32 | } |
michael@0 | 33 | void resetColorBound(GrFakeRefObj *referee) { |
michael@0 | 34 | int index = fColorReferees.find(referee); |
michael@0 | 35 | GrAlwaysAssert(0 <= index); |
michael@0 | 36 | fColorReferees.removeShuffle(index); |
michael@0 | 37 | } |
michael@0 | 38 | bool getColorBound(GrFakeRefObj *referee) const { |
michael@0 | 39 | int index = fColorReferees.find(referee); |
michael@0 | 40 | return 0 <= index; |
michael@0 | 41 | } |
michael@0 | 42 | bool getColorBound() const { |
michael@0 | 43 | return 0 != fColorReferees.count(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | void setDepthBound(GrFakeRefObj *referee) { |
michael@0 | 47 | fDepthReferees.append(1, &referee); |
michael@0 | 48 | } |
michael@0 | 49 | void resetDepthBound(GrFakeRefObj *referee) { |
michael@0 | 50 | int index = fDepthReferees.find(referee); |
michael@0 | 51 | GrAlwaysAssert(0 <= index); |
michael@0 | 52 | fDepthReferees.removeShuffle(index); |
michael@0 | 53 | } |
michael@0 | 54 | bool getDepthBound(GrFakeRefObj *referee) const { |
michael@0 | 55 | int index = fDepthReferees.find(referee); |
michael@0 | 56 | return 0 <= index; |
michael@0 | 57 | } |
michael@0 | 58 | bool getDepthBound() const { |
michael@0 | 59 | return 0 != fDepthReferees.count(); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | void setStencilBound(GrFakeRefObj *referee) { |
michael@0 | 63 | fStencilReferees.append(1, &referee); |
michael@0 | 64 | } |
michael@0 | 65 | void resetStencilBound(GrFakeRefObj *referee) { |
michael@0 | 66 | int index = fStencilReferees.find(referee); |
michael@0 | 67 | GrAlwaysAssert(0 <= index); |
michael@0 | 68 | fStencilReferees.removeShuffle(index); |
michael@0 | 69 | } |
michael@0 | 70 | bool getStencilBound(GrFakeRefObj *referee) const { |
michael@0 | 71 | int index = fStencilReferees.find(referee); |
michael@0 | 72 | return 0 <= index; |
michael@0 | 73 | } |
michael@0 | 74 | bool getStencilBound() const { |
michael@0 | 75 | return 0 != fStencilReferees.count(); |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | |
michael@0 | 79 | protected: |
michael@0 | 80 | private: |
michael@0 | 81 | SkTDArray<GrFakeRefObj *> fColorReferees; // frame buffers that use this as a color buffer (via "glFramebufferRenderbuffer" or "glFramebufferTexture2D") |
michael@0 | 82 | SkTDArray<GrFakeRefObj *> fDepthReferees; // frame buffers that use this as a depth buffer (via "glFramebufferRenderbuffer" or "glFramebufferTexture2D") |
michael@0 | 83 | SkTDArray<GrFakeRefObj *> fStencilReferees; // frame buffers that use this as a stencil buffer (via "glFramebufferRenderbuffer" or "glFramebufferTexture2D") |
michael@0 | 84 | |
michael@0 | 85 | typedef GrFakeRefObj INHERITED; |
michael@0 | 86 | }; |
michael@0 | 87 | |
michael@0 | 88 | #endif // GrFBBindableObj_DEFINED |