summaryrefslogtreecommitdiff
path: root/util/cairo-api-update
blob: 7648084845df5aecf0d8ec0497a02aa232c80c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
set -e

if [ $# -lt 1 ]; then
    argv0=`basename $0`
    echo "$argv0: Update source code to the lastest Cairo API" >&2
    echo "" >&2
    echo "Usage: $argv0 file [...]" >&2
    exit 1
fi

cairo_api_update() {
	file=$1
	backup=$file.bak

	cp $file $backup
	sed -e '
		s/cairo_current_font_extents/cairo_font_extents/g
		s/cairo_get_font_extents/cairo_font_extents/g
		s/cairo_current_operator/cairo_get_operator/g
		s/cairo_current_tolerance/cairo_get_tolerance/g
		s/cairo_current_point/cairo_get_current_point/g
		s/cairo_current_fill_rule/cairo_get_fill_rule/g
		s/cairo_current_line_width/cairo_get_line_width/g
		s/cairo_current_line_cap/cairo_get_line_cap/g
		s/cairo_current_line_join/cairo_get_line_join/g
		s/cairo_current_miter_limit/cairo_get_miter_limit/g
		s/cairo_current_matrix/cairo_get_matrix/g
		s/cairo_current_target_surface/cairo_get_target_surface/g
		s/cairo_get_status/cairo_status/g
		s/cairo_get_status_string/cairo_status_string/g
		s/cairo_concat_matrix/cairo_transform/g
		s/cairo_scale_font/cairo_set_font_size/g
		s/cairo_select_font/cairo_select_font_face/g
		s/cairo_transform_font/cairo_set_font_matrix/g
		s/cairo_transform_point/cairo_user_to_device/g
		s/cairo_transform_distance/cairo_user_to_device_distance/g
		s/cairo_inverse_transform_point/cairo_device_to_user/g
		s/cairo_inverse_transform_distance/cairo_device_to_user_distance/g
		s/cairo_init_clip/cairo_reset_clip/g
		s/cairo_surface_create_for_image/cairo_image_surface_create_for_data/g
		s/cairo_default_matrix/cairo_identity_matrix/g
		s/cairo_matrix_set_affine/cairo_matrix_init/g
		s/cairo_matrix_set_identity/cairo_matrix_init_identity/g
		s/cairo_pattern_add_color_stop/cairo_pattern_add_color_stop_rgba/g
		s/cairo_set_rgb_color/cairo_set_source_rgb/g
		s/cairo_set_pattern/cairo_set_source/g
		s/CAIRO_OPERATOR_SRC/CAIRO_OPERATOR_SOURCE/g
		s/CAIRO_OPERATOR_DST/CAIRO_OPERATOR_DEST/g
		s/CAIRO_OPERATOR_OVER_REVERSE/CAIRO_OPERATOR_DEST_OVER/g
		s/CAIRO_OPERATOR_IN_REVERSE/CAIRO_OPERATOR_DEST_IN/g
		s/CAIRO_OPERATOR_OUT_REVERSE/CAIRO_OPERATOR_DEST_OUT/g
		s/CAIRO_OPERATOR_ATOP_REVERSE/CAIRO_OPERATOR_DEST_ATOP/g
		' $backup > $file
}

while [ $# -gt 0 ]; do
	file=$1
	shift
	cairo_api_update $file
done