[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10882: Implement partial blitting (
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10882: Implement partial blitting (inv.bounds based) for SDL/AGG combination |
Date: |
Tue, 19 May 2009 10:19:31 +0200 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 10882
author: Wei Cao <address@hidden>
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Tue 2009-05-19 10:19:31 +0200
message:
Implement partial blitting (inv.bounds based) for SDL/AGG combination
modified:
gui/sdl.cpp
gui/sdl_agg_glue.cpp
gui/sdl_agg_glue.h
gui/sdl_cairo_glue.cpp
gui/sdl_cairo_glue.h
gui/sdl_glue.h
gui/sdl_ogl_glue.cpp
gui/sdl_ogl_glue.h
gui/sdlsup.h
=== modified file 'gui/sdl.cpp'
--- a/gui/sdl.cpp 2009-05-15 10:36:51 +0000
+++ b/gui/sdl.cpp 2009-05-19 08:19:31 +0000
@@ -225,6 +225,12 @@
}
void
+SDLGui::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+ _glue.setInvalidatedRegions(ranges);
+}
+
+void
SDLGui::renderBuffer()
{
//GNASH_REPORT_FUNCTION;
=== modified file 'gui/sdl_agg_glue.cpp'
--- a/gui/sdl_agg_glue.cpp 2009-02-25 22:33:03 +0000
+++ b/gui/sdl_agg_glue.cpp 2009-05-19 08:19:31 +0000
@@ -143,21 +143,42 @@
_sdl_surface = SDL_CreateRGBSurfaceFrom((void *) _offscreenbuf, width,
height,
_bpp, stride, rmask, gmask, bmask,
amask);
assert(_sdl_surface);
-
+
+ _validbounds.setTo(0, 0, width-1, height-1);
+
return true;
}
+/// Modified from fb_gui
+void
+SdlAggGlue::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+ _agg_renderer->set_invalidated_regions(ranges);
+ _drawbounds.clear();
+
+ for (unsigned int rno=0; rno<ranges.size(); rno++) {
+ geometry::Range2d<int> bounds = Intersection(
+ // twips changed to pixels here
+ _agg_renderer->world_to_pixel(ranges.getRange(rno)),
+ _validbounds);
+
+ // it may happen that a particular range is out of the screen, which
+ // will lead to bounds==null.
+ if (bounds.isNull()) continue;
+ _drawbounds.push_back(bounds);
+ }
+}
+
void
SdlAggGlue::render()
{
- rect bounds;
- bounds.set_world();
+ if ( _drawbounds.size() == 0 ) return; // nothing to do..
- _agg_renderer->set_invalidated_region(bounds);
-
- // Update the entire screen
- SDL_BlitSurface(_sdl_surface, 0, _screen, 0);
- SDL_UpdateRect(_screen, 0, 0, 0, 0);
+ for (unsigned int bno=0; bno < _drawbounds.size(); bno++) {
+ geometry::Range2d<int>& bounds = _drawbounds[bno];
+ render(bounds.getMinX(), bounds.getMinY(),
+ bounds.getMaxX(), bounds.getMaxY() );
+ }
}
void
@@ -167,7 +188,7 @@
SDL_Rect clip = { minx, miny, maxx - minx, maxy - miny };
SDL_SetClipRect(_screen, &clip);
SDL_BlitSurface(_sdl_surface, 0, _screen, 0);
- SDL_UpdateRect(_sdl_surface, clip.x, clip.y, clip.w, clip.h);
+ SDL_UpdateRect(_screen, clip.x, clip.y, clip.w, clip.h);
}
} // namespace gnash
=== modified file 'gui/sdl_agg_glue.h'
--- a/gui/sdl_agg_glue.h 2009-02-25 22:33:03 +0000
+++ b/gui/sdl_agg_glue.h 2009-05-19 08:19:31 +0000
@@ -31,6 +31,7 @@
bool init(int argc, char **argv[]);
render_handler* createRenderHandler(int depth);
+ void setInvalidatedRegions(const InvalidatedRanges& ranges);
bool prepDrawingArea(int width, int height, boost::uint32_t sdl_flags);
boost::uint32_t maskFlags(boost::uint32_t sdl_flags);
void render();
@@ -40,6 +41,9 @@
unsigned char *_offscreenbuf;
SDL_Surface *_screen;
render_handler *_agg_renderer;
+
+ geometry::Range2d<int> _validbounds;
+ std::vector< geometry::Range2d<int> > _drawbounds;
};
}
=== modified file 'gui/sdl_cairo_glue.cpp'
--- a/gui/sdl_cairo_glue.cpp 2009-02-25 22:33:03 +0000
+++ b/gui/sdl_cairo_glue.cpp 2009-05-19 08:19:31 +0000
@@ -58,6 +58,11 @@
}
+/// Not implemented, Fixme
+void
+SdlCairoGlue::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+}
bool
SdlCairoGlue::prepDrawingArea(int width, int height, boost::uint32_t sdl_flags)
=== modified file 'gui/sdl_cairo_glue.h'
--- a/gui/sdl_cairo_glue.h 2009-02-25 22:33:03 +0000
+++ b/gui/sdl_cairo_glue.h 2009-05-19 08:19:31 +0000
@@ -31,6 +31,7 @@
bool init(int argc, char **argv[]);
render_handler* createRenderHandler( int depth);
+ void setInvalidatedRegions(const InvalidatedRanges& ranges);
bool prepDrawingArea(int width, int height, boost::uint32_t sdl_flags);
boost::uint32_t maskFlags(boost::uint32_t sdl_flags);
void render();
=== modified file 'gui/sdl_glue.h'
--- a/gui/sdl_glue.h 2009-02-25 22:33:03 +0000
+++ b/gui/sdl_glue.h 2009-05-19 08:19:31 +0000
@@ -16,6 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "gnash.h"
+#include "gui.h"
#include <boost/cstdint.hpp> // for boost::?int??_t
@@ -27,7 +28,8 @@
public:
virtual ~SdlGlue() { }
virtual bool init(int argc, char **argv[]) = 0;
-
+
+ virtual void setInvalidatedRegions(const InvalidatedRanges& ranges) = 0;
virtual bool prepDrawingArea(int width, int height, boost::uint32_t
sdl_flags) = 0;
virtual render_handler* createRenderHandler(int depth) = 0;
virtual void render() = 0;
=== modified file 'gui/sdl_ogl_glue.cpp'
--- a/gui/sdl_ogl_glue.cpp 2009-02-25 22:33:03 +0000
+++ b/gui/sdl_ogl_glue.cpp 2009-05-19 08:19:31 +0000
@@ -78,6 +78,12 @@
return renderer;
}
+/// Not implemented, Fixme
+void
+SdlOglGlue::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+}
+
bool
SdlOglGlue::prepDrawingArea(int width, int height, boost::uint32_t sdl_flags)
{
=== modified file 'gui/sdl_ogl_glue.h'
--- a/gui/sdl_ogl_glue.h 2009-02-25 22:33:03 +0000
+++ b/gui/sdl_ogl_glue.h 2009-05-19 08:19:31 +0000
@@ -30,6 +30,7 @@
bool init(int argc, char ***argv);
render_handler* createRenderHandler( int depth);
+ void setInvalidatedRegions(const InvalidatedRanges& ranges);
bool prepDrawingArea(int width, int height, boost::uint32_t sdl_flags);
void render();
private:
=== modified file 'gui/sdlsup.h'
--- a/gui/sdlsup.h 2009-05-15 10:36:51 +0000
+++ b/gui/sdlsup.h 2009-05-19 08:19:31 +0000
@@ -54,6 +54,7 @@
virtual bool run();
virtual bool createMenu();
virtual bool setupEvents();
+ virtual void setInvalidatedRegions(const InvalidatedRanges& ranges);
virtual void renderBuffer();
virtual void setInterval(unsigned int interval);
virtual void disableCoreTrap();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10882: Implement partial blitting (inv.bounds based) for SDL/AGG combination,
Sandro Santilli <=