st-texture-cache: Use ANSI C-style comments
https://bugzilla.gnome.org/show_bug.cgi?id=660968
This commit is contained in:
parent
840e79c18c
commit
5d25716cee
@ -209,14 +209,15 @@ compute_pixbuf_scale (gint width,
|
|||||||
|
|
||||||
if (available_width >= 0 && available_height >= 0)
|
if (available_width >= 0 && available_height >= 0)
|
||||||
{
|
{
|
||||||
// This should keep the aspect ratio of the image intact, because if
|
/* This should keep the aspect ratio of the image intact, because if
|
||||||
// available_width < (available_height * width) / height
|
* available_width < (available_height * width) / height
|
||||||
// than
|
* then
|
||||||
// (available_width * height) / width < available_height
|
* (available_width * height) / width < available_height
|
||||||
// So we are guaranteed to either scale the image to have an available_width
|
* So we are guaranteed to either scale the image to have an available_width
|
||||||
// for width and height scaled accordingly OR have the available_height
|
* for width and height scaled accordingly OR have the available_height
|
||||||
// for height and width scaled accordingly, whichever scaling results
|
* for height and width scaled accordingly, whichever scaling results
|
||||||
// in the image that can fit both available dimensions.
|
* in the image that can fit both available dimensions.
|
||||||
|
*/
|
||||||
scaled_width = MIN (available_width, (available_height * width) / height);
|
scaled_width = MIN (available_width, (available_height * width) / height);
|
||||||
scaled_height = MIN (available_height, (available_width * height) / width);
|
scaled_height = MIN (available_height, (available_width * height) / width);
|
||||||
}
|
}
|
||||||
@ -235,7 +236,7 @@ compute_pixbuf_scale (gint width,
|
|||||||
scaled_width = scaled_height = 0;
|
scaled_width = scaled_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale the image only if that will not increase its original dimensions.
|
/* Scale the image only if that will not increase its original dimensions. */
|
||||||
if (scaled_width > 0 && scaled_height > 0 && scaled_width < width && scaled_height < height)
|
if (scaled_width > 0 && scaled_height > 0 && scaled_width < width && scaled_height < height)
|
||||||
{
|
{
|
||||||
*new_width = scaled_width;
|
*new_width = scaled_width;
|
||||||
@ -306,7 +307,7 @@ impl_load_pixbuf_gicon (GIcon *icon,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A private structure for keeping width and height.
|
/* A private structure for keeping width and height. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
@ -401,10 +402,11 @@ impl_load_pixbuf_data (const guchar *data,
|
|||||||
rotated_pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf);
|
rotated_pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf);
|
||||||
width_after_rotation = gdk_pixbuf_get_width (rotated_pixbuf);
|
width_after_rotation = gdk_pixbuf_get_width (rotated_pixbuf);
|
||||||
|
|
||||||
// There is currently no way to tell if the pixbuf will need to be rotated before it is loaded,
|
/* There is currently no way to tell if the pixbuf will need to be rotated before it is loaded,
|
||||||
// so we only check that once it is loaded, and reload it again if it needs to be rotated in order
|
* so we only check that once it is loaded, and reload it again if it needs to be rotated in order
|
||||||
// to use the available width and height correctly.
|
* to use the available width and height correctly.
|
||||||
// http://bugzilla.gnome.org/show_bug.cgi?id=579003
|
* See http://bugzilla.gnome.org/show_bug.cgi?id=579003
|
||||||
|
*/
|
||||||
if (width_before_rotation != width_after_rotation)
|
if (width_before_rotation != width_after_rotation)
|
||||||
{
|
{
|
||||||
g_object_unref (pixbuf_loader);
|
g_object_unref (pixbuf_loader);
|
||||||
@ -413,7 +415,7 @@ impl_load_pixbuf_data (const guchar *data,
|
|||||||
|
|
||||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||||
|
|
||||||
// We know that the image will later be rotated, so we reverse the available dimensions.
|
/* We know that the image will later be rotated, so we reverse the available dimensions. */
|
||||||
available_dimensions.width = available_height;
|
available_dimensions.width = available_height;
|
||||||
available_dimensions.height = available_width;
|
available_dimensions.height = available_width;
|
||||||
g_signal_connect (pixbuf_loader, "size-prepared",
|
g_signal_connect (pixbuf_loader, "size-prepared",
|
||||||
@ -568,7 +570,7 @@ impl_load_thumbnail (StTextureCache *cache,
|
|||||||
pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (thumbnail_factory, uri, mime_type);
|
pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (thumbnail_factory, uri, mime_type);
|
||||||
if (pixbuf)
|
if (pixbuf)
|
||||||
{
|
{
|
||||||
// we need to save the thumbnail so that we don't need to generate it again in the future
|
/* we need to save the thumbnail so that we don't need to generate it again in the future */
|
||||||
gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory, pixbuf, uri, mtime);
|
gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory, pixbuf, uri, mtime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user