~ubuntu-branches/ubuntu/raring/cairo/raring

« back to all changes in this revision

Viewing changes to src/cairo-xlib-core-compositor.c

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-01-23 21:19:34 UTC
  • mfrom: (1.3.11) (28.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20130123211934-q9qb538ujcmkliic
Tags: 1.12.10-1ubuntu1
* Merge from Debian, remaining changes:
* debian/patches/server_side_gradients.patch:
  - Don't use server side gradients, most drivers don't handle those and
    are really slow
* debian/control: Add missing libxext-dev dependency to libcairo2-dev.
  Spotted by autopkgtest.
* debian/patches/git_evince_rendering_fix.patch:
  Backport GIT commit to fix a rendering bug in evince
* debian/control, debian/libcairo2.symbols, debian/rules:
  - Disable GL backend due to LP: #725434

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
    Display *dpy;
84
84
    Drawable drawable;
85
85
    GC gc;
 
86
    //cairo_surface_t *dither = NULL;
86
87
};
87
88
 
88
89
static cairo_bool_t fill_box (cairo_box_t *box, void *closure)
128
129
}
129
130
 
130
131
static cairo_int_status_t
131
 
fill_boxes (cairo_xlib_surface_t    *dst,
132
 
            const cairo_color_t     *color,
133
 
            cairo_boxes_t           *boxes)
 
132
_fill_box_init (struct _fill_box *fb,
 
133
                cairo_xlib_surface_t *dst,
 
134
                const cairo_color_t *color)
134
135
{
135
 
    cairo_surface_t *dither = NULL;
136
 
    cairo_status_t status;
137
 
    struct _fill_box fb;
 
136
    cairo_int_status_t status;
138
137
 
139
 
    status = _cairo_xlib_surface_get_gc (dst->display, dst, &fb.gc);
 
138
    status = _cairo_xlib_surface_get_gc (dst->display, dst, &fb->gc);
140
139
    if (unlikely (status))
141
140
        return status;
142
141
 
143
 
    fb.dpy = dst->display->display;
144
 
    fb.drawable = dst->drawable;
 
142
    fb->dpy = dst->display->display;
 
143
    fb->drawable = dst->drawable;
145
144
 
146
145
    if (dst->visual && dst->visual->class != TrueColor && 0) {
 
146
#if 0
147
147
        cairo_solid_pattern_t solid;
148
148
        cairo_surface_attributes_t attrs;
149
149
 
150
150
        _cairo_pattern_init_solid (&solid, color);
151
 
#if 0
152
151
        status = _cairo_pattern_acquire_surface (&solid.base, &dst->base,
153
152
                                                 0, 0,
154
153
                                                 ARRAY_LENGTH (dither_pattern[0]),
160
159
            _cairo_xlib_surface_put_gc (dst->display, dst, fb.gc);
161
160
            return status;
162
161
        }
163
 
#endif
164
162
 
165
 
        XSetTSOrigin (fb.dpy, fb.gc,
 
163
        XSetTSOrigin (fb->dpy, fb->gc,
166
164
                      - (dst->base.device_transform.x0 + attrs.x_offset),
167
165
                      - (dst->base.device_transform.y0 + attrs.y_offset));
168
 
        XSetTile (fb.dpy, fb.gc, ((cairo_xlib_surface_t *) dither)->drawable);
 
166
        XSetTile (fb->dpy, fb->gc, ((cairo_xlib_surface_t *) dither)->drawable);
 
167
#endif
169
168
    } else {
170
169
        XGCValues gcv;
171
170
 
172
171
        gcv.foreground = color_to_pixel (dst, color);
173
172
        gcv.fill_style = FillSolid;
174
173
 
175
 
        XChangeGC (fb.dpy, fb.gc, GCFillStyle | GCForeground, &gcv);
 
174
        XChangeGC (fb->dpy, fb->gc, GCFillStyle | GCForeground, &gcv);
176
175
    }
177
176
 
 
177
    return CAIRO_INT_STATUS_SUCCESS;
 
178
}
 
179
 
 
180
static void
 
181
_fill_box_fini (struct _fill_box *fb,
 
182
                cairo_xlib_surface_t *dst)
 
183
{
 
184
    _cairo_xlib_surface_put_gc (dst->display, dst, fb->gc);
 
185
    //cairo_surface_destroy (fb->dither);
 
186
}
 
187
 
 
188
cairo_int_status_t
 
189
_cairo_xlib_core_fill_boxes (cairo_xlib_surface_t    *dst,
 
190
                             const cairo_color_t     *color,
 
191
                             cairo_boxes_t          *boxes)
 
192
{
 
193
    cairo_int_status_t status;
 
194
    struct _fill_box fb;
 
195
 
 
196
    status = _fill_box_init (&fb, dst, color);
 
197
    if (unlikely (status))
 
198
        return status;
 
199
 
178
200
    _cairo_boxes_for_each_box (boxes, fill_box, &fb);
179
201
 
180
 
    _cairo_xlib_surface_put_gc (dst->display, dst, fb.gc);
181
 
 
182
 
    cairo_surface_destroy (dither);
183
 
 
 
202
    _fill_box_fini (&fb, dst);
 
203
    return CAIRO_STATUS_SUCCESS;
 
204
}
 
205
 
 
206
cairo_int_status_t
 
207
_cairo_xlib_core_fill_rectangles (cairo_xlib_surface_t    *dst,
 
208
                                  const cairo_color_t     *color,
 
209
                                  int num_rects,
 
210
                                  cairo_rectangle_int_t *rects)
 
211
{
 
212
    cairo_int_status_t status;
 
213
    struct _fill_box fb;
 
214
    int i;
 
215
 
 
216
    status = _fill_box_init (&fb, dst, color);
 
217
    if (unlikely (status))
 
218
        return status;
 
219
 
 
220
    for (i = 0; i < num_rects; i++)
 
221
        XFillRectangle (fb.dpy, fb.drawable, fb.gc,
 
222
                        rects[i].x, rects[i].y,
 
223
                        rects[i].width, rects[i].height);
 
224
 
 
225
    _fill_box_fini (&fb, dst);
184
226
    return CAIRO_STATUS_SUCCESS;
185
227
}
186
228
 
495
537
        return status;
496
538
 
497
539
    if (src->type == CAIRO_PATTERN_TYPE_SOLID) {
498
 
        status = fill_boxes (dst,
499
 
                             &((cairo_solid_pattern_t *) src)->color,
500
 
                             boxes);
 
540
        status = _cairo_xlib_core_fill_boxes
 
541
            (dst, &((cairo_solid_pattern_t *) src)->color, boxes);
501
542
    } else {
502
543
        status = upload_image_inplace (dst, src, boxes);
503
544
        if (status == CAIRO_INT_STATUS_UNSUPPORTED)