From 9c88fec4fce4cf67778abd751abe794f2f136241 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sat, 22 Mar 2014 21:05:53 -0700 Subject: [PATCH] texture-cache: use scale factor for load_uri_async() https://bugzilla.gnome.org/show_bug.cgi?id=726907 --- js/gdm/loginDialog.js | 7 +++++-- js/ui/components/telepathyClient.js | 3 ++- src/st/st-texture-cache.c | 11 ++++++++--- src/st/st-texture-cache.h | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 68b4ee189..0b8940a34 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -537,9 +537,12 @@ const LoginDialog = new Lang.Class({ return; this._logoBin.destroy_all_children(); - if (this._logoFileUri) + if (this._logoFileUri) { + let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; this._logoBin.add_child(this._textureCache.load_uri_async(this._logoFileUri, - -1, _LOGO_ICON_HEIGHT)); + -1, _LOGO_ICON_HEIGHT, + scaleFactor)); + } }, _updateLogo: function() { diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index cbe7a18f8..49f1e3e1e 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -1270,7 +1270,8 @@ const SubscriptionRequestNotification = new Lang.Class({ if (file) { let uri = file.get_uri(); - iconBox.child = textureCache.load_uri_async(uri, iconBox._size, iconBox._size); + let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; + iconBox.child = textureCache.load_uri_async(uri, iconBox._size, iconBox._size, scaleFactor); } else { iconBox.child = new St.Icon({ icon_name: 'avatar-default', diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index 8916ebc73..fbdf7d6df 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -265,6 +265,7 @@ typedef struct { guint width; guint height; + guint scale; GSList *textures; GtkIconInfo *icon_info; @@ -510,7 +511,7 @@ load_pixbuf_thread (GSimpleAsyncResult *result, g_assert (data != NULL); g_assert (data->uri != NULL); - pixbuf = impl_load_pixbuf_file (data->uri, data->width, data->height, 1, &error); + pixbuf = impl_load_pixbuf_file (data->uri, data->width, data->height, data->scale, &error); if (error != NULL) { @@ -1006,7 +1007,8 @@ load_gicon_with_colors (StTextureCache *cache, request->policy = policy; request->colors = colors ? st_icon_colors_ref (colors) : NULL; request->icon_info = info; - request->width = request->height = size * scale; + request->width = request->height = size; + request->scale = scale; request->enforced_square = TRUE; load_texture_async (cache, request); @@ -1280,6 +1282,7 @@ st_texture_cache_load_sliced_image (StTextureCache *cache, * @uri: uri of the image file from which to create a pixbuf * @available_width: available width for the image, can be -1 if not limited * @available_height: available height for the image, can be -1 if not limited + * @scale: scale factor of the display * * Asynchronously load an image. Initially, the returned texture will have a natural * size of zero. At some later point, either the image will be loaded successfully @@ -1291,7 +1294,8 @@ ClutterActor * st_texture_cache_load_uri_async (StTextureCache *cache, const gchar *uri, int available_width, - int available_height) + int available_height, + int scale) { ClutterActor *texture; AsyncTextureLoadData *request; @@ -1320,6 +1324,7 @@ st_texture_cache_load_uri_async (StTextureCache *cache, request->policy = policy; request->width = available_width; request->height = available_height; + request->scale = scale; load_texture_async (cache, request); } diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h index 07f40adc4..af14181b9 100644 --- a/src/st/st-texture-cache.h +++ b/src/st/st-texture-cache.h @@ -90,7 +90,8 @@ ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache, ClutterActor *st_texture_cache_load_uri_async (StTextureCache *cache, const gchar *uri, int available_width, - int available_height); + int available_height, + int scale); CoglHandle st_texture_cache_load_file_to_cogl_texture (StTextureCache *cache, const gchar *file_path,