From a7f42769c6695d41c131c18a6eeb26250319a230 Mon Sep 17 00:00:00 2001 From: Jeremie Knuesel Date: Thu, 25 Jan 2018 08:40:54 +0100 Subject: [PATCH] Fix GTK+ version in README, other minor fixes Minor fixes include a rewording of "user size" to "unscaled size": Cairo has user units, (unscaled) device units and (scaled) device pixels. --- README | 2 +- zathura/page-widget.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README b/README index dbeaf27..6f39e02 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ girara user interface library and several document libraries. Requirements ------------ -gtk3 (>= 3.6) +gtk3 (>= 3.10) glib (>= 2.50) girara (>= 0.2.8) sqlite3 (optional, >= 3.5.9) diff --git a/zathura/page-widget.c b/zathura/page-widget.c index ebb41f5..a0d59ae 100644 --- a/zathura/page-widget.c +++ b/zathura/page-widget.c @@ -413,17 +413,17 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value, static zathura_device_factors_t get_safe_device_factors(cairo_surface_t* surface) { - zathura_device_factors_t factors; - cairo_surface_get_device_scale(surface, &factors.x, &factors.y); + zathura_device_factors_t factors; + cairo_surface_get_device_scale(surface, &factors.x, &factors.y); - if (fabs(factors.x) < DBL_EPSILON) { - factors.x = 1.0; - } - if (fabs(factors.y) < DBL_EPSILON) { - factors.y = 1.0; - } + if (fabs(factors.x) < DBL_EPSILON) { + factors.x = 1.0; + } + if (fabs(factors.y) < DBL_EPSILON) { + factors.y = 1.0; + } - return factors; + return factors; } #else static zathura_device_factors_t @@ -656,12 +656,12 @@ draw_thumbnail_image(cairo_surface_t* surface, size_t max_size) /* note: this always returns 1 and 1 if Cairo too old for device scale API */ zathura_device_factors_t device = get_safe_device_factors(surface); - const unsigned int user_width = width / device.x; - const unsigned int user_height = height / device.y; + const unsigned int unscaled_width = width / device.x; + const unsigned int unscaled_height = height / device.y; - /* create thumbnail surface, taking width and height as device sizes */ + /* create thumbnail surface, taking width and height as _unscaled_ device units */ cairo_surface_t *thumbnail; - thumbnail = cairo_surface_create_similar(surface, CAIRO_CONTENT_COLOR, user_width, user_height); + thumbnail = cairo_surface_create_similar(surface, CAIRO_CONTENT_COLOR, unscaled_width, unscaled_height); if (thumbnail == NULL) { return NULL; }