Gnash
0.8.10
|
00001 // GnashTexture.h: GnashImage class used for OpenGL rendering 00002 // 00003 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 00004 // Free Software Foundation, Inc. 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 // 00020 00021 #ifndef GNASH_GNASHTEXTURE_H 00022 #define GNASH_GNASHTEXTURE_H 00023 00024 #include "GnashImage.h" 00025 #include <boost/shared_ptr.hpp> 00026 00027 namespace gnash { 00028 00030 enum { 00031 GNASH_TEXTURE_VAAPI = 1 << 0 00032 }; 00033 00035 class DSOEXPORT GnashTextureFormat { 00036 unsigned int _internal_format; 00037 unsigned int _format; 00038 00039 public: 00040 GnashTextureFormat(image::ImageType type); 00041 00043 unsigned int internal_format() const 00044 { return _internal_format; } 00045 00047 unsigned int format() const 00048 { return _format; } 00049 }; 00050 00052 class DSOEXPORT GnashTexture { 00053 unsigned int _width; 00054 unsigned int _height; 00055 unsigned int _texture; 00056 GnashTextureFormat _format; 00057 00059 struct TextureState { 00060 unsigned int old_texture; 00061 unsigned int was_enabled : 1; 00062 unsigned int was_bound : 1; 00063 } _texture_state; 00064 00065 protected: 00066 unsigned int _flags; 00067 00068 private: 00069 bool init(); 00070 00071 public: 00072 GnashTexture(unsigned int width, unsigned int height, 00073 image::ImageType type); 00074 virtual ~GnashTexture(); 00075 00077 unsigned int flags() const 00078 { return _flags; } 00079 00081 unsigned int width() const 00082 { return _width; } 00083 00085 unsigned int height() const 00086 { return _height; } 00087 00089 unsigned int texture() const 00090 { return _texture; } 00091 00093 unsigned int internal_format() const 00094 { return _format.internal_format(); } 00095 00097 unsigned int format() const 00098 { return _format.format(); } 00099 00101 bool bind(); 00102 00104 void release(); 00105 00107 // 00113 void update(const boost::uint8_t *data); 00114 }; 00115 00116 } // gnash namespace 00117 00118 #endif /* GNASH_GNASHTEXTURE_H */