Cache result of pow

This commit is contained in:
Sebastian Ramacher 2019-10-11 18:16:12 +02:00
parent fdbac740ce
commit f9e5085700

View file

@ -1395,8 +1395,9 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
}
} else if (argument->n == ZOOM_SMOOTH) {
const double dy = (event != NULL) ? event->y : 1.0;
girara_debug("Increasing zoom by %0.2f.", pow(zoom_step, -dy) - 1.0);
zathura_document_set_zoom(zathura->document, old_zoom * pow(zoom_step, -dy));
const double z = pow(zoom_step, -dy);
girara_debug("Increasing zoom by %0.2f.", z - 1.0);
zathura_document_set_zoom(zathura->document, old_zoom * z);
} else {
girara_debug("Setting zoom to 1.");
zathura_document_set_zoom(zathura->document, 1.0);