Gnash  0.8.10
Renderer_DirectFB.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 #ifndef GNASH_RENDER_HANDLER_DIRECTFB_H
00020 #define GNASH_RENDER_HANDLER_DIRECTFB_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025 
00026 #include "Renderer.h"
00027 #include "Geometry.h"
00028 
00029 #include <map>
00030 #include <vector>
00031 
00032 #ifdef HAVE_DIRECTFB_H
00033 # include <directfb/directfb.h>
00034 #endif
00035 
00036 namespace gnash {
00037 
00038 class GnashImage;
00039 class SWFCxForm;
00040 
00041 namespace renderer {
00042 
00043 namespace DirectFB {
00044 
00045 class  DSOEXPORT Renderer_DirectFB: public Renderer
00046 {
00047 public:
00048     std::string description() const { return "DirectFB"; }
00049     Renderer_DirectFB();
00050     ~Renderer_DirectFB();
00051         
00052     void init(float x, float y);
00053     CachedBitmap *createCachedBitmap(std::auto_ptr<image::GnashImage> im);
00054 
00055     void world_to_pixel(int& x, int& y, float world_x, float world_y);
00056     gnash::geometry::Range2d<int> world_to_pixel(const gnash::SWFRect& wb);
00057     geometry::Range2d<int> world_to_pixel(const geometry::Range2d<float>& wb);
00058     gnash::point pixel_to_world(int, int);
00059 
00060     void begin_display(const gnash::rgba&, int, int, float,
00061                                         float, float, float);
00062     // This is from the patch
00063     // void begin_display(const rgba& bg_color, int viewport_x0,
00064     //                    int viewport_y0, int viewport_width,
00065     //                    int viewport_height, float x0, float x1,
00066     //                    float y0, float y1);
00067     void end_display();
00068     void drawLine(const std::vector<point>& coords, const rgba& fill,
00069                   const SWFMatrix& mat);
00070     void drawVideoFrame(gnash::image::GnashImage *frame, const gnash::Transform& tx,
00071                         const gnash::SWFRect *bounds, bool smooth);
00072     void drawPoly(const point* corners, size_t corner_count, 
00073                   const rgba& fill, const rgba& outline,
00074                   const SWFMatrix& mat, bool masked);
00075     void drawShape(const gnash::SWF::ShapeRecord&, const gnash::Transform&);
00076     void drawGlyph(const SWF::ShapeRecord& rec, const rgba& c,
00077                    const SWFMatrix& mat);
00078 
00079     void set_antialiased(bool enable);
00080     void begin_submit_mask();
00081     void end_submit_mask();
00082     void apply_mask();
00083     void disable_mask();
00084         
00085     void set_scale(float xscale, float yscale);
00086     void set_invalidated_regions(const InvalidatedRanges &ranges);
00087 
00088     // These weren't in the patch
00089     Renderer *startInternalRender(gnash::image::GnashImage&);
00090     void endInternalRender();
00091 
00092     unsigned int getBitsPerPixel();
00093     bool initTestBuffer(unsigned width, unsigned height);
00094 
00095     // These methods are only for debugging and development
00096     void printVGParams();
00097     void printVGHardware();
00098     void printVGPath();
00099   private:
00100     unsigned char *_testBuffer; // buffer used by initTestBuffer() only
00101 };    
00102 
00103 DSOEXPORT Renderer* create_handler(const char *pixelformat);
00104 
00105 } // namespace gnash::renderer::DirectFB
00106 } // namespace gnash::renderer
00107 } // namespace gnash
00108 
00109 #endif // __RENDER_HANDLER_DIRECTFB_H__
00110 
00111 // local Variables:
00112 // mode: C++
00113 // indent-tabs-mode: nil
00114 // End: