]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/src/cairo_util.c
Introduce a macro to flush a cairo surface twice.
[i3/i3] / i3bar / src / cairo_util.c
index 6a2ed0ac955e4740e4452e2e80af7266f96ecfe1..98c129b9aef17d901c244f566af9754ad924fc19 100644 (file)
@@ -79,7 +79,7 @@ void cairo_set_source_color(surface_t *surface, color_t color) {
  */
 void cairo_draw_text(i3String *text, surface_t *surface, color_t fg_color, color_t bg_color, int x, int y, int max_width) {
     /* Flush any changes before we draw the text as this might use XCB directly. */
-    cairo_surface_flush(surface->surface);
+    CAIRO_SURFACE_FLUSH(surface->surface);
 
     set_font_colors(surface->gc, fg_color.colorpixel, bg_color.colorpixel);
     draw_text(text, surface->id, surface->gc, visual_type, x, y, max_width);
@@ -109,7 +109,7 @@ void cairo_draw_rectangle(surface_t *surface, color_t color, double x, double y,
 
     /* Make sure we flush the surface for any text drawing operations that could follow.
      * Since we support drawing text via XCB, we need this. */
-    cairo_surface_flush(surface->surface);
+    CAIRO_SURFACE_FLUSH(surface->surface);
 
     cairo_restore(surface->cr);
 }
@@ -134,7 +134,7 @@ void cairo_copy_surface(surface_t *src, surface_t *dest, double src_x, double sr
 
     /* Make sure we flush the surface for any text drawing operations that could follow.
      * Since we support drawing text via XCB, we need this. */
-    cairo_surface_flush(src->surface);
-    cairo_surface_flush(dest->surface);
+    CAIRO_SURFACE_FLUSH(src->surface);
+    CAIRO_SURFACE_FLUSH(dest->surface);
     cairo_restore(dest->cr);
 }