summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-07-24 10:19:37 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-07-24 10:26:31 +0200
commitbba463be38296cb4e2b1fcb314254a0dcd0c68fa (patch)
tree799c23b00a1c2d1e913da2483a208ee42d080062 /tests
parenteb4afca554a61819b8ad86647dae17f0a694714f (diff)
examples: Use cairo instead of to-be-deprecated GDK API
Fixes bug #625002.
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/equalizer/demo.c15
-rw-r--r--tests/examples/spectrum/demo-audiotest.c15
-rw-r--r--tests/examples/spectrum/demo-osssrc.c15
3 files changed, 27 insertions, 18 deletions
diff --git a/tests/examples/equalizer/demo.c b/tests/examples/equalizer/demo.c
index 9b365ee23..c53490412 100644
--- a/tests/examples/equalizer/demo.c
+++ b/tests/examples/equalizer/demo.c
@@ -79,18 +79,21 @@ draw_spectrum (gfloat * data)
{
gint i;
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
+ cairo_t *cr;
if (!drawingarea)
return;
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
- gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
- gtk_widget_get_style (drawingarea)->black_gc,
- TRUE, 0, 0, spect_bands, spect_height);
+ cr = gdk_cairo_create (gtk_widget_get_window (drawingarea));
+
+ 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++) {
- gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
- gtk_widget_get_style (drawingarea)->white_gc,
- TRUE, i, -data[i], 1, spect_height + data[i]);
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_rectangle (cr, i, -data[i], 1, spect_height + data[i]);
+ cairo_fill (cr);
}
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
}
diff --git a/tests/examples/spectrum/demo-audiotest.c b/tests/examples/spectrum/demo-audiotest.c
index 094ab3168..6cc7b9458 100644
--- a/tests/examples/spectrum/demo-audiotest.c
+++ b/tests/examples/spectrum/demo-audiotest.c
@@ -78,18 +78,21 @@ draw_spectrum (gfloat * data)
{
gint i;
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
+ cairo_t *cr;
if (!drawingarea)
return;
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
- gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
- gtk_widget_get_style (drawingarea)->black_gc,
- TRUE, 0, 0, spect_bands, spect_height);
+ cr = gdk_cairo_create (gtk_widget_get_window (drawingarea));
+
+ 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++) {
- gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
- gtk_widget_get_style (drawingarea)->white_gc,
- TRUE, i, -data[i], 1, spect_height + data[i]);
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_rectangle (cr, i, -data[i], 1, spect_height + data[i]);
+ cairo_fill (cr);
}
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
}
diff --git a/tests/examples/spectrum/demo-osssrc.c b/tests/examples/spectrum/demo-osssrc.c
index 091e4b2e0..72401f8df 100644
--- a/tests/examples/spectrum/demo-osssrc.c
+++ b/tests/examples/spectrum/demo-osssrc.c
@@ -67,18 +67,21 @@ draw_spectrum (gfloat * data)
{
gint i;
GdkRectangle rect = { 0, 0, spect_bands, spect_height };
+ cairo_t *cr;
if (!drawingarea)
return;
gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
- gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
- gtk_widget_get_style (drawingarea)->black_gc,
- TRUE, 0, 0, spect_bands, spect_height);
+ cr = gdk_cairo_create (gtk_widget_get_window (drawingarea));
+
+ 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++) {
- gdk_draw_rectangle (gtk_widget_get_window (drawingarea),
- gtk_widget_get_style (drawingarea)->white_gc,
- TRUE, i, -data[i], 1, spect_height + data[i]);
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_rectangle (cr, i, -data[i], 1, spect_height + data[i]);
+ cairo_fill (cr);
}
gdk_window_end_paint (gtk_widget_get_window (drawingarea));
}