Commit 42c1780a authored by Sebastian Ramacher's avatar Sebastian Ramacher
parent 70482cc0
......@@ -594,14 +594,16 @@ surface_small_enough(cairo_surface_t* surface, cairo_surface_t* old)
const unsigned int width = cairo_image_surface_get_width(surface);
const unsigned int height = cairo_image_surface_get_height(surface);
if (width * height > THUMBNAIL_MAX_SIZE)
if (width * height > THUMBNAIL_MAX_SIZE) {
return false;
}
if (old != NULL) {
const unsigned int width_old = cairo_image_surface_get_width(old);
const unsigned int height_old = cairo_image_surface_get_height(old);
if (width * height < width_old * height_old)
if (width * height < width_old * height_old) {
return false;
}
}
return true;
......@@ -613,8 +615,9 @@ draw_thumbnail_image(cairo_surface_t* surface)
unsigned int width = cairo_image_surface_get_width(surface);
unsigned int height = cairo_image_surface_get_height(surface);
double scale = sqrt((double)THUMBNAIL_INITIAL_SIZE / (width * height));
if (scale > THUMBNAIL_MAX_SCALE)
if (scale > THUMBNAIL_MAX_SCALE) {
scale = THUMBNAIL_MAX_SCALE;
}
width = width * scale;
height = height * scale;
......@@ -647,8 +650,9 @@ zathura_page_widget_update_surface(ZathuraPage* widget, cairo_surface_t* surface
cairo_surface_reference(surface);
if (surface_small_enough(surface, priv->thumbnail)) {
if (priv->thumbnail != NULL)
if (priv->thumbnail != NULL) {
cairo_surface_destroy(priv->thumbnail);
}
priv->thumbnail = surface;
cairo_surface_reference(surface);
} else if (new_render) {
......
......@@ -1406,8 +1406,9 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
}
const double new_zoom = zathura_document_get_scale(zathura->document);
if (fabs(new_zoom - old_zoom) <= DBL_EPSILON)
if (fabs(new_zoom - old_zoom) <= DBL_EPSILON) {
return false;
}
render_all(zathura);
refresh_view(zathura);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment