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 
26 namespace gnash {
27 
29 enum {
30  GNASH_TEXTURE_VAAPI = 1 << 0
31 };
32 
35  unsigned int _internal_format;
36  unsigned int _format;
37 
38 public:
40 
42  unsigned int internal_format() const
43  { return _internal_format; }
44 
46  unsigned int format() const
47  { return _format; }
48 };
49 
52  unsigned int _width;
53  unsigned int _height;
54  unsigned int _texture;
55  GnashTextureFormat _format;
56 
58  struct TextureState {
59  unsigned int old_texture;
60  unsigned int was_enabled : 1;
61  unsigned int was_bound : 1;
62  } _texture_state;
63 
64 protected:
65  unsigned int _flags;
66 
67 private:
68  bool init();
69 
70 public:
71  GnashTexture(unsigned int width, unsigned int height,
73  virtual ~GnashTexture();
74 
76  unsigned int flags() const
77  { return _flags; }
78 
80  unsigned int width() const
81  { return _width; }
82 
84  unsigned int height() const
85  { return _height; }
86 
88  unsigned int texture() const
89  { return _texture; }
90 
92  unsigned int internal_format() const
93  { return _format.internal_format(); }
94 
96  unsigned int format() const
97  { return _format.format(); }
98 
100  bool bind();
101 
103  void release();
104 
106  //
112  void update(const std::uint8_t *data);
113 };
114 
115 } // gnash namespace
116 
117 #endif /* GNASH_GNASHTEXTURE_H */
name
std::string name
Definition: LocalConnection_as.cpp:149
height
@ height
Definition: klash_part.cpp:329
_
#define _(String)
Definition: log.h:44
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::GnashTexture::~GnashTexture
virtual ~GnashTexture()
Definition: GnashTexture.cpp:128
gnash::GnashTexture::release
void release()
Release texture.
Definition: GnashTexture.cpp:196
gnash::GnashTexture::flags
unsigned int flags() const
Return texture flags.
Definition: GnashTexture.h:76
gnash::key::n
@ n
Definition: GnashKey.h:160
gnash::GnashTexture::internal_format
unsigned int internal_format() const
Return GL internal format.
Definition: GnashTexture.h:92
GnashImage.h
ts
std::uint32_t ts
Definition: LocalConnection_as.cpp:150
gnash::GnashTexture::height
unsigned int height() const
Return texture height.
Definition: GnashTexture.h:84
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::GNASH_TEXTURE_VAAPI
@ GNASH_TEXTURE_VAAPI
Definition: GnashTexture.h:30
gnash::GnashTexture::_flags
unsigned int _flags
Definition: GnashTexture.h:65
bug
#define bug
Definition: GnashTexture.cpp:32
gnash::key::type
type
Definition: GnashKey.h:330
gnash::GnashTexture::bind
bool bind()
Bind texture to a texturing target.
Definition: GnashTexture.cpp:167
D
#define D(x)
Definition: GnashTexture.cpp:30
gnash::GnashTexture::GnashTexture
GnashTexture(unsigned int width, unsigned int height, image::ImageType type)
Definition: GnashTexture.cpp:114
gnash::GnashTexture::width
unsigned int width() const
Return texture width.
Definition: GnashTexture.h:80
gnash::GnashTextureFormat::internal_format
unsigned int internal_format() const
Return GL internal format.
Definition: GnashTexture.h:42
gnash::GnashTextureFormat::GnashTextureFormat
GnashTextureFormat(image::ImageType type)
Definition: GnashTexture.cpp:97
gnash::GnashTexture::texture
unsigned int texture() const
Return GL texture.
Definition: GnashTexture.h:88
gnash::GnashTexture
OpenGL texture abstraction.
Definition: GnashTexture.h:51
gnash::GnashTexture::format
unsigned int format() const
Return GL format.
Definition: GnashTexture.h:96
gnash::image::end
pixel_iterator< T > end(GnashImage &im)
Definition: ImageIterators.h:198
GnashTexture.h
gnash::GnashTextureFormat
OpenGL texture format.
Definition: GnashTexture.h:34
gnash::image::TYPE_RGB
@ TYPE_RGB
Definition: GnashImage.h:49
DSOEXPORT
#define DSOEXPORT
Definition: dsodefs.h:55
gnash::image::ImageType
ImageType
The types of images handled in Gnash.
Definition: GnashImage.h:47
gnash::GnashTextureFormat::format
unsigned int format() const
Return GL format.
Definition: GnashTexture.h:46
gnash::GnashTexture::update
void update(const std::uint8_t *data)
Copy texture data from a buffer.
Definition: GnashTexture.cpp:207
width
@ width
Definition: klash_part.cpp:329
data
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
gnash::image::TYPE_RGBA
@ TYPE_RGBA
Definition: GnashImage.h:50