Skip to content

Commit

Permalink
Hopefully fixing the crash in XRenderFindDisplay while drawing the in…
Browse files Browse the repository at this point in the history
…tersection icon
  • Loading branch information
kofa73 committed Nov 30, 2024
1 parent fa54963 commit 62939f0
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/dtgtk/paint.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,14 +903,10 @@ void dtgtk_cairo_paint_masks_intersection(cairo_t *cr, gint x, gint y, gint w, g
cairo_restore(cr);

// we draw the intersection of the 2 circles we slightly different radius so they are more visible
cairo_push_group(cr);
cairo_arc(cr, padding_left + r * 1.3, h / 2.0, r * 0.85, 0, 2.0 * M_PI);
cairo_fill(cr);
cairo_set_operator(cr, CAIRO_OPERATOR_IN);
cairo_clip(cr);
cairo_arc(cr, padding_left + r * 2.3, h / 2.0, r * 0.85, 0, 2.0 * M_PI);
cairo_fill(cr);
cairo_pop_group_to_source(cr);
cairo_paint(cr);
}

void dtgtk_cairo_paint_masks_difference(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data)
Expand Down Expand Up @@ -2172,28 +2168,21 @@ void dtgtk_cairo_paint_intersection(cairo_t *cr, gint x, gint y, gint w, gint h,
if(cairo_pattern_get_rgba(cairo_get_source(cr), &r, &g, &b, &alpha) != CAIRO_STATUS_SUCCESS)
goto final;

cairo_set_source_rgba(cr, r, g, b, 1.0);
cairo_set_source_rgb(cr, r, g, b);

const double radius = 0.3;

// we draw the outline of the 2 circles
cairo_push_group(cr);
cairo_arc(cr, radius, 0.5, radius, 0, 2.0 * M_PI);
cairo_stroke(cr);
cairo_arc(cr, radius * 2.4, 0.5, radius, 0, 2.0 * M_PI);
cairo_stroke(cr);

// we draw the intersection of the 2 circles
cairo_push_group(cr);
cairo_arc(cr, radius, 0.5, radius * 1.2, 0, 2.0 * M_PI);
cairo_fill(cr);
cairo_set_operator(cr, CAIRO_OPERATOR_IN);
cairo_clip(cr);
cairo_arc(cr, radius * 2.4, 0.5, radius * 1.2, 0, 2.0 * M_PI);
cairo_fill(cr);
cairo_pop_group_to_source(cr);
cairo_paint(cr);
cairo_pop_group_to_source(cr);
cairo_paint_with_alpha(cr, alpha);
final:
FINISH
}
Expand Down

0 comments on commit 62939f0

Please sign in to comment.