summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@blame.services>2021-06-13 20:59:28 +0200
committerDave Davenport <qball@blame.services>2021-06-13 20:59:28 +0200
commita0b8a05315d4ed4f89c843a1c4c7420ce424d875 (patch)
tree4dcb0f7ac0a0ce6fd257ea084cef97e56ae46c03
parent2c325b3f09eaad94d1ea07b999fcd5872be6b8f1 (diff)
[Widget] Change scaling of background-image
-rw-r--r--include/rofi-types.h2
-rw-r--r--source/theme.c12
2 files changed, 6 insertions, 8 deletions
diff --git a/include/rofi-types.h b/include/rofi-types.h
index 769b9290..624f09d9 100644
--- a/include/rofi-types.h
+++ b/include/rofi-types.h
@@ -187,8 +187,8 @@ typedef struct
/** Stop color */
ThemeColor stop;
+ /** cached image */
uint32_t surface_id;
- uint32_t surface_size;
} RofiImage;
diff --git a/source/theme.c b/source/theme.c
index fe8a28d3..3cecd084 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -930,17 +930,15 @@ void rofi_theme_get_image ( const widget *widget, const char *property, cairo_t
return;
}
if ( p->value.image.type == ROFI_IMAGE_URL ) {
- uint32_t maxs = MAX(widget->h, widget->w);
- if ( p->value.image.surface_id == 0 || p->value.image.surface_size != maxs ) {
- p->value.image.surface_id = rofi_icon_fetcher_query ( p->value.image.url, maxs );
- p->value.image.surface_size = maxs;
+ if ( p->value.image.surface_id == 0 ) {
+ p->value.image.surface_id = rofi_icon_fetcher_query ( p->value.image.url, -1 );
}
cairo_surface_t *img = rofi_icon_fetcher_get ( p->value.image.surface_id );
if ( img != NULL ) {
- cairo_surface_reference ( img );
- cairo_set_source_surface ( d, img, 0.0, 0.0 );
- cairo_surface_destroy ( img );
+ cairo_pattern_t * pat = cairo_pattern_create_for_surface ( img );
+ cairo_set_source ( d, pat );
+ cairo_pattern_destroy ( pat );
}
} else if ( p->value.image.type == ROFI_IMAGE_LINEAR_GRADIENT ) {
cairo_pattern_t * pat = cairo_pattern_create_linear (0.0,0.0, widget->w, 0.0);