[gnome-shell/wip/resource-scale: 1/7] StIconCache: Separate 'scale' to 'paint_scale' and 'resource_scale'
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/resource-scale: 1/7] StIconCache: Separate 'scale' to 'paint_scale' and 'resource_scale'
- Date: Mon, 31 Jul 2017 12:38:16 +0000 (UTC)
commit 35534147b293e34fc64516f3fe448dc78db85c91
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu May 11 12:25:00 2017 +0800
StIconCache: Separate 'scale' to 'paint_scale' and 'resource_scale'
Instead of just passing a scale when getting a cached icon, pass both a
'paint_scale', the scale of which the icon will be painted on the
stage, and a 'resource_scale', the scale of the resource used for
painting.
In effect, the texture size will use the scale 'paint_scale *
resource_scale' while the size of the actor will use 'paint_scale' when
detirmining the size.
src/shell-window-tracker.c | 2 +-
src/st/st-icon.c | 6 ++++--
src/st/st-texture-cache.c | 14 ++++++++++----
src/st/st-texture-cache.h | 3 ++-
4 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c
index f87e6a3..13f2cb8 100644
--- a/src/shell-window-tracker.c
+++ b/src/shell-window-tracker.c
@@ -901,7 +901,7 @@ shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size)
themed = g_themed_icon_new (icon_name);
texture = st_texture_cache_load_gicon (st_texture_cache_get_default (),
- NULL, themed, size, scale);
+ NULL, themed, size, scale, 1);
g_object_unref (G_OBJECT (themed));
return texture;
}
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index 8fd82d5..c5a06ed 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -369,14 +369,16 @@ st_icon_update (StIcon *icon)
theme_node,
priv->gicon,
priv->icon_size,
- scale);
+ scale,
+ 1);
if (priv->pending_texture == NULL && priv->fallback_gicon != NULL)
priv->pending_texture = st_texture_cache_load_gicon (cache,
theme_node,
priv->fallback_gicon,
priv->icon_size,
- scale);
+ scale,
+ 1);
if (priv->pending_texture)
{
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index e8a832d..ed97440 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -842,7 +842,8 @@ ensure_request (StTextureCache *cache,
* if the icon must not be recolored
* @icon: the #GIcon to load
* @size: Size of themed
- * @scale: Scale factor of display
+ * @paint_scale: Scale factor of display
+ * @resource_scale: Resource scale factor
*
* This method returns a new #ClutterActor for a given #GIcon. If the
* icon isn't loaded already, the texture will be filled
@@ -855,9 +856,11 @@ st_texture_cache_load_gicon (StTextureCache *cache,
StThemeNode *theme_node,
GIcon *icon,
gint size,
- gint scale)
+ gint paint_scale,
+ gint resource_scale)
{
AsyncTextureLoadData *request;
+ gint scale;
ClutterActor *texture;
char *gicon_string;
char *key;
@@ -889,7 +892,10 @@ st_texture_cache_load_gicon (StTextureCache *cache,
else
lookup_flags |= GTK_ICON_LOOKUP_DIR_LTR;
- info = gtk_icon_theme_lookup_by_gicon_for_scale (theme, icon, size, scale, lookup_flags);
+ scale = paint_scale * resource_scale;
+ info = gtk_icon_theme_lookup_by_gicon_for_scale (theme, icon,
+ size, scale,
+ lookup_flags);
if (info == NULL)
return NULL;
@@ -918,7 +924,7 @@ st_texture_cache_load_gicon (StTextureCache *cache,
g_free (gicon_string);
texture = (ClutterActor *) create_default_texture ();
- clutter_actor_set_size (texture, size * scale, size * scale);
+ clutter_actor_set_size (texture, size * paint_scale, size * paint_scale);
if (ensure_request (cache, key, policy, &request, texture))
{
diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h
index 26f9c30..b169f99 100644
--- a/src/st/st-texture-cache.h
+++ b/src/st/st-texture-cache.h
@@ -70,7 +70,8 @@ ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
StThemeNode *theme_node,
GIcon *icon,
gint size,
- gint scale);
+ gint paint_scale,
+ gint resource_scale);
ClutterActor *st_texture_cache_load_file_async (StTextureCache *cache,
GFile *file,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]