Gnash  0.8.11dev
Renderer_DirectFB.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software 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
18 
19 #ifndef GNASH_RENDER_HANDLER_DIRECTFB_H
20 #define GNASH_RENDER_HANDLER_DIRECTFB_H
21 
22 #ifdef HAVE_CONFIG_H
23 #include "gnashconfig.h"
24 #endif
25 
26 #include "Renderer.h"
27 #include "Geometry.h"
28 
29 #include <map>
30 #include <vector>
31 
32 #ifdef HAVE_DIRECTFB_H
33 # include <directfb/directfb.h>
34 #endif
35 
36 namespace gnash {
37 
38 class GnashImage;
39 class SWFCxForm;
40 
41 namespace renderer {
42 
43 namespace DirectFB {
44 
46 {
47 public:
48  std::string description() const { return "DirectFB"; }
51 
52  void init(float x, float y);
53  CachedBitmap *createCachedBitmap(std::unique_ptr<image::GnashImage> im);
54 
55  void world_to_pixel(int& x, int& y, float world_x, float world_y);
56  gnash::geometry::Range2d<int> world_to_pixel(const gnash::SWFRect& wb);
57  geometry::Range2d<int> world_to_pixel(const geometry::Range2d<float>& wb);
58  gnash::point pixel_to_world(int, int);
59 
60  void begin_display(const gnash::rgba&, int, int, float,
61  float, float, float);
62  // This is from the patch
63  // void begin_display(const rgba& bg_color, int viewport_x0,
64  // int viewport_y0, int viewport_width,
65  // int viewport_height, float x0, float x1,
66  // float y0, float y1);
67  void end_display();
68  void drawLine(const std::vector<point>& coords, const rgba& fill,
69  const SWFMatrix& mat);
70  void drawVideoFrame(gnash::image::GnashImage *frame, const gnash::Transform& tx,
71  const gnash::SWFRect *bounds, bool smooth);
72  void drawPoly(const point* corners, size_t corner_count,
73  const rgba& fill, const rgba& outline,
74  const SWFMatrix& mat, bool masked);
75  void drawShape(const gnash::SWF::ShapeRecord&, const gnash::Transform&);
76  void drawGlyph(const SWF::ShapeRecord& rec, const rgba& c,
77  const SWFMatrix& mat);
78 
79  void set_antialiased(bool enable);
80  void begin_submit_mask();
81  void end_submit_mask();
82  void apply_mask();
83  void disable_mask();
84 
85  void set_scale(float xscale, float yscale);
86  void set_invalidated_regions(const InvalidatedRanges &ranges);
87 
88  // These weren't in the patch
89  Renderer *startInternalRender(gnash::image::GnashImage&);
90  void endInternalRender();
91 
92  unsigned int getBitsPerPixel();
93  bool initTestBuffer(unsigned width, unsigned height);
94 
95  // These methods are only for debugging and development
96  void printVGParams();
98  void printVGPath();
99  private:
100  unsigned char *_testBuffer; // buffer used by initTestBuffer() only
101 };
102 
103 DSOEXPORT Renderer* create_handler(const char *pixelformat);
104 
105 } // namespace gnash::renderer::DirectFB
106 } // namespace gnash::renderer
107 } // namespace gnash
108 
109 #endif // __RENDER_HANDLER_DIRECTFB_H__
110 
111 // local Variables:
112 // mode: C++
113 // indent-tabs-mode: nil
114 // End:
gnash::geometry::SnappingRanges2d< std::int32_t >
gnash::geometry::Range2d< int >
gnash::renderer::DirectFB::Renderer_DirectFB::drawGlyph
void drawGlyph(const SWF::ShapeRecord &rec, const rgba &c, const SWFMatrix &mat)
Draws a glyph (font character).
Definition: Renderer_DirectFB.cpp:193
gnash::renderer::DirectFB::Renderer_DirectFB::world_to_pixel
void world_to_pixel(int &x, int &y, float world_x, float world_y)
Definition: Renderer_DirectFB.cpp:102
height
@ height
Definition: klash_part.cpp:329
ShapeRecord.h
gnash::renderer::DirectFB::Renderer_DirectFB::set_antialiased
void set_antialiased(bool enable)
Definition: Renderer_DirectFB.cpp:200
gnash::geometry::Range2d::getMaxY
T getMaxY() const
Get max Y ordinate.
Definition: Range2d.h:633
gnash::SWFRect::get_x_max
std::int32_t get_x_max() const
Get the x coordinate of the right-down corner.
Definition: SWFRect.h:122
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::rgba
A basic RGBA type.
Definition: RGBA.h:36
gnash::SWFMatrix::invert
SWFMatrix & invert()
Invert this SWFMatrix and return the result.
Definition: SWFMatrix.cpp:288
Renderer.h
Geometry.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::geometry::Range2d::getMaxX
T getMaxX() const
Get max X ordinate.
Definition: Range2d.h:613
gnash::SWFRect::is_null
bool is_null() const
returns true if this is a NULL rectangle
Definition: SWFRect.h:75
gnash::SWFRect::get_y_max
std::int32_t get_y_max() const
Get the y coordinate of the right-down corner.
Definition: SWFRect.h:136
gnash::image::GnashImage
Base class for different types of bitmaps.
Definition: GnashImage.h:78
GNASH_REPORT_FUNCTION
#define GNASH_REPORT_FUNCTION
Definition: log.h:452
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
utility.h
gnash::renderer::DirectFB::Renderer_DirectFB::startInternalRender
Renderer * startInternalRender(gnash::image::GnashImage &)
Setup the renderer to draw to an internal buffer.
Definition: Renderer_DirectFB.cpp:257
gnash::renderer::DirectFB::Renderer_DirectFB::~Renderer_DirectFB
~Renderer_DirectFB()
Definition: Renderer_DirectFB.cpp:74
gnash::geometry::worldRange
@ worldRange
A WORLD range2d is a range including all points on the plane.
Definition: Range2d.h:52
gnash::renderer::DirectFB::Renderer_DirectFB::drawShape
void drawShape(const gnash::SWF::ShapeRecord &, const gnash::Transform &)
Definition: Renderer_DirectFB.cpp:182
gnash::geometry::Range2d::getMinX
T getMinX() const
Get min X ordinate.
Definition: Range2d.h:603
Renderer_DirectFB.h
gnash::SWFRect::is_world
bool is_world() const
TODO: deprecate this 'world' concept.
Definition: SWFRect.h:87
gnash::renderer::DirectFB::Renderer_DirectFB::set_invalidated_regions
void set_invalidated_regions(const InvalidatedRanges &ranges)
Sets the update region (called prior to begin_display).
Definition: Renderer_DirectFB.cpp:236
GnashImage.h
gnash::renderer::DirectFB::Renderer_DirectFB::disable_mask
void disable_mask()
Definition: Renderer_DirectFB.cpp:220
gnash::geometry::Range2d::isNull
bool isNull() const
Returns true if this is the NULL Range2d.
Definition: Range2d.h:181
gnash::renderer::DirectFB::Renderer_DirectFB::Renderer_DirectFB
Renderer_DirectFB()
Definition: Renderer_DirectFB.cpp:70
gnash::SWFRect
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
gnash::renderer::DirectFB::Renderer_DirectFB::apply_mask
void apply_mask()
Definition: Renderer_DirectFB.cpp:215
gnash::key::t
@ t
Definition: GnashKey.h:166
gnash::renderer::DirectFB::Renderer_DirectFB::set_scale
void set_scale(float xscale, float yscale)
Sets the x/y scale for the movie
Definition: Renderer_DirectFB.cpp:225
gnash::geometry::Range2d::isWorld
bool isWorld() const
Returns true if this is the WORLD Range2d.
Definition: Range2d.h:200
fill
VGPaint fill
Definition: testr_gtk.cpp:86
gnash::SWFRect::get_x_min
std::int32_t get_x_min() const
Get the x coordinate of the left-up corner.
Definition: SWFRect.h:115
gnash::renderer::DirectFB::Renderer_DirectFB::printVGHardware
void printVGHardware()
gnash::SWFMatrix::transform
void transform(geometry::Point2d &p) const
Transform a given point by our SWFMatrix.
Definition: SWFMatrix.cpp:99
gnash::geometry::Range2d::getMinY
T getMinY() const
Get min Y ordinate.
Definition: Range2d.h:623
gnash::renderer::DirectFB::Renderer_DirectFB::description
std::string description() const
Return a description of this renderer.
Definition: Renderer_DirectFB.h:48
gnash::renderer::DirectFB::Renderer_DirectFB::endInternalRender
void endInternalRender()
Finish internal rendering.
Definition: Renderer_DirectFB.cpp:262
RGBA.h
gnash::key::p
@ p
Definition: GnashKey.h:162
gnash::renderer::DirectFB::Renderer_DirectFB::begin_display
void begin_display(const gnash::rgba &, int, int, float, float, float, float)
Bracket the displaying of a frame from a movie.
Definition: Renderer_DirectFB.cpp:156
gnash::geometry::nullRange
@ nullRange
A NULL range is a range enclosing NO points.
Definition: Range2d.h:43
GnashNumeric.h
gnash::SWFMatrix
Definition: SWFMatrix.h:54
gnash::geometry::Point2d
2D Point class
Definition: Point2d.h:39
gnash::renderer::DirectFB::Renderer_DirectFB::drawPoly
void drawPoly(const point *corners, size_t corner_count, const rgba &fill, const rgba &outline, const SWFMatrix &mat, bool masked)
Definition: Renderer_DirectFB.cpp:175
gnash::renderer::DirectFB::Renderer_DirectFB::end_submit_mask
void end_submit_mask()
Definition: Renderer_DirectFB.cpp:211
gnash::renderer::DirectFB::Renderer_DirectFB::drawLine
void drawLine(const std::vector< point > &coords, const rgba &fill, const SWFMatrix &mat)
Draw a line-strip directly, using a thin, solid line.
Definition: Renderer_DirectFB.cpp:169
gnash::renderer::DirectFB::Renderer_DirectFB::drawVideoFrame
void drawVideoFrame(gnash::image::GnashImage *frame, const gnash::Transform &tx, const gnash::SWFRect *bounds, bool smooth)
Draws a video frame.
Definition: Renderer_DirectFB.cpp:92
gnash::renderer::DirectFB::Renderer_DirectFB::getBitsPerPixel
unsigned int getBitsPerPixel()
log.h
gnash::renderer::DirectFB::Renderer_DirectFB::init
void init(float x, float y)
Definition: Renderer_DirectFB.cpp:80
gnash::key::f
@ f
Definition: GnashKey.h:152
gnashconfig.h
GnashTexture.h
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::renderer::DirectFB::Renderer_DirectFB::createCachedBitmap
CachedBitmap * createCachedBitmap(std::unique_ptr< image::GnashImage > im)
Given an image, returns a pointer to a CachedBitmap class that can later be passed to FillStyleX_bitm...
Definition: Renderer_DirectFB.cpp:86
DSOEXPORT
#define DSOEXPORT
Definition: dsodefs.h:55
gnash::renderer::DirectFB::Renderer_DirectFB::printVGPath
void printVGPath()
gnash::renderer::DirectFB::Renderer_DirectFB::printVGParams
void printVGParams()
gnash::renderer::DirectFB::Renderer_DirectFB::begin_submit_mask
void begin_submit_mask()
Definition: Renderer_DirectFB.cpp:206
gnash::SWF::ShapeRecord
Holds information needed to draw a shape.
Definition: ShapeRecord.h:127
gnash::renderer::DirectFB::Renderer_DirectFB::pixel_to_world
gnash::point pixel_to_world(int, int)
Definition: Renderer_DirectFB.cpp:145
gnash::renderer::DirectFB::Renderer_DirectFB
Definition: Renderer_DirectFB.h:46
gnash::Transform
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:34
width
@ width
Definition: klash_part.cpp:329
gnash::log_unimpl
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
gnash::renderer::DirectFB::Renderer_DirectFB::end_display
void end_display()
Definition: Renderer_DirectFB.cpp:163
gnash::CachedBitmap
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:38
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::renderer::DirectFB::create_handler
Renderer * create_handler(const char *pixelformat)
Definition: Renderer_DirectFB.cpp:267
gnash::geometry
Definition: Point2d.h:32
Range2d.h
gnash::SWFRect::get_y_min
std::int32_t get_y_min() const
Get the y coordinate of the left-up corner.
Definition: SWFRect.h:129
gnash::renderer::DirectFB::Renderer_DirectFB::initTestBuffer
bool initTestBuffer(unsigned width, unsigned height)
Definition: Renderer_DirectFB.cpp:241
SWFMatrix.h