[Splashy-devel] 3/6 Make simple interface for splashy_video.h

Tim Dijkstra newsuser at famdijkstra.org
Sat Aug 12 21:36:50 UTC 2006


Remove "DFBRectangle * progressbar" from argument lists. These functions
are always called as func(video, video->progressbar) so we can do
without the progressbar. This way we do not have to expose DFBRectangle.

Index: splashy_video.c
===================================================================
--- splashy_video.c	(revision 137)
+++ splashy_video.c	(working copy)
@@ -209,12 +209,13 @@
 }
 
 gint
-video_draw_progressbar (splashy_video_t * video, DFBRectangle * progressbar)
+video_draw_progressbar (splashy_video_t * video)
 {
         gint screen_width, screen_height;
         gint divider_w, divider_h;
         guint rectangle_red, rectangle_green, rectangle_blue, rectangle_alpha;
 
+        DFBRectangle * progressbar = &video->progressbar;
 
	/* We set a flag here now that change_splash can see to know
 	 * if it has to redraw the progress bar.
@@ -425,8 +425,7 @@
  * update the progressbar in reverse
  */
 gint
-video_update_progressbar (splashy_video_t * video,
-                          DFBRectangle * progressbar, gint perc)
+video_update_progressbar (splashy_video_t * video, gint perc)
 {
         /*
          * how many nanoseconds we sleep while updating the progress bar 
@@ -434,6 +433,8 @@
         struct timespec _progress_sleep;
         guint i = 0, _w = 0;
 
+        DFBRectangle * progressbar = &video->progressbar;
+
         DEBUG_PRINT ("video_update_progressbar(%d) called", perc);
         /*
          * sanity check 
@@ -515,11 +516,12 @@
  * updates the progress bar without smoothing it out
  */
 gint
-video_update_progressbar_quick (splashy_video_t * video,
-                                DFBRectangle * progressbar, gint perc)
+video_update_progressbar_quick (splashy_video_t * video, gint perc)
 {
         guint _w = 0;
 
+        DFBRectangle * progressbar = &video->progressbar;
+
         DEBUG_PRINT ("video_update_progressbar_quick(%d) called", perc);
         /*
          * sanity check 
@@ -821,13 +823,12 @@
          */
         if (show_progressbar == TRUE)
         {
-                video_draw_progressbar (video, &video->progressbar);
+                video_draw_progressbar (video);
                 if (_last_progress >= 0)
                 {
                         DEBUG_PRINT ("Restoring progressbar to %d ticks\n",
                                      _last_progress);
                         video_update_progressbar_quick (video,
-                                                        &video->progressbar,
                                                         _last_progress);
                 }
         }
Index: splashy_functions.c
===================================================================
--- splashy_functions.c	(revision 137)
+++ splashy_functions.c	(working copy)
@@ -206,8 +206,7 @@
         {
                 DEBUG_PRINT ("cmd_progress: Setting progressbar to %d ticks",
                              arg_progress);
-                video_update_progressbar (&video, &video.progressbar,
-                                          arg_progress);
+                video_update_progressbar (&video, arg_progress);
         }
 
         last_progress = arg_progress;
@@ -837,8 +836,7 @@
                                 nanosleep (&_sleep, NULL);
                         }
                         g_printerr ("Updating progressbar by %d+10\n", i);
-                        video_update_progressbar (&video, &video.progressbar,
-                                                  i += 10);
+                        video_update_progressbar (&video, i += 10);
                         sched_yield ();
                         nanosleep (&_sleep, NULL);
                 }
@@ -1194,7 +1192,7 @@
                  * starting bars stuff! 
                  */
                 DEBUG_PRINT ("_splashy_child() starting progressbar %s", "");
-                video_draw_progressbar (&video, &video.progressbar);
+                video_draw_progressbar (&video);
         }
 
         /*
Index: splashy_video.h
===================================================================
--- splashy_video.h	(revision 137)
+++ splashy_video.h	(working copy)
@@ -68,10 +68,8 @@
 void
 video_reset_progressbar_counters();
 void video_set_progressbar_forward(gboolean go_forward);
-gint video_draw_progressbar (splashy_video_t * video,
-                             DFBRectangle * progressbar);
-gint video_update_progressbar (splashy_video_t * video,
-                               DFBRectangle * progressbar, gint perc);
+gint video_draw_progressbar (splashy_video_t * video);
+gint video_update_progressbar (splashy_video_t * video, gint perc);
 void video_start_splash (splashy_video_t * video, const gchar * background);
 void video_change_splash (splashy_video_t * video, const gchar * newimage);
 void video_start_text_area (splashy_video_t * video);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/splashy-devel/attachments/20060812/888614b5/signature.pgp


More information about the Splashy-devel mailing list