Skip to content
Myr

Fix compilation with librsvg after adding threading rendering

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 563b48c · Browse files · 4 files+42 added−21 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+42 added−21 removed

  • other:+42 added−21 removed

4 files+42 added−21 removed

modified:render.c+14 added-13 removed
17 unmodified lines
1819#if defined(FUZZEL_ENABLE_CAIRO)20#include <cairo.h>21#else22#define cairo_surface_t void22#define cairo_t void23#endif2425#include <fcft/fcft.h>26
401 unmodified lines
428429#if defined(FUZZEL_ENABLE_SVG_LIBRSVG)430static void431render_svg_librsvg(const struct icon *icon, int x, int y, int size,432 cairo_surface_t *cairo)432 cairo_t *cairo)433{434 RsvgHandle *svg = icon->svg;435436 cairo_save(cairo);
40 unmodified lines
477478#if defined(FUZZEL_ENABLE_SVG_NANOSVG)479static void480render_svg_nanosvg(struct icon *icon, int x, int y, int size,481 pixman_image_t *pix, cairo_surface_t *cairo)481 pixman_image_t *pix, cairo_t *cairo)482{483#if defined(FUZZEL_ENABLE_CAIRO)484 cairo_surface_flush(cairo);484 cairo_surface_flush(cairo_get_target(cairo));485#endif486487 pixman_image_t *img = NULL;488
52 unmodified lines
541 pixman_image_composite32(542 PIXMAN_OP_OVER, img, NULL, pix, 0, 0, 0, 0, x, y, size, size);543544#if defined(FUZZEL_ENABLE_CAIRO)545 cairo_surface_mark_dirty(cairo);545 cairo_surface_mark_dirty(cairo_get_target(cairo));546#endif547}548#endif /* FUZZEL_ENABLE_SVG_NANOSVG */549550static void551render_svg(struct icon *icon, int x, int y, int size,552 pixman_image_t *pix, cairo_surface_t *cairo)552 pixman_image_t *pix, cairo_t *cairo)553{554 assert(icon->type == ICON_SVG);555556 if (icon->svg == NULL) {
11 unmodified lines
568569#if defined(FUZZEL_ENABLE_PNG_LIBPNG)570static void571render_png_libpng(struct icon *icon, int x, int y, int size,572 pixman_image_t *pix, cairo_surface_t *cairo)572 pixman_image_t *pix, cairo_t *cairo)573{574#if defined(FUZZEL_ENABLE_CAIRO)575 cairo_surface_flush(cairo);575 cairo_surface_flush(cairo_get_target(cairo));576#endif577578 pixman_image_t *png = icon->png;579 pixman_format_code_t fmt = pixman_image_get_format(png);
50 unmodified lines
630 pixman_image_composite32(631 PIXMAN_OP_OVER, png, NULL, pix, 0, 0, 0, 0, x, y, width, height);632633#if defined(FUZZEL_ENABLE_CAIRO)634 cairo_surface_mark_dirty(cairo);634 cairo_surface_mark_dirty(cairo_get_target(cairo));635#endif636}637#endif /* FUZZEL_ENABLE_PNG_LIBPNG */638639static void640render_png(struct icon *icon, int x, int y, int size, pixman_image_t *pix, cairo_surface_t *cairo)640render_png(struct icon *icon, int x, int y, int size, pixman_image_t *pix,641 cairo_t *cairo)642{643 assert(icon->type == ICON_PNG);644645 if (icon->png == NULL) {
19 unmodified lines
665static void666render_one_match_entry(const struct render *render, const struct matches *matches,667 const struct match *match, bool render_icons,668 int idx, bool is_selected, int width, int height,668 pixman_image_t *pix, cairo_surface_t *cairo)669 pixman_image_t *pix, cairo_t *cairo)670{671 const enum fcft_subpixel subpixel =672 (render->conf->colors.background.a == 1. &&673 render->conf->colors.selection.a == 1.)
148 unmodified lines
822 render_one_match_entry(823 render, matches, match, render_icons, i, i == selected,824 buf->width, buf->height, buf->pix[0],825#if defined(FUZZEL_ENABLE_CAIRO)825 buf->cairo_surfaces[0]826 buf->cairo[0]827#else828 NULL829#endif830 );
69 unmodified lines
900 render, matches, match, render_icons,901 row_no, row_no == selected, buf->width, buf->height,902 buf->pix[my_id],903#if defined(FUZZEL_ENABLE_CAIRO)903 buf->cairo_surfaces[my_id]904 buf->cairo[my_id]905#else906 NULL907#endif908 );
234 unmodified lines
modified:shm.c+25 added-6 removed
116 unmodified lines
117 }118 free(buf->pix);119120#if defined(FUZZEL_ENABLE_CAIRO)121 if (buf->cairo_surfaces != NULL) {121 if (buf->cairo != NULL) {122 for (size_t i = 0; i < buf->pix_instances; i++) {123 if (buf->cairo_surfaces[i] != NULL)124 cairo_surface_destroy(buf->cairo_surfaces[i]);123 if (buf->cairo[i] != NULL) {124 cairo_surface_destroy(cairo_get_target(buf->cairo[i]));125 cairo_destroy(buf->cairo[i]);126 }127 }128129 free(buf->cairo);130 }127 free(buf->cairo_surfaces);131#endif132133 if (buf->wl_buf != NULL)134 wl_buffer_destroy(buf->wl_buf);
136 unmodified lines
271 struct wl_buffer *wl_buf = NULL;272 pixman_image_t **pix = calloc(buf->public.pix_instances, sizeof(pix[0]));273274#if defined(FUZZEL_ENABLE_CAIRO)275 cairo_t **cairos = calloc(buf->public.pix_instances, sizeof(cairos[0]));276 cairo_surface_t **cairo_surfs =277 calloc(buf->public.pix_instances, sizeof(cairo_surfs[0]));278#endif279
31 unmodified lines
311 "failed to create cairo surface: %s",312 cairo_status_to_string(cairo_surface_status(cairo_surfs[i])));313 goto err;314 }315316 cairos[i] = cairo_create(cairo_surfs[i]);317 if (cairo_status(cairos[i]) != CAIRO_STATUS_SUCCESS) {318 LOG_ERR("failed to create cairo context: %s",319 cairo_status_to_string(cairo_status(cairos[i])));320 goto err;321 }322#endif323 }324325 buf->public.data = mmapped;
1 unmodified line
327 buf->public.pix = pix;328 buf->offset = new_offset;329330#if defined(FUZZEL_ENABLE_CAIRO)320 buf->public.cairo_surfaces = cairo_surfs;331 buf->public.cairo = cairos;332 free(cairo_surfs);333#endif334335 wl_buffer_add_listener(wl_buf, &buffer_listener, buf);336 return true;
7 unmodified lines
344 }345 free(pix);346347#if defined(FUZZEL_ENABLE_CAIRO)348 if (cairos != NULL) {349 for (size_t i = 0; i < buf->public.pix_instances; i++) {350 if (cairos[i] != NULL)351 cairo_destroy(cairos[i]);352 }353 free(cairos);354 }355 if (cairo_surfs != NULL) {356 for (size_t i = 0; i < buf->public.pix_instances; i++) {357 if (cairo_surfs[i] != NULL)358 cairo_surface_destroy(cairo_surfs[i]);359 }360 free(cairo_surfs);361 }342 free(cairo_surfs);362#endif363364 if (wl_buf != NULL)365 wl_buffer_destroy(wl_buf);
688 unmodified lines
modified:shm.h+1 added-1 removed
23 unmodified lines
2425 struct wl_buffer *wl_buf;26 pixman_image_t **pix;27#if defined(FUZZEL_ENABLE_CAIRO)28 cairo_surface_t **cairo_surfaces;28 cairo_t **cairo;29#endif30 size_t pix_instances;3132 unsigned age;
64 unmodified lines
modified:wayland.c+2 added-1 removed
2049 unmodified lines
2050 render_prompt(wayl->render, buf, wayl->prompt);2051 render_match_list(wayl->render, buf, wayl->prompt, wayl->matches);20522053#if defined(FUZZEL_ENABLE_CAIRO)2054 cairo_surface_flush(buf->cairo_surfaces[0]);2054 for (size_t i = 0; i < buf->pix_instances; i++)2055 cairo_surface_flush(cairo_get_target(buf->cairo[0]));2056#endif20572058commit:2059 /* No pending frames - render immediately */
423 unmodified lines