mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-11 19:06:33 +00:00
examples: Use cairo instead of to-be-deprecated GDK API
Fixes bug #625002.
This commit is contained in:
parent
eb4afca554
commit
bba463be38
3 changed files with 27 additions and 18 deletions
|
@ -79,18 +79,21 @@ draw_spectrum (gfloat * data)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
|
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
if (!drawingarea)
|
if (!drawingarea)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
|
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
|
||||||
gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
|
cr = gdk_cairo_create (gtk_widget_get_window (drawingarea));
|
||||||
gtk_widget_get_style (drawingarea)->black_gc,
|
|
||||||
TRUE, 0, 0, spect_bands, spect_height);
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||||
|
cairo_rectangle (cr, 0, 0, spect_bands, spect_height);
|
||||||
|
cairo_fill (cr);
|
||||||
for (i = 0; i < spect_bands; i++) {
|
for (i = 0; i < spect_bands; i++) {
|
||||||
gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||||
gtk_widget_get_style (drawingarea)->white_gc,
|
cairo_rectangle (cr, i, -data[i], 1, spect_height + data[i]);
|
||||||
TRUE, i, -data[i], 1, spect_height + data[i]);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
|
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,18 +78,21 @@ draw_spectrum (gfloat * data)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
|
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
if (!drawingarea)
|
if (!drawingarea)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
|
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
|
||||||
gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
|
cr = gdk_cairo_create (gtk_widget_get_window (drawingarea));
|
||||||
gtk_widget_get_style (drawingarea)->black_gc,
|
|
||||||
TRUE, 0, 0, spect_bands, spect_height);
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||||
|
cairo_rectangle (cr, 0, 0, spect_bands, spect_height);
|
||||||
|
cairo_fill (cr);
|
||||||
for (i = 0; i < spect_bands; i++) {
|
for (i = 0; i < spect_bands; i++) {
|
||||||
gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||||
gtk_widget_get_style (drawingarea)->white_gc,
|
cairo_rectangle (cr, i, -data[i], 1, spect_height + data[i]);
|
||||||
TRUE, i, -data[i], 1, spect_height + data[i]);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
|
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,18 +67,21 @@ draw_spectrum (gfloat * data)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
|
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
if (!drawingarea)
|
if (!drawingarea)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
|
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
|
||||||
gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
|
cr = gdk_cairo_create (gtk_widget_get_window (drawingarea));
|
||||||
gtk_widget_get_style (drawingarea)->black_gc,
|
|
||||||
TRUE, 0, 0, spect_bands, spect_height);
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||||
|
cairo_rectangle (cr, 0, 0, spect_bands, spect_height);
|
||||||
|
cairo_fill (cr);
|
||||||
for (i = 0; i < spect_bands; i++) {
|
for (i = 0; i < spect_bands; i++) {
|
||||||
gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||||
gtk_widget_get_style (drawingarea)->white_gc,
|
cairo_rectangle (cr, i, -data[i], 1, spect_height + data[i]);
|
||||||
TRUE, i, -data[i], 1, spect_height + data[i]);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
|
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue