• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

GnashTexture.h

Go to the documentation of this file.
00001 // GnashTexture.h: GnashImage class used for OpenGL rendering
00002 // 
00003 // Copyright (C) 2007, 2008, 2009, 2010 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(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, ImageType type);
00072     virtual ~GnashTexture();
00073 
00075     unsigned int flags() const
00076         { return _flags; }
00077 
00079     unsigned int width() const
00080         { return _width; }
00081 
00083     unsigned int height() const
00084         { return _height; }
00085 
00087     unsigned int texture() const
00088         { return _texture; }
00089 
00091     unsigned int internal_format() const
00092         { return _format.internal_format(); }
00093 
00095     unsigned int format() const
00096         { return _format.format(); }
00097 
00099     bool bind();
00100 
00102     void release();
00103 
00105     //
00111     void update(const boost::uint8_t *data);
00112 };
00113 
00114 } // gnash namespace
00115 
00116 #endif /* GNASH_GNASHTEXTURE_H */

Generated on Thu Sep 30 2010 14:34:58 for Gnash by  doxygen 1.7.1