Gnash  0.8.11dev
sdl_agg_glue.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 // 2011 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 #include "sdl_glue.h"
20 
21 #include <vector>
22 #include <SDL.h>
23 #include <cstdint> // for boost::?int??_t
24 
25 namespace gnash
26 {
27 
28 class SdlAggGlue : public SdlGlue
29 {
30  public:
31  SdlAggGlue();
32  virtual ~SdlAggGlue();
33 
34  bool init(int argc, char **argv[]);
35  Renderer* createRenderHandler(int depth);
36  void setInvalidatedRegions(const InvalidatedRanges& ranges);
37  bool prepDrawingArea(int width, int height, std::uint32_t sdl_flags);
38  std::uint32_t maskFlags(std::uint32_t sdl_flags);
39  void render();
40  void render(int minx, int miny, int maxx, int maxy);
41  private:
42  SDL_Surface *_sdl_surface;
43  unsigned char *_offscreenbuf;
44  SDL_Surface *_screen;
45  Renderer *_agg_renderer;
46 
47  geometry::Range2d<int> _validbounds;
48  std::vector< geometry::Range2d<int> > _drawbounds;
49 };
50 
51 }
gnash::geometry::SnappingRanges2d< std::int32_t >
Renderer_agg.h
gnash::key::GNASH_MOD_CONTROL
@ GNASH_MOD_CONTROL
Definition: GnashKey.h:37
sdl_glue.h
gnash::geometry::Range2d< int >
gnash::Renderer::set_invalidated_regions
virtual void set_invalidated_regions(const InvalidatedRanges &)
Sets the update region (called prior to begin_display).
Definition: Renderer.h:340
gnash::key::DOWN
@ DOWN
Definition: GnashKey.h:207
gnash::Gui::_renderer
std::shared_ptr< Renderer > _renderer
The handler which is called to update the client area of our window.
Definition: gui.h:506
gnash::create_Renderer_agg
DSOEXPORT Renderer_agg_base * create_Renderer_agg(const char *pixelformat)
Create a render handler.
Definition: Renderer_agg.cpp:2048
height
@ height
Definition: klash_part.cpp:329
gnash::SDLGui::disableCoreTrap
virtual void disableCoreTrap()
Definition: sdl.cpp:200
gnash::geometry::Range2d::getMaxY
T getMaxY() const
Get max Y ordinate.
Definition: Range2d.h:633
gnash::SdlAggGlue::init
bool init(int argc, char **argv[])
Definition: sdl_agg_glue.cpp:52
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
_
#define _(String)
Definition: log.h:44
Renderer.h
gnash::key::modifier
modifier
Definition: GnashKey.h:34
gnash::SDLGui::run
virtual bool run()
Start main rendering loop.
Definition: sdl.cpp:49
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::Gui
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
gnash::geometry::Range2d::getMaxX
T getMaxX() const
Get max X ordinate.
Definition: Range2d.h:613
sdl_agg_glue.h
gnash::key::CONTROL
@ CONTROL
Definition: GnashKey.h:62
gnash::SdlAggGlue
Definition: sdl_agg_glue.h:29
gnash::key::F1
@ F1
Definition: GnashKey.h:190
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
gnash::key::GNASH_MOD_NONE
@ GNASH_MOD_NONE
Definition: GnashKey.h:35
gnash::Renderer_agg_base::init_buffer
virtual void init_buffer(unsigned char *mem, int size, int x, int y, int rowstride)=0
gnash::SdlAggGlue::maskFlags
std::uint32_t maskFlags(std::uint32_t sdl_flags)
gnash::SDLGui::createMenu
virtual bool createMenu()
Definition: sdl.cpp:225
gnash::geometry::Range2d::getMinX
T getMinX() const
Get min X ordinate.
Definition: Range2d.h:603
gnash::SDLGui::~SDLGui
virtual ~SDLGui()
Definition: sdl.cpp:44
gnash::SDLGui::createWindow
virtual bool createWindow(const char *title, int width, int height, int xPosition=0, int yPosition=0)
Create and display our window.
Definition: sdl.cpp:174
gnash::key::KP_0
@ KP_0
Definition: GnashKey.h:179
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::geometry::Range2d::isNull
bool isNull() const
Returns true if this is the NULL Range2d.
Definition: Range2d.h:181
gnash::key::PGUP
@ PGUP
Definition: GnashKey.h:213
gnash::Gui::_runResources
RunResources & _runResources
Per-run resources.
Definition: gui.h:500
gnash::RunResources::setRenderer
void setRenderer(std::shared_ptr< Renderer > r)
Definition: RunResources.h:108
gnash::key::LEFT
@ LEFT
Definition: GnashKey.h:209
gnash::key::RIGHT
@ RIGHT
Definition: GnashKey.h:208
gnash::Gui::notifyMouseClick
void notifyMouseClick(bool mouse_pressed)
Mouse notification callback to be called when the mouse is clicked.
Definition: gui.cpp:531
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::key::r
@ r
Definition: GnashKey.h:164
gnash::key::GNASH_MOD_SHIFT
@ GNASH_MOD_SHIFT
Definition: GnashKey.h:36
gnash::key::INSERT
@ INSERT
Definition: GnashKey.h:210
gnash::key::ALT
@ ALT
Definition: GnashKey.h:63
gnash::key::PGDN
@ PGDN
Definition: GnashKey.h:214
gnash::key::END
@ END
Definition: GnashKey.h:212
gnash::Renderer::world_to_pixel
virtual geometry::Range2d< int > world_to_pixel(const SWFRect &worldbounds) const =0
Converts world coordinates to pixel coordinates.
gnash::SdlAggGlue::createRenderHandler
Renderer * createRenderHandler(int depth)
Definition: sdl_agg_glue.cpp:61
gnash::key::code
code
Definition: GnashKey.h:44
gnash::geometry::Range2d::getMinY
T getMinY() const
Get min Y ordinate.
Definition: Range2d.h:623
gnash::SDLGui::key_event
void key_event(SDL_KeyboardEvent *key, bool down)
Definition: sdl.cpp:294
gnash::Gui::notifyMouseMove
void notifyMouseMove(int x, int y)
Mouse notification callback to be called when the mouse is moved.
Definition: gui.cpp:469
gnash::Gui::_width
int _width
Desired window width.
Definition: gui.h:494
gnash::SdlAggGlue::prepDrawingArea
bool prepDrawingArea(int width, int height, std::uint32_t sdl_flags)
Definition: sdl_agg_glue.cpp:86
gnash::key::INVALID
@ INVALID
Definition: GnashKey.h:45
gnash::key::SHIFT
@ SHIFT
Definition: GnashKey.h:61
gnash::key::UP
@ UP
Definition: GnashKey.h:206
gnash::key::HOME
@ HOME
Definition: GnashKey.h:211
gnash::SDLGui::setInvalidatedRegions
void setInvalidatedRegions(const InvalidatedRanges &ranges)
Definition: sdl.cpp:207
gnash::SdlAggGlue::render
void render()
Definition: sdl_agg_glue.cpp:174
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
gnash::geometry::SnappingRanges2d::size
size_type size() const
Returns the number of ranges in the list.
Definition: snappingrange.h:320
gnash::SDLGui::setupEvents
virtual bool setupEvents()
Definition: sdl.cpp:231
gnash::SDLGui::init
virtual bool init(int argc, char **argv[])
/ Initialise the gui and the associated renderer.
Definition: sdl.cpp:141
log.h
gnash::SdlGlue
Definition: sdl_glue.h:26
gnash::SDLGui::setInterval
virtual void setInterval(unsigned int interval)
Set main loop delay in milliseconds.
Definition: sdl.cpp:219
gnash::SdlAggGlue::SdlAggGlue
SdlAggGlue()
Definition: sdl_agg_glue.cpp:33
gnash::Renderer_agg_base
Definition: Renderer_agg.h:30
gnashconfig.h
RunResources.h
gnash::Gui::_xid
unsigned long _xid
The X Window ID to attach to. If zero, we create a new window.
Definition: gui.h:486
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::SDLGui::renderBuffer
virtual void renderBuffer()
Definition: sdl.cpp:213
gnash::geometry::Range2d::setTo
Range2d< T > & setTo(T x, T y)
Set ourself to bound the given point.
Definition: Range2d.h:339
gnash::Gui::_interval
unsigned int _interval
Main loop interval: the time between successive advance_movie calls.
Definition: gui.h:503
gnash::SdlGlue::_bpp
int _bpp
Definition: sdl_glue.h:36
gnash::key::GNASH_MOD_ALT
@ GNASH_MOD_ALT
Definition: GnashKey.h:38
CHUNK_SIZE
#define CHUNK_SIZE
gnash::Gui::notify_key_event
void notify_key_event(gnash::key::code k, int modifier, bool pressed)
Key event notification to be called when a key is pressed or depressed.
Definition: gui.cpp:560
gnash::geometry::SnappingRanges2d::getRange
const RangeType & getRange(size_type index) const
Returns the range at the specified index.
Definition: snappingrange.h:326
gnash::SDLGui::setTimeout
virtual void setTimeout(unsigned int timeout)
Set the time in milliseconds after which the programme should exit.
Definition: sdl.cpp:135
width
@ width
Definition: klash_part.cpp:329
sdlsup.h
gnash::Gui::advanceMovie
bool advanceMovie(bool doDisplay=true)
Give movie an heart-beat.
Definition: gui.cpp:935
gnash::Gui::_height
int _height
Desired window height.
Definition: gui.h:497
gnash::SdlAggGlue::setInvalidatedRegions
void setInvalidatedRegions(const InvalidatedRanges &ranges)
Modified from fb_gui.
Definition: sdl_agg_glue.cpp:155
Range2d.h
gnash::SdlAggGlue::~SdlAggGlue
virtual ~SdlAggGlue()
Definition: sdl_agg_glue.cpp:43