[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog backend/render_handler.h backen...
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog backend/render_handler.h backen... |
Date: |
Sun, 22 Oct 2006 22:53:28 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 06/10/22 22:53:28
Modified files:
. : ChangeLog
backend : render_handler.h render_handler_agg.cpp
gui : gtk.cpp gtk_glue.h gtk_glue_agg.cpp
gtk_glue_agg.h gtksup.h gui.cpp gui.h
sdl_agg_glue.cpp sdl_agg_glue.h
Log message:
* backend/render_handler.h: Add get_invalidated_region().
* backend/render_handler_agg.cpp: Implement
get_invalidated_region().
* gui/{gtk.cpp, gtk_glue_agg.cpp, gtk_glue_agg.h, gtksup.h,
gui.cpp,
gui.h}: Remove duplicate implementation of
set_invalidated_region();
instead, call get_invalidate_region() from the relevant glue.
Call
render_handler::set_invalidated_region() directly instead of
the Gui
implementation.
* gui/sdl_agg_glue{.cpp, .h}: Implement region clipping based
rendering.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1349&r2=1.1350
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_agg.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_agg.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl_agg_glue.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl_agg_glue.h?cvsroot=gnash&r1=1.1&r2=1.2
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1349
retrieving revision 1.1350
diff -u -b -r1.1349 -r1.1350
--- ChangeLog 22 Oct 2006 19:36:50 -0000 1.1349
+++ ChangeLog 22 Oct 2006 22:53:27 -0000 1.1350
@@ -8,6 +8,15 @@
* gui/{gui.h, sdl.cpp}: Gui::init() should return true on success.
Document this in gui.h and implement it in sdl.cpp.
* gui/Player.cpp: Remove obsolete comment.
+ * backend/render_handler.h: Add get_invalidated_region().
+ * backend/render_handler_agg.cpp: Implement get_invalidated_region().
+ * gui/{gtk.cpp, gtk_glue_agg.cpp, gtk_glue_agg.h, gtksup.h, gui.cpp,
+ gui.h}: Remove duplicate implementation of set_invalidated_region();
+ instead, call get_invalidate_region() from the relevant glue. Call
+ render_handler::set_invalidated_region() directly instead of the Gui
+ implementation.
+ * gui/sdl_agg_glue{.cpp, .h}: Implement region clipping based
+ rendering.
2006-10-22 Rob Savoye <address@hidden>
Index: backend/render_handler.h
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- backend/render_handler.h 16 Oct 2006 17:31:14 -0000 1.15
+++ backend/render_handler.h 22 Oct 2006 22:53:28 -0000 1.16
@@ -35,7 +35,7 @@
//
//
-/* $Id: render_handler.h,v 1.15 2006/10/16 17:31:14 udog Exp $ */
+/* $Id: render_handler.h,v 1.16 2006/10/22 22:53:28 bjacques Exp $ */
#ifndef RENDER_HANDLER_H
#define RENDER_HANDLER_H
@@ -270,6 +270,12 @@
// implementation is optional
}
+ /// Sets the passed integers to the invalidated region coordinates.
+ virtual void get_invalidated_region(int& /*xmin*/, int& /*ymin*/,
+ int& /*xmax*/, int& /*ymax*/) {
+
+ }
+
/// Converts world coordinates to pixel coordinates
virtual void world_to_pixel(int *x, int *y, const float world_x,
const float world_y) = 0;
Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- backend/render_handler_agg.cpp 18 Oct 2006 15:40:47 -0000 1.25
+++ backend/render_handler_agg.cpp 22 Oct 2006 22:53:28 -0000 1.26
@@ -34,7 +34,7 @@
// forward this exception.
-/* $Id: render_handler_agg.cpp,v 1.25 2006/10/18 15:40:47 strk Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.26 2006/10/22 22:53:28 bjacques Exp $ */
// Original version by Udo Giacomozzi and Hannes Mayr,
// INDUNET GmbH (www.indunet.it)
@@ -1308,6 +1308,13 @@
}
+ virtual void get_invalidated_region(int& xmin, int& ymin, int& xmax, int&
ymax) {
+ xmin = m_clip_xmin;
+ ymin = m_clip_ymin;
+ xmax = m_clip_xmax;
+ ymax = m_clip_ymax;
+ }
+
void get_pixel(rgba& color_return, float world_x, float world_y) {
int x, y;
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- gui/gtk.cpp 22 Oct 2006 17:45:42 -0000 1.42
+++ gui/gtk.cpp 22 Oct 2006 22:53:28 -0000 1.43
@@ -47,6 +47,7 @@
#include "rc.h"
#include "gtksup.h"
#include "render_handler.h"
+#include "render.h"
#include <iostream>
#include <X11/keysym.h>
@@ -218,55 +219,7 @@
void
GtkGui::renderBuffer()
{
- glue.render(m_draw_minx, m_draw_miny, m_draw_maxx, m_draw_maxy);
-}
-
-int
-GtkGui::valid_coord(int coord, int max)
-{
- if (coord<0) return 0;
- else if (coord>=max) return max;
- return coord;
-}
-
-void
-GtkGui::set_invalidated_region(const rect& bounds)
-{
-#ifdef RENDERER_AGG
- // forward to renderer
- _renderer->set_invalidated_region(bounds);
-
- if ( bounds.width() > 1e10f ) {
- // Region is entire screen. Don't convert to integer as this will overflow.
-
- m_draw_minx=0;
- m_draw_miny=0;
- m_draw_maxx=_width-1;
- m_draw_maxy=_height-1;
-
- } else {
-
- // remember for renderBuffer()
- _renderer->world_to_pixel(&m_draw_minx, &m_draw_miny, bounds.get_x_min(),
bounds.get_y_min());
- _renderer->world_to_pixel(&m_draw_maxx, &m_draw_maxy, bounds.get_x_max(),
bounds.get_y_max());
-
- // add two pixels because of anti-aliasing...
- m_draw_minx = valid_coord(m_draw_minx-2, _width);
- m_draw_miny = valid_coord(m_draw_miny-2, _height);
- m_draw_maxx = valid_coord(m_draw_maxx+2, _width);
- m_draw_maxy = valid_coord(m_draw_maxy+2, _height);
-
- }
-
- /*
- log_msg("GtkGui::set_invalidated_region pixel: x1:%i, y1:%i, x2:%i,
y2:%i\n", \
- m_draw_minx,
- m_draw_miny, \
- m_draw_maxx, \
- m_draw_maxy \
- );
- */
-#endif
+ glue.render();
}
void
@@ -576,7 +529,7 @@
// (look at the GdkEventExpose)
rect draw_bounds(-1e10f, -1e10f, +1e10f, +1e10f);
- gui->set_invalidated_region(draw_bounds);
+ get_render_handler()->set_invalidated_region(draw_bounds);
gui->renderBuffer();
Index: gui/gtk_glue.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk_glue.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gui/gtk_glue.h 16 Oct 2006 10:01:05 -0000 1.5
+++ gui/gtk_glue.h 22 Oct 2006 22:53:28 -0000 1.6
@@ -53,8 +53,6 @@
virtual render_handler* createRenderHandler() = 0;
virtual void setRenderHandlerSize(int /*width*/, int /*height*/) { };
virtual void render() = 0;
- virtual void render(int /*minx*/, int /*miny*/, int /*maxx*/, int /*maxy*/)
- { render(); };
virtual void configure(GtkWidget *const widget,
GdkEventConfigure *const event) = 0;
protected:
Index: gui/gtk_glue_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk_glue_agg.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gui/gtk_glue_agg.cpp 16 Oct 2006 14:36:22 -0000 1.5
+++ gui/gtk_glue_agg.cpp 22 Oct 2006 22:53:28 -0000 1.6
@@ -35,7 +35,7 @@
//
//
-/* $Id: gtk_glue_agg.cpp,v 1.5 2006/10/16 14:36:22 bik Exp $ */
+/* $Id: gtk_glue_agg.cpp,v 1.6 2006/10/22 22:53:28 bjacques Exp $ */
#include <cstdio>
#include <cerrno>
@@ -166,37 +166,39 @@
// it here.
}
-void
-GtkAggGlue::render()
+static int
+valid_coord(int coord, int max)
{
- // Update the entire screen
- gdk_draw_rgb_image (
- _drawing_area->window,
- _drawing_area->style->fg_gc[GTK_STATE_NORMAL],
- 0,
- 0,
- _width,
- _height,
- GDK_RGB_DITHER_NONE,
- _offscreenbuf,
- (int)(_width*_bpp/8)
- );
+ if (coord<0) return 0;
+ else if (coord>=max) return max;
+
+ return coord;
}
+
void
-GtkAggGlue::render(int minx, int miny, int maxx, int maxy)
+GtkAggGlue::render()
{
+ int xmin, ymin, xmax, ymax;
+ _agg_renderer->get_invalidated_region(xmin, ymin, xmax, ymax);
+
+ // add two pixels because of anti-aliasing...
+ xmin = valid_coord(xmin-2, _width);
+ ymin = valid_coord(ymin-2, _height);
+ xmax = valid_coord(xmax+2, _width);
+ ymax = valid_coord(ymax+2, _height);
+
// Update only the invalidated rectangle
gdk_draw_rgb_image (
_drawing_area->window,
_drawing_area->style->fg_gc[GTK_STATE_NORMAL],
- minx,
- miny,
- maxx-minx,
- maxy-miny,
+ xmin,
+ ymin,
+ xmax - xmin,
+ ymax - ymin,
GDK_RGB_DITHER_NONE,
- _offscreenbuf + miny*(_width*(_bpp/8)) + minx*(_bpp/8),
- (int)((_width)*_bpp/8)
+ _offscreenbuf + ymin*(_width*(_bpp/8)) + xmin*(_bpp/8),
+ static_cast<int>((_width)*_bpp/8)
);
}
Index: gui/gtk_glue_agg.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk_glue_agg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gui/gtk_glue_agg.h 13 Oct 2006 16:38:55 -0000 1.1
+++ gui/gtk_glue_agg.h 22 Oct 2006 22:53:28 -0000 1.2
@@ -54,7 +54,6 @@
render_handler* createRenderHandler();
void setRenderHandlerSize(int width, int height);
void render();
- void render(int minx, int miny, int maxx, int maxy);
void configure(GtkWidget *const widget, GdkEventConfigure *const event);
private:
unsigned char *_offscreenbuf;
Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- gui/gtksup.h 22 Oct 2006 17:45:42 -0000 1.25
+++ gui/gtksup.h 22 Oct 2006 22:53:28 -0000 1.26
@@ -135,8 +135,6 @@
GdkPixbuf* create_pixbuf(const gchar *filename);
- void set_invalidated_region(const rect& bounds);
-
virtual void setCursor(gnash_cursor_type newcursor);
private:
@@ -144,10 +142,6 @@
GdkPixbuf *_window_icon_pixbuf;
GtkWidget *_drawing_area;
GtkMenu *_popup_menu;
- int m_draw_minx;
- int m_draw_miny;
- int m_draw_maxx;
- int m_draw_maxy;
int valid_coord(int coord, int max);
#ifdef RENDERER_CAIRO
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- gui/gui.cpp 22 Oct 2006 17:45:42 -0000 1.38
+++ gui/gui.cpp 22 Oct 2006 22:53:28 -0000 1.39
@@ -249,7 +249,7 @@
{
// Tell the GUI that we only need to update this region
// (it may ignore this information)
- set_invalidated_region(changed_bounds);
+ _renderer->set_invalidated_region(changed_bounds);
// render the frame
m->display();
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- gui/gui.h 22 Oct 2006 17:45:42 -0000 1.30
+++ gui/gui.h 22 Oct 2006 22:53:28 -0000 1.31
@@ -121,28 +121,9 @@
/// Register event handlers.
virtual bool setupEvents() = 0;
- /// Defines the region on the stage that needs to be redrawn/updated.
- //
- /// Changes outside that region are unnecessary but not disallowed.
- /// Coordinates are in TWIPS!
- ///
- /// Note this information is given to the GUI and not directly to the
- /// renderer because both of them need to support this feature for
- /// correct results. It is up to the GUI to forward this information to
- /// the renderer.
- ///
- virtual void set_invalidated_region(const rect& /*bounds*/) {
- // does not need to be implemented (optional feature),
- // but still needs to be available.
- // Why "rect" (floats)? Because the gui does not really
- // know about the
- // scale the renderer currently uses...
- }
-
-
/// Asks the GUI handler if the next frame should be redrawn completely.
/// For example, when the contents of the player window have been
destroyed,
- /// then want_draw() should return true so that set_invalidated_region() is
+ /// then want_redraw() should return true so that set_invalidated_region()
is
/// called with the coordinates of the complete screen.
virtual bool want_redraw() {
return false;
Index: gui/sdl_agg_glue.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl_agg_glue.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gui/sdl_agg_glue.cpp 16 Oct 2006 15:37:27 -0000 1.2
+++ gui/sdl_agg_glue.cpp 22 Oct 2006 22:53:28 -0000 1.3
@@ -98,6 +98,8 @@
bool
SdlAggGlue::prepDrawingArea(int width, int height, uint32_t sdl_flags)
{
+ _width = width;
+ _height = height;
int depth_bytes = _bpp / 8;
assert(_bpp % 8 == 0);
@@ -160,12 +162,39 @@
return true;
}
+static int
+valid_coord(int coord, int max)
+{
+ if (coord<0) return 0;
+ else if (coord>=max) return max;
+
+ return coord;
+}
+
+
void
SdlAggGlue::render()
{
-// GNASH_REPORT_FUNCTION;
- SDL_BlitSurface(_sdl_surface, NULL, _screen, NULL);
- SDL_UpdateRect (_screen, 0, 0, 0, 0);
+ int xmin, ymin, xmax, ymax;
+
+ _agg_renderer->get_invalidated_region(xmin, ymin, xmax, ymax);
+
+ // add two pixels because of anti-aliasing...
+ xmin = valid_coord(xmin-2, _width);
+ ymin = valid_coord(ymin-2, _height);
+ xmax = valid_coord(xmax+2, _width);
+ ymax = valid_coord(ymax+2, _height);
+
+ // Our invalidated rectangle.
+ SDL_Rect area;
+ area.w = xmax - xmin;
+ area.h = ymax - ymin;
+ area.x = xmin;
+ area.y = ymin;
+
+ SDL_BlitSurface(_sdl_surface, &area, _screen, &area);
+
+ SDL_UpdateRect (_screen, area.x, area.y, area.w, area.h);
}
Index: gui/sdl_agg_glue.h
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl_agg_glue.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gui/sdl_agg_glue.h 16 Oct 2006 15:27:53 -0000 1.1
+++ gui/sdl_agg_glue.h 22 Oct 2006 22:53:28 -0000 1.2
@@ -63,6 +63,8 @@
unsigned char *_offscreenbuf;
SDL_Surface *_screen;
render_handler *_agg_renderer;
+ int _width;
+ int _height;
};
}
- [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Markus Gothe, 2006/10/08
- [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Markus Gothe, 2006/10/08
- [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Sandro Santilli, 2006/10/09
- [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Sandro Santilli, 2006/10/13
- [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Udo Giacomozzi, 2006/10/16
- [Gnash-commit] gnash ChangeLog backend/render_handler.h backen...,
Bastiaan Jacques <=
- Re: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Udo Giacomozzi, 2006/10/23
- Re: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Bastiaan Jacques, 2006/10/24
- Re[2]: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Udo Giacomozzi, 2006/10/24
- Re: Re[2]: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Bastiaan Jacques, 2006/10/25
- Re[4]: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Udo Giacomozzi, 2006/10/25
- Re: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., strk, 2006/10/26
- Re[2]: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Udo Giacomozzi, 2006/10/26
- Re: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Hannes Mayr, 2006/10/26
[Gnash-commit] gnash ChangeLog backend/render_handler.h backen..., Udo Giacomozzi, 2006/10/26