mirror of https://github.com/davatorium/rofi.git
[TextBox] Fix icon alignment issue when scaling icon.
This commit is contained in:
parent
939495f00b
commit
4e3830a519
|
@ -380,16 +380,15 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
||||||
// draw Icon
|
// draw Icon
|
||||||
if ( (tb->flags&TB_ICON) == TB_ICON && tb->icon != NULL ) {
|
if ( (tb->flags&TB_ICON) == TB_ICON && tb->icon != NULL ) {
|
||||||
int iconheight = textbox_get_font_height ( tb );
|
int iconheight = textbox_get_font_height ( tb );
|
||||||
int translatex = 0;
|
|
||||||
cairo_save(draw);
|
cairo_save(draw);
|
||||||
|
|
||||||
/*int iconw = cairo_image_surface_get_width (tb->icon);*/
|
/*int iconw = cairo_image_surface_get_width (tb->icon);*/
|
||||||
int iconh = cairo_image_surface_get_height (tb->icon);
|
int iconh = cairo_image_surface_get_height (tb->icon);
|
||||||
double scale = (double)iconheight / iconh;
|
double scale = (double)iconheight / iconh;
|
||||||
|
|
||||||
cairo_translate(draw, translatex, 0);
|
cairo_translate(draw, x, y);
|
||||||
cairo_scale(draw, scale, scale);
|
cairo_scale(draw, scale, scale);
|
||||||
cairo_set_source_surface(draw, tb->icon, x, y);
|
cairo_set_source_surface(draw, tb->icon, 0,0);
|
||||||
cairo_paint(draw);
|
cairo_paint(draw);
|
||||||
cairo_restore(draw);
|
cairo_restore(draw);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue