1
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 */
8
9#ifndef GrTextreUnitObj_DEFINED
10#define GrTextureUnitObj_DEFINED
11
12#include "GrFakeRefObj.h"
13class GrTextureObj;
14
15////////////////////////////////////////////////////////////////////////////////
16// Although texture unit objects are allocated & deallocated like the other
17// GL emulation objects they are derived from GrFakeRefObj to provide some
18// uniformity in how the GrDebugGL class manages resources
19class GrTextureUnitObj : public GrFakeRefObj {
20    GR_DEFINE_CREATOR(GrTextureUnitObj);
21
22public:
23    GrTextureUnitObj()
24        : GrFakeRefObj()
25        , fNumber(0)
26        , fTexture(NULL) {
27    }
28
29    void setNumber(GrGLenum number) {
30        fNumber = number;
31    }
32    GrGLenum getNumber() const { return fNumber; }
33
34    void setTexture(GrTextureObj *texture);
35    GrTextureObj *getTexture()                  { return fTexture; }
36
37protected:
38private:
39    GrGLenum fNumber;
40    GrTextureObj *fTexture;
41
42    typedef GrFakeRefObj INHERITED;
43};
44
45#endif // GrTextureUnitObj_DEFINED
46