texture-cache: use scale factor for load_uri_async()

https://bugzilla.gnome.org/show_bug.cgi?id=726907
This commit is contained in:
Cosimo Cecchi 2014-03-22 21:05:53 -07:00
parent 9ecf466ce1
commit 9c88fec4fc
4 changed files with 17 additions and 7 deletions

View File

@ -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() {

View File

@ -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',

View File

@ -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);
}

View File

@ -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,