Commit a7f42769 authored by Jeremie Knuesel's avatar Jeremie Knuesel

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.
parent 9752b8f0
...@@ -5,7 +5,7 @@ girara user interface library and several document libraries. ...@@ -5,7 +5,7 @@ girara user interface library and several document libraries.
Requirements Requirements
------------ ------------
gtk3 (>= 3.6) gtk3 (>= 3.10)
glib (>= 2.50) glib (>= 2.50)
girara (>= 0.2.8) girara (>= 0.2.8)
sqlite3 (optional, >= 3.5.9) sqlite3 (optional, >= 3.5.9)
......
...@@ -413,17 +413,17 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value, ...@@ -413,17 +413,17 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value,
static zathura_device_factors_t static zathura_device_factors_t
get_safe_device_factors(cairo_surface_t* surface) get_safe_device_factors(cairo_surface_t* surface)
{ {
zathura_device_factors_t factors; zathura_device_factors_t factors;
cairo_surface_get_device_scale(surface, &factors.x, &factors.y); cairo_surface_get_device_scale(surface, &factors.x, &factors.y);
if (fabs(factors.x) < DBL_EPSILON) { if (fabs(factors.x) < DBL_EPSILON) {
factors.x = 1.0; factors.x = 1.0;
} }
if (fabs(factors.y) < DBL_EPSILON) { if (fabs(factors.y) < DBL_EPSILON) {
factors.y = 1.0; factors.y = 1.0;
} }
return factors; return factors;
} }
#else #else
static zathura_device_factors_t static zathura_device_factors_t
...@@ -656,12 +656,12 @@ draw_thumbnail_image(cairo_surface_t* surface, size_t max_size) ...@@ -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 */ /* 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); zathura_device_factors_t device = get_safe_device_factors(surface);
const unsigned int user_width = width / device.x; const unsigned int unscaled_width = width / device.x;
const unsigned int user_height = height / device.y; 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; 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) { if (thumbnail == NULL) {
return NULL; return NULL;
} }
......
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