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