Gnash  0.8.11dev
GnashTexture.h
Go to the documentation of this file.
1 // GnashTexture.h: GnashImage class used for OpenGL rendering
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 
21 #ifndef GNASH_GNASHTEXTURE_H
22 #define GNASH_GNASHTEXTURE_H
23 
24 #include "GnashImage.h"
25 #include <boost/shared_ptr.hpp>
26 
27 namespace gnash {
28 
30 enum {
32 };
33 
36  unsigned int _internal_format;
37  unsigned int _format;
38 
39 public:
41 
43  unsigned int internal_format() const
44  { return _internal_format; }
45 
47  unsigned int format() const
48  { return _format; }
49 };
50 
53  unsigned int _width;
54  unsigned int _height;
55  unsigned int _texture;
57 
59  struct TextureState {
60  unsigned int old_texture;
61  unsigned int was_enabled : 1;
62  unsigned int was_bound : 1;
63  } _texture_state;
64 
65 protected:
66  unsigned int _flags;
67 
68 private:
69  bool init();
70 
71 public:
72  GnashTexture(unsigned int width, unsigned int height,
74  virtual ~GnashTexture();
75 
77  unsigned int flags() const
78  { return _flags; }
79 
81  unsigned int width() const
82  { return _width; }
83 
85  unsigned int height() const
86  { return _height; }
87 
89  unsigned int texture() const
90  { return _texture; }
91 
93  unsigned int internal_format() const
94  { return _format.internal_format(); }
95 
97  unsigned int format() const
98  { return _format.format(); }
99 
101  bool bind();
102 
104  void release();
105 
107  //
113  void update(const boost::uint8_t *data);
114 };
115 
116 } // gnash namespace
117 
118 #endif /* GNASH_GNASHTEXTURE_H */