mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-14 20:51:07 +00:00
picture: Fix hi-dpi image handling
The idea behind this code was to let scalable images (i.e. mainly SVGs) provide twice as much detail when the scale is 2. But we were also using a scaler for pngs, causing them to be too small on a hidpi screen. Fix that. Note that there are cases where you want scaling for pngs (when you display them scaled down, so the image has 'hidden' detail). But we are not attempting to handle that situation automatically.
This commit is contained in:
parent
071c6c60c0
commit
cd79159420
@ -587,10 +587,12 @@ gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||
|
||||
if (gdk_texture_can_load (bytes))
|
||||
{
|
||||
/* We know these formats can't be scaled */
|
||||
texture = gdk_texture_new_from_bytes (bytes, NULL);
|
||||
if (texture == NULL)
|
||||
return NULL;
|
||||
|
||||
/* We know these formats can't be scaled */
|
||||
paintable = GDK_PAINTABLE (texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -610,15 +612,15 @@ gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
|
||||
g_object_unref (loader);
|
||||
|
||||
if (loader_data.scale_factor != 1)
|
||||
paintable = gtk_scaler_new (GDK_PAINTABLE (texture), loader_data.scale_factor);
|
||||
else
|
||||
paintable = g_object_ref (GDK_PAINTABLE (texture));
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
if (loader_data.scale_factor != 1)
|
||||
paintable = gtk_scaler_new (GDK_PAINTABLE (texture), loader_data.scale_factor);
|
||||
else
|
||||
paintable = g_object_ref ((GdkPaintable *)texture);
|
||||
|
||||
g_object_unref (texture);
|
||||
|
||||
return paintable;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user