Reuse draw_rounded_rect() for xshape drawing
This commit is contained in:
		
							parent
							
								
									85ea8b8aa8
								
							
						
					
					
						commit
						73b7176e0b
					
				@ -416,7 +416,7 @@ static int frame_internal_radius (int r, int w, int h)
 | 
			
		||||
 * The top corners will get rounded by `corner_radius`, if `first` is set.
 | 
			
		||||
 * Respectably the same for `last` with the bottom corners.
 | 
			
		||||
 */
 | 
			
		||||
static void draw_rounded_rect(cairo_t *c, int x, int y, int width, int height, int corner_radius, bool first, bool last)
 | 
			
		||||
void draw_rounded_rect(cairo_t *c, int x, int y, int width, int height, int corner_radius, bool first, bool last)
 | 
			
		||||
{
 | 
			
		||||
        const float degrees = M_PI / 180.0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,8 @@ void draw_setup(void);
 | 
			
		||||
 | 
			
		||||
void draw(void);
 | 
			
		||||
 | 
			
		||||
void draw_rounded_rect(cairo_t *c, int x, int y, int width, int height, int corner_radius, bool first, bool last);
 | 
			
		||||
 | 
			
		||||
void draw_deinit(void);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								src/x11/x.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/x11/x.c
									
									
									
									
									
								
							@ -89,11 +89,6 @@ static void x_win_round_corners(struct window_x11 *win, const int rad)
 | 
			
		||||
{
 | 
			
		||||
        const int width = win->dim.w;
 | 
			
		||||
        const int height = win->dim.h;
 | 
			
		||||
        unsigned const int coords[] = {
 | 
			
		||||
	        0 + rad,
 | 
			
		||||
                width - rad,
 | 
			
		||||
                height - rad,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        Pixmap mask;
 | 
			
		||||
        cairo_surface_t * cxbm;
 | 
			
		||||
@ -112,12 +107,10 @@ static void x_win_round_corners(struct window_x11 *win, const int rad)
 | 
			
		||||
        cairo_paint(cr);
 | 
			
		||||
        cairo_set_source_rgba(cr, 1, 1, 1, 1);
 | 
			
		||||
 | 
			
		||||
        cairo_new_path(cr);
 | 
			
		||||
        cairo_arc(cr, coords[0], coords[0], rad,  M_PI,   -M_PI_2);
 | 
			
		||||
        cairo_arc(cr, coords[1], coords[0], rad, -M_PI_2,  0);
 | 
			
		||||
        cairo_arc(cr, coords[1], coords[2], rad,  0,       M_PI_2);
 | 
			
		||||
        cairo_arc(cr, coords[0], coords[2], rad,  M_PI_2,  M_PI);
 | 
			
		||||
        cairo_close_path(cr);
 | 
			
		||||
        draw_rounded_rect(cr, 0, 0,
 | 
			
		||||
                          width, height,
 | 
			
		||||
                          rad,
 | 
			
		||||
                          true, true);
 | 
			
		||||
        cairo_fill(cr);
 | 
			
		||||
 | 
			
		||||
        cairo_show_page(cr);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user