summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-render-compositor.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-13 17:20:24 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-13 18:37:08 +0000
commit7012334ebb424b619312e1fa397cc3b8a3ffd770 (patch)
tree8cbf002161b16ca186651734b4e188aab9b6d97a /src/cairo-xlib-render-compositor.c
parent503b6b9e2ea65805a77d527c00cf242ec86d479b (diff)
downloadcairo-7012334ebb424b619312e1fa397cc3b8a3ffd770.tar.gz
xlib: Handle lack of XRenderFillRectangles
Remember to check for a supported render version before making a FillRectangle request, and fallback to the core protocol where possible instead. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-xlib-render-compositor.c')
-rw-r--r--src/cairo-xlib-render-compositor.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
index a5f750eaa..3540d1fda 100644
--- a/src/cairo-xlib-render-compositor.c
+++ b/src/cairo-xlib-render-compositor.c
@@ -608,14 +608,23 @@ fill_rectangles (void *abstract_surface,
//X_DEBUG ((display->display, "fill_rectangles (dst=%x)", (unsigned int) surface->drawable));
+ if (fill_reduces_to_source (op, color, dst))
+ op = CAIRO_OPERATOR_SOURCE;
+
+ if (!CAIRO_RENDER_HAS_FILL_RECTANGLES(dst->display)) {
+ cairo_int_status_t status;
+
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+ if (op == CAIRO_OPERATOR_SOURCE)
+ status = _cairo_xlib_core_fill_rectangles (dst, color, num_rects, rects);
+ return status;
+ }
+
render_color.red = color->red_short;
render_color.green = color->green_short;
render_color.blue = color->blue_short;
render_color.alpha = color->alpha_short;
- if (fill_reduces_to_source (op, color, dst))
- op = CAIRO_OPERATOR_SOURCE;
-
_cairo_xlib_surface_ensure_picture (dst);
if (num_rects == 1) {
/* Take advantage of the protocol compaction that libXrender performs
@@ -665,14 +674,23 @@ fill_boxes (void *abstract_surface,
cairo_xlib_surface_t *dst = abstract_surface;
XRenderColor render_color;
+ if (fill_reduces_to_source (op, color, dst))
+ op = CAIRO_OPERATOR_SOURCE;
+
+ if (!CAIRO_RENDER_HAS_FILL_RECTANGLES(dst->display)) {
+ cairo_int_status_t status;
+
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+ if (op == CAIRO_OPERATOR_SOURCE)
+ status = _cairo_xlib_core_fill_boxes (dst, color, boxes);
+ return status;
+ }
+
render_color.red = color->red_short;
render_color.green = color->green_short;
render_color.blue = color->blue_short;
render_color.alpha = color->alpha_short;
- if (fill_reduces_to_source (op, color, dst))
- op = CAIRO_OPERATOR_SOURCE;
-
_cairo_xlib_surface_ensure_picture (dst);
if (boxes->num_boxes == 1) {
int x1 = _cairo_fixed_integer_part (boxes->chunks.base[0].p1.x);