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)
135
cairo_surface_t *dither = NULL;
136
cairo_status_t status;
136
cairo_int_status_t status;
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))
143
fb.dpy = dst->display->display;
144
fb.drawable = dst->drawable;
142
fb->dpy = dst->display->display;
143
fb->drawable = dst->drawable;
146
145
if (dst->visual && dst->visual->class != TrueColor && 0) {
147
147
cairo_solid_pattern_t solid;
148
148
cairo_surface_attributes_t attrs;
150
150
_cairo_pattern_init_solid (&solid, color);
152
151
status = _cairo_pattern_acquire_surface (&solid.base, &dst->base,
154
153
ARRAY_LENGTH (dither_pattern[0]),
160
159
_cairo_xlib_surface_put_gc (dst->display, dst, fb.gc);
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);
172
171
gcv.foreground = color_to_pixel (dst, color);
173
172
gcv.fill_style = FillSolid;
175
XChangeGC (fb.dpy, fb.gc, GCFillStyle | GCForeground, &gcv);
174
XChangeGC (fb->dpy, fb->gc, GCFillStyle | GCForeground, &gcv);
177
return CAIRO_INT_STATUS_SUCCESS;
181
_fill_box_fini (struct _fill_box *fb,
182
cairo_xlib_surface_t *dst)
184
_cairo_xlib_surface_put_gc (dst->display, dst, fb->gc);
185
//cairo_surface_destroy (fb->dither);
189
_cairo_xlib_core_fill_boxes (cairo_xlib_surface_t *dst,
190
const cairo_color_t *color,
191
cairo_boxes_t *boxes)
193
cairo_int_status_t status;
196
status = _fill_box_init (&fb, dst, color);
197
if (unlikely (status))
178
200
_cairo_boxes_for_each_box (boxes, fill_box, &fb);
180
_cairo_xlib_surface_put_gc (dst->display, dst, fb.gc);
182
cairo_surface_destroy (dither);
202
_fill_box_fini (&fb, dst);
203
return CAIRO_STATUS_SUCCESS;
207
_cairo_xlib_core_fill_rectangles (cairo_xlib_surface_t *dst,
208
const cairo_color_t *color,
210
cairo_rectangle_int_t *rects)
212
cairo_int_status_t status;
216
status = _fill_box_init (&fb, dst, color);
217
if (unlikely (status))
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);
225
_fill_box_fini (&fb, dst);
184
226
return CAIRO_STATUS_SUCCESS;
497
539
if (src->type == CAIRO_PATTERN_TYPE_SOLID) {
498
status = fill_boxes (dst,
499
&((cairo_solid_pattern_t *) src)->color,
540
status = _cairo_xlib_core_fill_boxes
541
(dst, &((cairo_solid_pattern_t *) src)->color, boxes);
502
543
status = upload_image_inplace (dst, src, boxes);
503
544
if (status == CAIRO_INT_STATUS_UNSUPPORTED)