Gnash  0.8.11dev
Renderer_agg.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 
20 #ifndef BACKEND_RENDER_HANDLER_AGG_H
21 #define BACKEND_RENDER_HANDLER_AGG_H
22 
23 #include "dsodefs.h"
24 #include "Renderer.h"
25 
26 namespace gnash {
27 
28 // Base class to shield GUIs from AGG's pixelformat classes
30 {
31 private:
32 
33  unsigned char *_testBuffer; // used by initTestBuffer() for testing
34 
35 public:
36 
37  Renderer_agg_base() : _testBuffer(nullptr) { }
38 
39  // virtual classes should have virtual destructors
40  virtual ~Renderer_agg_base() {
41  if ( _testBuffer ) free(_testBuffer);
42  }
43 
44  // these methods need to be accessed from outside:
45  virtual void init_buffer(unsigned char *mem, int size, int x, int y,
46  int rowstride) = 0;
47 
48  virtual unsigned int getBytesPerPixel() const = 0;
49 
50  unsigned int getBitsPerPixel() const { return getBytesPerPixel()*8; }
51 
52  virtual bool initTestBuffer(unsigned width, unsigned height) {
53  int size = width * height * getBytesPerPixel();
54 
55  unsigned char *tmp = static_cast<unsigned char *>(realloc(_testBuffer, size));
56  if (tmp == nullptr) {
57  log_error(_("Memory reallocation error"));
58  return false;
59  } else {
60  _testBuffer = tmp;
61  }
62 
63  memset(_testBuffer, 0, size);
64  printf("Renderer Test memory at: %p\n", _testBuffer);
65 
66  init_buffer(_testBuffer, size, width, height, width * getBytesPerPixel());
67 
68  return true;
69  }
70 };
71 
73 //
77 DSOEXPORT Renderer_agg_base *create_Renderer_agg(const char *pixelformat);
78 
83 DSOEXPORT const char *agg_detect_pixel_format(unsigned int rofs,
84  unsigned int rsize,
85  unsigned int gofs,
86  unsigned int gsize,
87  unsigned int bofs,
88  unsigned int bsize,
89  unsigned int bpp);
90 
91 
92 } // namespace gnash
93 
94 #endif // BACKEND_RENDER_HANDLER_AGG_H
95 
96 // Local Variables:
97 // mode: C++
98 // indent-tabs-mode: nil
99 // End:
Renderer_agg.h
gnash::Renderer_agg_base::getBitsPerPixel
unsigned int getBitsPerPixel() const
Definition: Renderer_agg.h:50
path
VGPath path
Definition: testr_gtk.cpp:84
gnash::CAP_NONE
@ CAP_NONE
Definition: LineStyle.h:39
gnash::geometry::Range2d< int >
gnash::create_Renderer_agg
DSOEXPORT Renderer_agg_base * create_Renderer_agg(const char *pixelformat)
Create a render handler.
Definition: Renderer_agg.cpp:2048
gnash::image::begin
pixel_iterator< T > begin(GnashImage &im)
Definition: ImageIterators.h:191
height
@ height
Definition: klash_part.cpp:329
ShapeRecord.h
gnash::key::d
@ d
Definition: GnashKey.h:150
gnash::rgba::m_r
std::uint8_t m_r
Definition: RGBA.h:113
gnash::QUALITY_BEST
@ QUALITY_BEST
Definition: GnashEnums.h:39
gnash::key::T
@ T
Definition: GnashKey.h:132
Renderer_agg_bitmap.h
gnash::Renderer::_render_images
RenderImages _render_images
Definition: Renderer.h:592
dsodefs.h
gnash::Renderer::RenderImage
std::shared_ptr< GnashVaapiImageProxy > RenderImage
Definition: Renderer.h:349
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::key::i
@ i
Definition: GnashKey.h:155
LOG_ONCE
#define LOG_ONCE(x)
Definition: log.h:49
gnash::rgba
A basic RGBA type.
Definition: RGBA.h:36
_
#define _(String)
Definition: log.h:44
Renderer.h
Transform.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::is_little_endian_host
bool is_little_endian_host()
Definition: Renderer_agg.cpp:2030
gnash::FileType
FileType
Definition: GnashEnums.h:25
gnash::ClipBounds
std::vector< geometry::Range2d< int > > ClipBounds
Definition: OpenVGRenderer.cpp:72
gnash::Renderer::world_to_pixel
geometry::Range2d< int > world_to_pixel(const geometry::Range2d< int > &wb) const
Definition: Renderer.h:388
gnash::rgba::m_g
std::uint8_t m_g
Definition: RGBA.h:113
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
gnash::key::s
@ s
Definition: GnashKey.h:165
gnash::Renderer_agg_base::init_buffer
virtual void init_buffer(unsigned char *mem, int size, int x, int y, int rowstride)=0
gnash::CAP_SQUARE
@ CAP_SQUARE
Definition: LineStyle.h:40
gnash::geometry::worldRange
@ worldRange
A WORLD range2d is a range including all points on the plane.
Definition: Range2d.h:52
gnash::QUALITY_MEDIUM
@ QUALITY_MEDIUM
Definition: GnashEnums.h:37
gnash::Renderer_agg_base::Renderer_agg_base
Renderer_agg_base()
Definition: Renderer_agg.h:37
gnash::SWF::ShapeRecord::Paths
Subshape::Paths Paths
Definition: ShapeRecord.h:131
gnash::JOIN_BEVEL
@ JOIN_BEVEL
Definition: LineStyle.h:45
GnashImage.h
gnash::twipsToPixels
double twipsToPixels(int i)
Definition: GnashNumeric.h:97
GnashEnums.h
SWFCxForm.h
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
CachedBitmap.h
gnash::SWF::ShapeRecord::LineStyles
Subshape::LineStyles LineStyles
Definition: ShapeRecord.h:130
gnash::geometry::Intersection
Range2d< T > Intersection(const Range2d< T > &r1, const Range2d< T > &r2)
Return a rectangle being the intersetion of the two rectangles.
Definition: Range2d.h:762
gnash::Renderer::pixel_to_world
geometry::Range2d< int > pixel_to_world(const geometry::Range2d< int > &pixelbounds) const
Definition: Renderer.h:399
gnash::key::t
@ t
Definition: GnashKey.h:166
color
const VGfloat color[4]
Definition: testr_gtk.cpp:82
fill
VGPaint fill
Definition: testr_gtk.cpp:86
gnash::SWF::ShapeRecord::FillStyles
Subshape::FillStyles FillStyles
Definition: ShapeRecord.h:129
gnash::Renderer_agg_base::getBytesPerPixel
virtual unsigned int getBytesPerPixel() const =0
gnash::renderer::opengl::for_each
void for_each(C &container, R(T::*pmf)(const A &), const A &arg)
Definition: Renderer_ogl.cpp:690
gnash::key::a
@ a
Definition: GnashKey.h:147
gnash::CAP_ROUND
@ CAP_ROUND
Definition: LineStyle.h:38
gnash::InvalidatedRanges
geometry::SnappingRanges2d< std::int32_t > InvalidatedRanges
Standard snapping 2d ranges type for invalidated bounds calculation
Definition: snappingrange.h:655
gnash::key::type
type
Definition: GnashKey.h:330
gnash::Renderer::world_to_pixel
virtual geometry::Range2d< int > world_to_pixel(const SWFRect &worldbounds) const =0
Converts world coordinates to pixel coordinates.
GnashVaapiImage.h
RGBA.h
gnash::key::p
@ p
Definition: GnashKey.h:162
gnash::point
geometry::Point2d point
Definition: Point2d.h:143
gnash::geometry::nullRange
@ nullRange
A NULL range is a range enclosing NO points.
Definition: Range2d.h:43
gnash::key::_1
@ _1
Definition: GnashKey.h:95
gnash::Renderer_agg_base::~Renderer_agg_base
virtual ~Renderer_agg_base()
Definition: Renderer_agg.h:40
gnash::JOIN_ROUND
@ JOIN_ROUND
Definition: LineStyle.h:44
gnash::agg_detect_pixel_format
DSOEXPORT const char * agg_detect_pixel_format(unsigned int rofs, unsigned int rsize, unsigned int gofs, unsigned int gsize, unsigned int bofs, unsigned int bsize, unsigned int bpp)
Definition: Renderer_agg.cpp:2109
GnashNumeric.h
gnash::JOIN_MITER
@ JOIN_MITER
Definition: LineStyle.h:46
gnash::SWFMatrix
Definition: SWFMatrix.h:54
gnash::rgba::m_a
std::uint8_t m_a
Definition: RGBA.h:113
gnash::QUALITY_HIGH
@ QUALITY_HIGH
Definition: GnashEnums.h:38
log.h
gnash::key::f
@ f
Definition: GnashKey.h:152
gnash::Renderer_agg_base
Definition: Renderer_agg.h:30
gnashconfig.h
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::image::TYPE_RGB
@ TYPE_RGB
Definition: GnashImage.h:49
gnash::QUALITY_LOW
@ QUALITY_LOW
Definition: GnashEnums.h:36
DSOEXPORT
#define DSOEXPORT
Definition: dsodefs.h:55
GnashVaapiImageProxy.h
gnash::rgba::m_b
std::uint8_t m_b
Definition: RGBA.h:113
gnash::Quality
Quality
Definition: GnashEnums.h:35
gnash::Renderer_agg_base::initTestBuffer
virtual bool initTestBuffer(unsigned width, unsigned height)
Definition: Renderer_agg.h:52
Renderer_agg_style.h
FillStyle.h
gnash::image::GNASH_IMAGE_GPU
@ GNASH_IMAGE_GPU
Definition: GnashImage.h:57
gnash::Path::transform
void transform(const SWFMatrix &mat)
Transform all path coordinates according to the given SWFMatrix.
Definition: Geometry.h:443
width
@ width
Definition: klash_part.cpp:329
gnash::log_unimpl
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
gnash::key::u
@ u
Definition: GnashKey.h:167
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::key::b
@ b
Definition: GnashKey.h:148
gnash::geometry
Definition: Point2d.h:32
test.v
v
Definition: test.py:11
IOChannel.h
gnash::image::Output::writeImageData
static DSOEXPORT void writeImageData(FileType type, std::shared_ptr< gnash::IOChannel > out, const GnashImage &image, int quality)
Write the given image to the given IOChannel in a specified format.
Definition: GnashImage.cpp:175
gnash::key::e
@ e
Definition: GnashKey.h:151
gnash::image::TYPE_RGBA
@ TYPE_RGBA
Definition: GnashImage.h:50
Range2d.h
gnash::fontlib::clear
void clear()
Clean up the font library.
Definition: fontlib.cpp:36
gnash::geometry::SnappingRanges2d::setWorld
void setWorld()
Resets to one range with world flags.
Definition: snappingrange.h:303
gnash::geometry::Intersect
bool Intersect(const Range2d< T > &r1, const Range2d< T > &r2)
Return true of the two ranges intersect (boundaries included)
Definition: Range2d.h:743