29 #define G_LOG_DOMAIN "Widgets.Icon" 75 cairo_surface_reference ( b->
icon );
78 if ( b->
icon == NULL ) {
81 int iconh = cairo_image_surface_get_height ( b->
icon );
82 int iconw = cairo_image_surface_get_width ( b->
icon );
83 int icons = MAX ( iconh, iconw );
84 double scale = (double) b->
size / icons;
88 cairo_translate ( draw, ( b->
size - iconw * scale ) / 2.0, ( b->
size - iconh * scale ) / 2.0 );
89 cairo_scale ( draw, scale, scale );
90 cairo_set_source_surface ( draw, b->
icon, 0, 0 );
92 cairo_restore ( draw );
100 cairo_surface_destroy ( b->
icon );
120 cairo_surface_destroy (
icon->
icon );
124 cairo_surface_reference ( surf );
132 icon *b = g_malloc0 (
sizeof (
icon ) );
static int icon_get_desired_width(widget *widget)
const char * rofi_theme_get_string(const widget *widget, const char *property, const char *def)
void icon_set_surface(icon *icon, cairo_surface_t *surf)
static void icon_free(widget *wid)
cairo_surface_t * rofi_icon_fetcher_get(const uint32_t uid)
uint32_t rofi_icon_fetcher_query(const char *name, const int size)
icon * icon_create(widget *parent, const char *name)
static int icon_get_desired_height(widget *widget)
static void icon_resize(widget *widget, short w, short h)
int rofi_theme_get_integer(const widget *widget, const char *property, int def)
static void icon_draw(widget *wid, cairo_t *draw)