gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash gui/gtk_glue.h gui/gtk_glue_agg.cpp Chang...


From: Hannes Mayr
Subject: [Gnash-commit] gnash gui/gtk_glue.h gui/gtk_glue_agg.cpp Chang...
Date: Mon, 16 Oct 2006 10:01:05 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Hannes Mayr <bik>       06/10/16 10:01:05

Modified files:
        gui            : gtk_glue.h gtk_glue_agg.cpp 
        .              : ChangeLog 

Log message:
        Code cleanup and fixed unused parameter warnings.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_agg.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1227&r2=1.1228

Patches:
Index: gui/gtk_glue.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk_glue.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gui/gtk_glue.h      13 Oct 2006 16:38:55 -0000      1.4
+++ gui/gtk_glue.h      16 Oct 2006 10:01:05 -0000      1.5
@@ -51,9 +51,10 @@
 
     virtual void prepDrawingArea(GtkWidget *drawing_area) = 0;
     virtual render_handler* createRenderHandler() = 0;
-    virtual void setRenderHandlerSize(int width, int height) { };
+    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 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.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gui/gtk_glue_agg.cpp        16 Oct 2006 04:56:19 -0000      1.3
+++ gui/gtk_glue_agg.cpp        16 Oct 2006 10:01:05 -0000      1.4
@@ -35,7 +35,7 @@
 //
 //
 
-/* $Id: gtk_glue_agg.cpp,v 1.3 2006/10/16 04:56:19 nihilus Exp $ */
+/* $Id: gtk_glue_agg.cpp,v 1.4 2006/10/16 10:01:05 bik Exp $ */
 
 #include <cstdio>
 #include <cerrno>
@@ -52,26 +52,27 @@
 namespace gnash
 {
 
-GtkAggGlue::GtkAggGlue()
+GtkAggGlue::GtkAggGlue() :
+       _offscreenbuf(NULL),
+       _offscreenbuf_size(0),
+       _agg_renderer(NULL),
+       _width(0),
+       _height(0),
+       _bpp(0)
 {
 }
 
 GtkAggGlue::~GtkAggGlue()
 {
-
+  free(_offscreenbuf);
 }
 
 bool
-GtkAggGlue::init(int argc, char **argv[])
+GtkAggGlue::init(int /*argc*/, char **/*argv*/[])
 {
     gdk_rgb_init();
     
-               _offscreenbuf_size      = 0;
-               _offscreenbuf           = NULL;
-               _agg_renderer       = NULL;
-               _width                  = 0;
-               _height                 = 0;
-               _bpp                    = 0;
+               _bpp = gdk_visual_get_best_depth();
     
     return true;
 }
@@ -80,13 +81,6 @@
 GtkAggGlue::prepDrawingArea(GtkWidget *drawing_area)
 {
     _drawing_area = drawing_area;
-    
-    gtk_widget_get_size_request(_drawing_area, &_width, &_height);
-
-    _width     = (_width == -1) ? 0 : _width;
-    _height    = (_height == -1) ? 0 : _height;
-    _bpp               = gdk_visual_get_best_depth();
-
 }
 
 render_handler*
@@ -136,8 +130,9 @@
        // TODO: At the moment we only increase the buffer and never decrease 
it. Should be
        // changed sometime.
        if (new_bufsize > _offscreenbuf_size) {
-               new_bufsize = (int)(new_bufsize / CHUNK_SIZE + 1) * CHUNK_SIZE;
-               _offscreenbuf   = (unsigned char *)realloc(_offscreenbuf, 
new_bufsize);
+               new_bufsize = static_cast<int>(new_bufsize / CHUNK_SIZE + 1) * 
CHUNK_SIZE;
+               // TODO: C++ conform alternative to realloc?
+               _offscreenbuf   = static_cast<unsigned char *>( 
realloc(_offscreenbuf, new_bufsize) );
           
                if (!_offscreenbuf) {
                  log_msg("Could not allocate %i bytes for offscreen buffer: 
%s\n",
@@ -152,7 +147,10 @@
   _width = width;
        _height = height;
 
-       ((render_handler_agg_base *)_agg_renderer)->init_buffer(
+       // Only the AGG renderer has the function init_buffer, which is *not* 
part of
+       // the renderer api. It allows us to change the renderers movie size 
(and buffer
+       // address) during run-time.
+       static_cast<render_handler_agg_base *>(_agg_renderer)->init_buffer(
          _offscreenbuf,
                _offscreenbuf_size,
                _width,
@@ -163,6 +161,7 @@
 void
 GtkAggGlue::render()
 {
+       // Update the entire screen
        gdk_draw_rgb_image (
                _drawing_area->window,
                _drawing_area->style->fg_gc[GTK_STATE_NORMAL],
@@ -177,11 +176,13 @@
 }
 
 void
-GtkAggGlue::render(int minx, int miny, int maxx, int maxy)
+GtkAggGlue::render(int /*minx*/, int /*miny*/, int /*maxx*/, int /*maxy*/)
 {
        render();
 
        /*
+       Regions don't work yet.
+       
        log_msg("Gtk-AGG: render invalidated_region: x:%i, y:%i, w:%i, h:%i\n", 
\
                minx, \
        miny, \
@@ -204,7 +205,7 @@
 }
 
 void
-GtkAggGlue::configure(GtkWidget *const widget, GdkEventConfigure *const event)
+GtkAggGlue::configure(GtkWidget *const /*widget*/, GdkEventConfigure *const 
event)
 {
        if (_agg_renderer)
                setRenderHandlerSize(event->width, event->height);

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1227
retrieving revision 1.1228
diff -u -b -r1.1227 -r1.1228
--- ChangeLog   16 Oct 2006 08:39:27 -0000      1.1227
+++ ChangeLog   16 Oct 2006 10:01:05 -0000      1.1228
@@ -1,3 +1,7 @@
+2006-10-16 Hannes Mayr <address@hidden>
+       * gui/gtk_glue_agg.cpp, gui/gtk_glue.h: Code cleanup, fixed unused 
parameter
+               warnings.
+               
 2006-10-16 Udo Giacomozzi <address@hidden>
 
        * gui/fbsup.h, gui/fb.cpp: Implemented clean exit for FB GUI




reply via email to

[Prev in Thread] Current Thread [Next in Thread]