Gnash  0.8.10
GnashDevice.h
Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010. 2011, 2012
00003 //   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_DEVICE_H__
00021 #define __GNASH_DEVICE_H__ 1
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include "gnashconfig.h"
00025 #endif
00026 
00027 #include <boost/cstdint.hpp>
00028 #include "log.h"
00029 
00035 namespace gnash {
00036 
00037 namespace renderer {
00038 
00039 struct GnashDevice
00040 {
00043     typedef long native_window_t;
00044     
00046     typedef enum {OPENVG, OPENGL, OPENGLES1, OPENGLES2, XORG, VAAPI} rtype_t;
00048     typedef enum {NODEV, EGL, DIRECTFB, X11, RAWFB} dtype_t;
00049     
00050     GnashDevice(int argc, char *argv[]);
00051     GnashDevice() { };
00052     
00053     virtual ~GnashDevice() { };
00054 
00058     virtual dtype_t getType() = 0;
00059     
00062     virtual bool initDevice(int argc, char *argv[]) = 0;
00063 
00066     virtual bool attachWindow(native_window_t window) = 0;
00067     
00068     // Utility methods not in the base class
00069     
00071     virtual const char *getErrorString(int error) = 0;
00072     
00074     // int queryGNASHConfig() { return queryGNASHConfig(_gnashDisplay); };
00075     // int queryGNASHConfig(GNASHDisplay display);
00076 
00078     virtual size_t getStride() = 0;
00079  
00081     virtual size_t getWidth() = 0;
00082 
00084     virtual size_t getHeight() = 0;
00085 
00087     virtual int getDepth() = 0;
00088 
00090     virtual int getRedSize() = 0;
00091 
00093     virtual int getGreenSize() = 0;
00094 
00096     virtual int getBlueSize() = 0;
00097 
00099     virtual bool isSingleBuffered() = 0;
00100 
00102     virtual bool isBufferDestroyed() = 0;
00103 
00105     virtual int getID() = 0;
00106 
00108     virtual bool supportsRenderer(rtype_t rtype) = 0;
00109 
00111     virtual bool isNativeRender() = 0;
00112 
00113     // These are only used for the Framebuffer
00114 
00116     virtual boost::uint8_t *getFBMemory() { return 0; };
00117     
00119     virtual boost::uint8_t *getOffscreenBuffer() { return 0; };
00120 
00121     virtual size_t getFBMemSize() { return 0; };
00122 
00123     // bindClient() is used by OpenVG, OpenGLES1, and OpenGLES2
00124     // to bind the client type to the EGL surface. This method
00125     // is unused by the RawFB, DirectFB, and X11 Devices.
00126     virtual bool bindClient(GnashDevice::rtype_t) { return false; };
00127     
00128     virtual bool swapBuffers() {
00129         GNASH_REPORT_FUNCTION;
00130         return false;
00131     };
00132 };
00133     
00134 } // namespace renderer
00135 } // namespace gnash
00136 
00137 #endif  // end of __GNASH_DEVICE_H__
00138 
00139 // local Variables:
00140 // mode: C++
00141 // indent-tabs-mode: nil
00142 // End: