[gtk+] css image recolor: Load images at the proper scale
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css image recolor: Load images at the proper scale
- Date: Fri, 29 Jan 2016 22:32:16 +0000 (UTC)
commit b281c9d740c1536513618047353321ee379c2b72
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 29 17:30:10 2016 -0500
css image recolor: Load images at the proper scale
We should not hardcode a scale of 1, this leads to
pixellated upscaled images at scale=2, even if the source
is an svg. By passing the proper scale, we can load the
svg at the correct size.
gtk/gtkcssimagerecolor.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c
index 32c2849..c0aed94 100644
--- a/gtk/gtkcssimagerecolor.c
+++ b/gtk/gtkcssimagerecolor.c
@@ -101,7 +101,8 @@ lookup_symbolic_colors (GtkCssStyle *style,
static GtkCssImage *
gtk_css_image_recolor_load (GtkCssImageRecolor *recolor,
GtkCssStyle *style,
- GtkCssValue *palette)
+ GtkCssValue *palette,
+ gint scale)
{
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (recolor);
GtkIconInfo *info;
@@ -112,7 +113,7 @@ gtk_css_image_recolor_load (GtkCssImageRecolor *recolor,
lookup_symbolic_colors (style, palette, &fg, &success, &warning, &error);
- info = gtk_icon_info_new_for_file (url->file, 0, 1);
+ info = gtk_icon_info_new_for_file (url->file, 0, scale);
pixbuf = gtk_icon_info_load_symbolic (info, &fg, &success, &warning, &error, NULL, &gerror);
g_object_unref (info);
@@ -145,13 +146,16 @@ gtk_css_image_recolor_compute (GtkCssImage *image,
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
GtkCssValue *palette;
GtkCssImage *img;
+ int scale;
+
+ scale = _gtk_style_provider_private_get_scale (provider);
if (recolor->palette)
palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style);
else
palette = _gtk_css_value_ref (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_PALETTE));
- img = gtk_css_image_recolor_load (recolor, style, palette);
+ img = gtk_css_image_recolor_load (recolor, style, palette, scale);
_gtk_css_value_unref (palette);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]