Commit 9cf32397 authored by Jeremie Knuesel's avatar Jeremie Knuesel

HiDPI: zero check using DBL_EPSILON

parent e0cf06ff
......@@ -452,7 +452,7 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
double device_scale_x;
double device_scale_y;
cairo_surface_get_device_scale(priv->thumbnail, &device_scale_x, &device_scale_y);
if (device_scale_x != 0.0 && device_scale_y != 0.0) {
if (fabs(device_scale_x) >= DBL_EPSILON && fabs(device_scale_y) >= DBL_EPSILON) {
pwidth *= device_scale_x;
pheight *= device_scale_y;
}
......
......@@ -745,7 +745,10 @@ render(render_job_t* job, ZathuraRenderRequest* request, ZathuraRenderer* render
double device_scale_y;
zathura_document_get_device_scale(document, &device_scale_x, &device_scale_y);
if (device_scale_x != 0.0 && device_scale_y != 0.0) {
gboolean scales_nonzero = (fabs(device_scale_x) >= DBL_EPSILON &&
fabs(device_scale_y) >= DBL_EPSILON);
if (scales_nonzero) {
page_width *= device_scale_x;
page_height *= device_scale_y;
}
......@@ -762,7 +765,7 @@ render(render_job_t* job, ZathuraRenderRequest* request, ZathuraRenderer* render
}
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,14,0)
if (device_scale_x != 0.0 && device_scale_y != 0.0) {
if (scales_nonzero) {
cairo_surface_set_device_scale(surface, device_scale_x, device_scale_y);
if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
cairo_surface_destroy(surface);
......
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