diff options
author | Stefan Kost <ensonic@users.sf.net> | 2006-10-20 13:56:55 +0000 |
---|---|---|
committer | Julien Moutte <julien@moutte.net> | 2006-10-20 13:56:55 +0000 |
commit | 776911ecc22a7d3103fe7c9927accbffdaee06a8 (patch) | |
tree | 9dcef932416ca9b8e34c1774775844ab5a534ee5 /sys | |
parent | 0b8488ee2d19ace8e7eb445128605f40f47f754e (diff) |
sys/: Try to redraw borders only when needed. Apparently this consumes resources on small devices... :-O (#363607)
Original commit message from CVS:
2006-10-20 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put):
Patch by: Stefan Kost <ensonic@users.sf.net>
Try to redraw borders only when needed. Apparently this consumes
resources on small devices... :-O (#363607)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ximage/ximagesink.c | 14 | ||||
-rw-r--r-- | sys/xvimage/xvimagesink.c | 14 |
2 files changed, 24 insertions, 4 deletions
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 711451b7..d90e4640 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -628,6 +628,7 @@ static void gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) { GstVideoRectangle src, dst, result; + gboolean draw_border = FALSE; g_return_if_fail (GST_IS_XIMAGESINK (ximagesink)); @@ -635,6 +636,12 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) concurrently from the data flow thread */ g_mutex_lock (ximagesink->flow_lock); + /* Draw borders when displaying the first frame. After this + draw borders only on expose event. */ + if (!ximagesink->cur_image) { + draw_border = TRUE; + } + /* Store a reference to the last image we put, lose the previous one */ if (ximage && ximagesink->cur_image != ximage) { if (ximagesink->cur_image) { @@ -648,6 +655,7 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) /* Expose sends a NULL image, we take the latest frame */ if (!ximage) { + draw_border = TRUE; if (ximagesink->cur_image) { ximage = ximagesink->cur_image; } else { @@ -667,8 +675,10 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage) g_mutex_lock (ximagesink->x_lock); - gst_ximagesink_xwindow_draw_borders (ximagesink, ximagesink->xwindow, result); - + if (draw_border) { + gst_ximagesink_xwindow_draw_borders (ximagesink, ximagesink->xwindow, + result); + } #ifdef HAVE_XSHM if (ximagesink->xcontext->use_xshm) { GST_LOG_OBJECT (ximagesink, diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 1606fc42..1ea83775 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -671,6 +671,7 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstXvImageBuffer * xvimage) { GstVideoRectangle src, dst, result; + gboolean draw_border = FALSE; g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink)); g_return_if_fail (xvimagesink->xwindow != NULL); @@ -679,6 +680,12 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, concurrently from the data flow thread */ g_mutex_lock (xvimagesink->flow_lock); + /* Draw borders when displaying the first frame. After this + draw borders only on expose event. */ + if (!xvimagesink->cur_image) { + draw_border = TRUE; + } + /* Store a reference to the last image we put, lose the previous one */ if (xvimage && xvimagesink->cur_image != xvimage) { if (xvimagesink->cur_image) { @@ -692,6 +699,7 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, /* Expose sends a NULL image, we take the latest frame */ if (!xvimage) { + draw_border = TRUE; if (xvimagesink->cur_image) { xvimage = xvimagesink->cur_image; } else { @@ -719,8 +727,10 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, g_mutex_lock (xvimagesink->x_lock); - gst_xvimagesink_xwindow_draw_borders (xvimagesink, xvimagesink->xwindow, - result); + if (draw_border) { + gst_xvimagesink_xwindow_draw_borders (xvimagesink, xvimagesink->xwindow, + result); + } /* We scale to the window's geometry */ #ifdef HAVE_XSHM |