gfx/skia/trunk/src/gpu/gl/debug/GrTextureObj.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/gpu/gl/debug/GrTextureObj.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2012 Google Inc.
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +#ifndef GrTextureObj_DEFINED
    1.13 +#define GrTextureObj_DEFINED
    1.14 +
    1.15 +#include "GrFBBindableObj.h"
    1.16 +
    1.17 +class GrTextureUnitObj;
    1.18 +
    1.19 +////////////////////////////////////////////////////////////////////////////////
    1.20 +class GrTextureObj : public GrFBBindableObj {
    1.21 +    GR_DEFINE_CREATOR(GrTextureObj);
    1.22 +
    1.23 +public:
    1.24 +    GrTextureObj()
    1.25 +        : GrFBBindableObj() {
    1.26 +    }
    1.27 +
    1.28 +    virtual ~GrTextureObj() {
    1.29 +        GrAlwaysAssert(0 == fTextureUnitReferees.count());
    1.30 +    }
    1.31 +
    1.32 +    void setBound(GrTextureUnitObj *referee) {
    1.33 +        fTextureUnitReferees.append(1, &referee);
    1.34 +    }
    1.35 +
    1.36 +    void resetBound(GrTextureUnitObj *referee) {
    1.37 +        int index = fTextureUnitReferees.find(referee);
    1.38 +        GrAlwaysAssert(0 <= index);
    1.39 +        fTextureUnitReferees.removeShuffle(index);
    1.40 +    }
    1.41 +    bool getBound(GrTextureUnitObj *referee) const {
    1.42 +        int index = fTextureUnitReferees.find(referee);
    1.43 +        return 0 <= index;
    1.44 +    }
    1.45 +    bool getBound() const {
    1.46 +        return 0 != fTextureUnitReferees.count();
    1.47 +    }
    1.48 +
    1.49 +    virtual void deleteAction() SK_OVERRIDE;
    1.50 +
    1.51 +protected:
    1.52 +
    1.53 +private:
    1.54 +    // texture units that bind this texture (via "glBindTexture")
    1.55 +    SkTDArray<GrTextureUnitObj *> fTextureUnitReferees;
    1.56 +
    1.57 +    typedef GrFBBindableObj INHERITED;
    1.58 +};
    1.59 +
    1.60 +#endif // GrTextureObj_DEFINED

mercurial