00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software 00003 // 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 #include "aos4_glue.h" 00020 #include "gnash.h" 00021 #undef ACTION_END 00022 #include "Renderer.h" 00023 #include "Renderer_cairo.h" 00024 00025 #include <proto/intuition.h> 00026 #include <proto/graphics.h> 00027 #include <graphics/blitattr.h> 00028 #include <proto/Picasso96API.h> 00029 #include <proto/layers.h> 00030 #include <proto/dos.h> 00031 #include <proto/gadtools.h> 00032 00033 #include <cairo.h> 00034 00035 #include <boost/cstdint.hpp> // for boost::?int??_t 00036 #include <vector> 00037 00038 namespace gnash 00039 { 00040 class AOS4CairoGlue : public AOS4Glue 00041 { 00042 public: 00043 AOS4CairoGlue(); 00044 virtual ~AOS4CairoGlue(); 00045 00046 bool init(int argc, char **argv[]); 00047 Renderer *createRenderHandler(int depth); 00048 Renderer *createRenderHandler(); 00049 bool prepDrawingArea(int width, int height); 00050 void render(); 00051 void render(int minx, int miny, int maxx, int maxy); 00052 void setInvalidatedRegions(const InvalidatedRanges& ranges); 00053 struct Window *getWindow(void); 00054 struct Menu *getMenu(void); 00055 void setFullscreen(); 00056 void unsetFullscreen(); 00057 void resize(int width, int height); 00058 void saveOrigiginalDimension(int width, int height); 00059 private: 00060 geometry::Range2d<int> _validbounds; 00061 std::vector< geometry::Range2d<int> > _drawbounds; 00062 cairo_surface_t *_cairo_surface; 00063 cairo_t *_cairo_handle; 00064 unsigned char *_offscreenbuf; 00065 Renderer *_cairo_renderer; 00066 struct Window *_window; 00067 struct Screen *_screen; 00068 bool _fullscreen; 00069 int _width; 00070 int _orig_width; 00071 int _height; 00072 int _orig_height; 00073 int _stride; 00074 int _btype; 00075 cairo_format_t _ctype; 00076 struct Menu *_menu; 00077 RGBFTYPE _ftype; 00078 }; 00079 } 00080