Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
2 /*
3 * Copyright 2012 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 */
9 #ifndef GrTextureObj_DEFINED
10 #define GrTextureObj_DEFINED
12 #include "GrFBBindableObj.h"
14 class GrTextureUnitObj;
16 ////////////////////////////////////////////////////////////////////////////////
17 class GrTextureObj : public GrFBBindableObj {
18 GR_DEFINE_CREATOR(GrTextureObj);
20 public:
21 GrTextureObj()
22 : GrFBBindableObj() {
23 }
25 virtual ~GrTextureObj() {
26 GrAlwaysAssert(0 == fTextureUnitReferees.count());
27 }
29 void setBound(GrTextureUnitObj *referee) {
30 fTextureUnitReferees.append(1, &referee);
31 }
33 void resetBound(GrTextureUnitObj *referee) {
34 int index = fTextureUnitReferees.find(referee);
35 GrAlwaysAssert(0 <= index);
36 fTextureUnitReferees.removeShuffle(index);
37 }
38 bool getBound(GrTextureUnitObj *referee) const {
39 int index = fTextureUnitReferees.find(referee);
40 return 0 <= index;
41 }
42 bool getBound() const {
43 return 0 != fTextureUnitReferees.count();
44 }
46 virtual void deleteAction() SK_OVERRIDE;
48 protected:
50 private:
51 // texture units that bind this texture (via "glBindTexture")
52 SkTDArray<GrTextureUnitObj *> fTextureUnitReferees;
54 typedef GrFBBindableObj INHERITED;
55 };
57 #endif // GrTextureObj_DEFINED