Clean up
This commit is contained in:
parent
ad1ff06aff
commit
720464327c
@ -66,8 +66,6 @@ typedef struct entry Entry;
|
|||||||
typedef struct item Item;
|
typedef struct item Item;
|
||||||
typedef struct row Row;
|
typedef struct row Row;
|
||||||
|
|
||||||
static const double g_permitted_width_multiplier = 2;
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
struct entry {
|
struct entry {
|
||||||
@ -305,8 +303,8 @@ rescale_thumbnail(cairo_surface_t *thumbnail, double row_height)
|
|||||||
|
|
||||||
double scale_x = 1;
|
double scale_x = 1;
|
||||||
double scale_y = 1;
|
double scale_y = 1;
|
||||||
if (width > g_permitted_width_multiplier * height) {
|
if (width > FIV_IO_WIDE_THUMBNAIL_COEFFICIENT * height) {
|
||||||
scale_x = g_permitted_width_multiplier * row_height / width;
|
scale_x = FIV_IO_WIDE_THUMBNAIL_COEFFICIENT * row_height / width;
|
||||||
scale_y = round(scale_x * height) / height;
|
scale_y = round(scale_x * height) / height;
|
||||||
} else {
|
} else {
|
||||||
scale_y = row_height / height;
|
scale_y = row_height / height;
|
||||||
@ -823,8 +821,9 @@ fiv_browser_get_preferred_width(GtkWidget *widget, gint *minimum, gint *natural)
|
|||||||
|
|
||||||
GtkBorder padding = {};
|
GtkBorder padding = {};
|
||||||
gtk_style_context_get_padding(style, GTK_STATE_FLAG_NORMAL, &padding);
|
gtk_style_context_get_padding(style, GTK_STATE_FLAG_NORMAL, &padding);
|
||||||
*minimum = *natural = g_permitted_width_multiplier * self->item_height +
|
*minimum = *natural =
|
||||||
padding.left + 2 * self->item_border_x + padding.right;
|
FIV_IO_WIDE_THUMBNAIL_COEFFICIENT * self->item_height + padding.left +
|
||||||
|
2 * self->item_border_x + padding.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
7
fiv-io.c
7
fiv-io.c
@ -2763,9 +2763,6 @@ FivIoThumbnailSizeInfo
|
|||||||
FIV_IO_THUMBNAIL_SIZES(XX)};
|
FIV_IO_THUMBNAIL_SIZES(XX)};
|
||||||
#undef XX
|
#undef XX
|
||||||
|
|
||||||
// TODO(p): Put the constant in a header file, share with fiv-browser.c.
|
|
||||||
static const double g_wide_thumbnail_factor = 2;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_thumbnail_lq(cairo_surface_t *surface)
|
mark_thumbnail_lq(cairo_surface_t *surface)
|
||||||
{
|
{
|
||||||
@ -2793,8 +2790,8 @@ rescale_thumbnail(cairo_surface_t *thumbnail, double row_height)
|
|||||||
|
|
||||||
double scale_x = 1;
|
double scale_x = 1;
|
||||||
double scale_y = 1;
|
double scale_y = 1;
|
||||||
if (width > g_wide_thumbnail_factor * height) {
|
if (width > FIV_IO_WIDE_THUMBNAIL_COEFFICIENT * height) {
|
||||||
scale_x = g_wide_thumbnail_factor * row_height / width;
|
scale_x = FIV_IO_WIDE_THUMBNAIL_COEFFICIENT * row_height / width;
|
||||||
scale_y = round(scale_x * height) / height;
|
scale_y = round(scale_x * height) / height;
|
||||||
} else {
|
} else {
|
||||||
scale_y = row_height / height;
|
scale_y = row_height / height;
|
||||||
|
4
fiv-io.h
4
fiv-io.h
@ -134,6 +134,10 @@ typedef struct _FivIoThumbnailSizeInfo {
|
|||||||
extern FivIoThumbnailSizeInfo
|
extern FivIoThumbnailSizeInfo
|
||||||
fiv_io_thumbnail_sizes[FIV_IO_THUMBNAIL_SIZE_COUNT];
|
fiv_io_thumbnail_sizes[FIV_IO_THUMBNAIL_SIZE_COUNT];
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FIV_IO_WIDE_THUMBNAIL_COEFFICIENT = 2
|
||||||
|
};
|
||||||
|
|
||||||
/// Returns this user's root thumbnail directory.
|
/// Returns this user's root thumbnail directory.
|
||||||
gchar *fiv_io_get_thumbnail_root(void);
|
gchar *fiv_io_get_thumbnail_root(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user