Add initial test for case sensitiveness with mixed version
[gnash.git] / librender / Renderer_cairo.h
blob0a1a2ebc01162ff9409e3f72c70c67143cc08b59
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef BACKEND_RENDER_HANDLER_CAIRO_H
21 #define BACKEND_RENDER_HANDLER_CAIRO_H
23 #include <vector>
24 #include <boost/scoped_array.hpp>
25 #include <cairo/cairo.h>
26 #include "Renderer.h"
27 #include "Geometry.h"
29 namespace gnash {
30 class Transform;
31 class SWFCxForm;
34 namespace gnash {
36 typedef std::vector<Path> PathVec;
37 typedef std::vector<const Path*> PathPtrVec;
39 class DSOEXPORT Renderer_cairo: public Renderer
42 public:
43 Renderer_cairo();
44 ~Renderer_cairo();
46 std::string description() const { return "Cairo"; }
48 CachedBitmap* createCachedBitmap(std::auto_ptr<image::GnashImage> im);
50 void drawVideoFrame(image::GnashImage* baseframe, const Transform& xform,
51 const SWFRect* bounds, bool smooth);
53 geometry::Range2d<int> world_to_pixel(const SWFRect& worldbounds);
54 point pixel_to_world(int x, int y);
56 void set_color(const rgba& c);
58 void set_invalidated_regions(const InvalidatedRanges& ranges);
60 virtual Renderer* startInternalRender(image::GnashImage& /*im*/) {
61 return 0;
64 virtual void endInternalRender() {}
66 virtual void begin_display(const rgba& bg_color,
67 int viewport_width, int viewport_height,
68 float x0, float x1, float y0, float y1);
70 virtual void end_display();
72 void set_scale(float xscale, float yscale);
74 void set_translation(float xoff, float yoff);
76 void drawLine(const std::vector<point>& coords, const rgba& color,
77 const SWFMatrix& mat);
79 void draw_poly(const point* corners, size_t corner_count,
80 const rgba& fill, const rgba& outline,
81 const SWFMatrix& mat, bool masked);
83 void set_antialiased(bool enable);
85 void begin_submit_mask();
86 void end_submit_mask();
87 void disable_mask();
89 void add_path(cairo_t* cr, const Path& cur_path);
91 void apply_line_style(const LineStyle& style, const SWFCxForm& cx,
92 const SWFMatrix& mat);
94 void draw_outlines(const PathVec& path_vec,
95 const std::vector<LineStyle>& line_styles,
96 const SWFCxForm& cx,
97 const SWFMatrix& mat);
99 std::vector<PathVec::const_iterator> find_subshapes(const PathVec& path_vec);
101 void draw_subshape(const PathVec& path_vec,
102 const SWFMatrix& mat, const SWFCxForm& cx,
103 const std::vector<FillStyle>& FillStyles,
104 const std::vector<LineStyle>& line_styles);
106 void draw_mask(const PathVec& path_vec);
108 void add_paths(const PathVec& path_vec);
110 void apply_matrix_to_paths(std::vector<Path>& paths, const SWFMatrix& mat);
112 void drawShape(const SWF::ShapeRecord& shape, const Transform& xform);
114 void drawGlyph(const SWF::ShapeRecord& rec, const rgba& color,
115 const SWFMatrix& mat);
117 void set_context(cairo_t* context);
119 unsigned int getBitsPerPixel() const;
121 bool getPixel(rgba& color_return, int x, int y) const;
123 bool initTestBuffer(unsigned width, unsigned height);
125 private:
126 /// The cairo context.
127 cairo_t* _cr;
128 boost::scoped_array<boost::uint8_t> _video_buffer;
129 std::vector<PathVec> _masks;
130 size_t _video_bufsize;
131 bool _drawing_mask;
132 InvalidatedRanges _invalidated_ranges;
133 cairo_matrix_t _stage_mat;
138 namespace renderer {
140 /// Cairo renderer namespace
141 namespace cairo {
143 /// Create a render handler
144 gnash::Renderer* create_handler();
146 /// Make sure to call this before starting display
147 void set_context(Renderer* handler, cairo_t* context);
149 } // namespace gnash::renderer::cairo
150 } // namespace gnash::renderer
151 } // namespace gnash
153 #endif // BACKEND_RENDER_HANDLER_CAIRO_H