~ubuntu-branches/ubuntu/intrepid/cairo/intrepid-updates

« back to all changes in this revision

Viewing changes to test/mask.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin
  • Date: 2008-09-25 16:22:33 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080925162233-btx61ymk181i7mcc
Tags: 1.7.6-0ubuntu1
* New upstream version. Most noticable changes are:
  - some API changes with especially the removal of
    cairo_font_options_set_lcd_filter and cairo_font_options_get_lcd_filter
  - xlib: Faster bookkeeping
  - PS: Fix gradients with non-constant alpha
  - Fix deadlock in user-font code
* debian/patches/00list: Remove 03_from_git_fix_lcd_filter_default.dpatch,
  add debian/patches/03_fix_ftbfs_withing_xcb.dpatch
* debian/libcairo2.symbols, debian/libcairo-directfb2.symbols: update
  list of symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#define HEIGHT 16
33
33
#define PAD 2
34
34
 
35
 
const char      png_filename[]  = "romedalen.png";
 
35
static const char       png_filename[]  = "romedalen.png";
36
36
 
37
37
static void
38
 
set_solid_pattern (cairo_t *cr, int x, int y)
 
38
set_solid_pattern (const cairo_test_context_t *ctx, cairo_t *cr, int x, int y)
39
39
{
40
40
    cairo_set_source_rgb (cr, 0, 0, 0.6);
41
41
}
42
42
 
43
43
static void
44
 
set_translucent_pattern (cairo_t *cr, int x, int y)
 
44
set_translucent_pattern (const cairo_test_context_t *ctx, cairo_t *cr, int x, int y)
45
45
{
46
46
    cairo_set_source_rgba (cr, 0, 0, 0.6, 0.5);
47
47
}
48
48
 
49
49
static void
50
 
set_gradient_pattern (cairo_t *cr, int x, int y)
 
50
set_gradient_pattern (const cairo_test_context_t *ctx, cairo_t *cr, int x, int y)
51
51
{
52
52
    cairo_pattern_t *pattern;
53
53
 
60
60
}
61
61
 
62
62
static void
63
 
set_image_pattern (cairo_t *cr, int x, int y)
 
63
set_image_pattern (const cairo_test_context_t *ctx, cairo_t *cr, int x, int y)
64
64
{
65
65
    cairo_pattern_t *pattern;
66
66
 
67
 
    pattern = cairo_test_create_pattern_from_png (png_filename);
 
67
    pattern = cairo_test_create_pattern_from_png (ctx, png_filename);
68
68
    cairo_set_source (cr, pattern);
69
69
    cairo_pattern_destroy (pattern);
70
70
}
156
156
    cairo_new_path (cr);
157
157
}
158
158
 
159
 
static void (*pattern_funcs[])(cairo_t *cr, int x, int y) = {
 
159
static void (* const pattern_funcs[])(const cairo_test_context_t *ctx, cairo_t *cr, int x, int y) = {
160
160
    set_solid_pattern,
161
161
    set_translucent_pattern,
162
162
    set_gradient_pattern,
163
163
    set_image_pattern,
164
164
};
165
165
 
166
 
static void (*mask_funcs[])(cairo_t *cr, int x, int y) = {
 
166
static void (* const mask_funcs[])(cairo_t *cr, int x, int y) = {
167
167
    mask_alpha,
168
168
    mask_gradient,
169
169
    mask_polygon,
170
170
};
171
171
 
172
 
static void (*clip_funcs[])(cairo_t *cr, int x, int y) = {
 
172
static void (* const clip_funcs[])(cairo_t *cr, int x, int y) = {
173
173
    clip_none,
174
174
    clip_rects,
175
175
    clip_circle,
181
181
 
182
182
static cairo_test_draw_function_t draw;
183
183
 
184
 
cairo_test_t test = {
 
184
static const cairo_test_t test = {
185
185
    "mask",
186
186
    "Tests of cairo_mask",
187
187
    IMAGE_WIDTH, IMAGE_HEIGHT,
191
191
static cairo_test_status_t
192
192
draw (cairo_t *cr, int width, int height)
193
193
{
 
194
    const cairo_test_context_t *ctx = cairo_test_get_context (cr);
194
195
    cairo_surface_t *tmp_surface;
195
196
    cairo_pattern_t *tmp_pattern;
196
197
    size_t i, j, k;
225
226
                cairo_save (cr2);
226
227
 
227
228
                clip_funcs[k] (cr2, x, y);
228
 
                pattern_funcs[i] (cr2, x, y);
 
229
                pattern_funcs[i] (ctx, cr2, x, y);
229
230
                mask_funcs[j] (cr2, x, y);
230
231
 
231
232
                cairo_restore (cr2);