Limit decimal part

This commit is contained in:
Sebastian Ramacher 2018-03-18 19:21:26 +01:00
parent 63ef90697e
commit 6976707376
5 changed files with 10 additions and 10 deletions

View File

@ -549,7 +549,7 @@ zathura_document_set_device_factors(zathura_document_t* document,
return;
}
if (fabs(x_factor) < DBL_EPSILON || fabs(y_factor) < DBL_EPSILON) {
girara_debug("Ignoring new device factors %f and %f: too small",
girara_debug("Ignoring new device factors %0.2f and %0.2f: too small",
x_factor, y_factor);
return;
}

View File

@ -847,7 +847,7 @@ render_all(zathura_t* zathura)
const double width = zathura_page_get_width(page);
page_calc_height_width(zathura->document, height, width, &page_height, &page_width, true);
girara_debug("Queuing resize for page %u to %u x %u (%f x %f).", page_id, page_width, page_height, width, height);
girara_debug("Queuing resize for page %u to %u x %u (%0.2f x %0.2f).", page_id, page_width, page_height, width, height);
GtkWidget* widget = zathura_page_get_widget(zathura, page);
if (widget != NULL) {
gtk_widget_set_size_request(widget, page_width, page_height);

View File

@ -1383,22 +1383,22 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
/* specify new zoom value */
if (argument->n == ZOOM_IN) {
girara_debug("Increasing zoom by %f.", zoom_step - 1.0);
girara_debug("Increasing zoom by %0.2f.", zoom_step - 1.0);
zathura_document_set_zoom(zathura->document, old_zoom * zoom_step);
} else if (argument->n == ZOOM_OUT) {
girara_debug("Decreasing zoom by %f.", zoom_step - 1.0);
girara_debug("Decreasing zoom by %0.2f.", zoom_step - 1.0);
zathura_document_set_zoom(zathura->document, old_zoom / zoom_step);
} else if (argument->n == ZOOM_SPECIFIC) {
if (t == 0) {
girara_debug("Setting zoom to 1.");
zathura_document_set_zoom(zathura->document, 1.0);
} else {
girara_debug("Setting zoom to %f.", t / 100.0);
girara_debug("Setting zoom to %0.2f.", t / 100.0);
zathura_document_set_zoom(zathura->document, t / 100.0);
}
} else if (argument->n == ZOOM_SMOOTH) {
const double dy = (event != NULL) ? event->y : 1.0;
girara_debug("Increasing zoom by %f.", zoom_step * dy - 1.0);
girara_debug("Increasing zoom by %0.2f.", zoom_step * dy - 1.0);
zathura_document_set_zoom(zathura->document, old_zoom + zoom_step * dy);
} else {
girara_debug("Setting zoom to 1.");
@ -1411,11 +1411,11 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
const double new_zoom = zathura_document_get_zoom(zathura->document);
if (fabs(new_zoom - old_zoom) <= DBL_EPSILON) {
girara_debug("New and old zoom level are too close: %f vs. %f, diff = %f", new_zoom, old_zoom, fabs(new_zoom - old_zoom));
girara_debug("New and old zoom level are too close: %0.2f vs. %0.2f", new_zoom, old_zoom);
return false;
}
girara_debug("Re-rendering with new zoom level %f.", new_zoom);
girara_debug("Re-rendering with new zoom level %0.2f.", new_zoom);
render_all(zathura);
refresh_view(zathura);

View File

@ -314,7 +314,7 @@ synctex_highlight_rects(zathura_t* zathura, unsigned int page,
}
/* move to position */
girara_debug("Jumping to page %u position (%f, %f).", page, pos_x, pos_y);
girara_debug("Jumping to page %u position (%0.2f, %0.2f).", page, pos_x, pos_y);
zathura_jumplist_add(zathura);
position_set(zathura, pos_x, pos_y);
zathura_jumplist_add(zathura);

View File

@ -194,7 +194,7 @@ zathura_update_view_ppi(zathura_t* zathura)
double current_ppi = zathura_document_get_viewport_ppi(zathura->document);
if (fabs(ppi - current_ppi) > DBL_EPSILON) {
girara_debug("monitor width: %d mm, pixels: %d, ppi: %f", width_mm, monitor_geom.width, ppi);
girara_debug("monitor width: %d mm, pixels: %d, ppi: %0.2f", width_mm, monitor_geom.width, ppi);
zathura_document_set_viewport_ppi(zathura->document, ppi);
render_all(zathura);
refresh_view(zathura);