mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-11 02:33:47 +01:00
change arguments to page_calc_height_width
now accepts a document object and explicit width and height. This will make it easier to reuse this function for computing the document page cell width and height.
This commit is contained in:
parent
ed27f8b88e
commit
7329209d84
14
render.c
14
render.c
@ -600,8 +600,14 @@ render(ZathuraRenderRequest* request, ZathuraRenderer* renderer)
|
||||
/* create cairo surface */
|
||||
unsigned int page_width = 0;
|
||||
unsigned int page_height = 0;
|
||||
const double real_scale = page_calc_height_width(page, &page_height,
|
||||
&page_width, false);
|
||||
|
||||
zathura_document_t* document = zathura_page_get_document(page);
|
||||
double height = zathura_page_get_height(page);
|
||||
double width = zathura_page_get_width(page);
|
||||
|
||||
const double real_scale = page_calc_height_width(document, height, width,
|
||||
&page_height, &page_width, false);
|
||||
|
||||
|
||||
cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
|
||||
page_width, page_height);
|
||||
@ -705,7 +711,9 @@ render_all(zathura_t* zathura)
|
||||
zathura_page_t* page = zathura_document_get_page(zathura->document,
|
||||
page_id);
|
||||
unsigned int page_height = 0, page_width = 0;
|
||||
page_calc_height_width(page, &page_height, &page_width, true);
|
||||
double height = zathura_page_get_height(page);
|
||||
double width = zathura_page_get_width(page);
|
||||
page_calc_height_width(zathura->document, height, width, &page_height, &page_width, true);
|
||||
|
||||
GtkWidget* widget = zathura_page_get_widget(zathura, page);
|
||||
gtk_widget_set_size_request(widget, page_width, page_height);
|
||||
|
12
utils.c
12
utils.c
@ -241,17 +241,11 @@ error_ret:
|
||||
}
|
||||
|
||||
double
|
||||
page_calc_height_width(zathura_page_t* page, unsigned int* page_height, unsigned int* page_width, bool rotate)
|
||||
page_calc_height_width(zathura_document_t* document, double height, double width,
|
||||
unsigned int* page_height, unsigned int* page_width, bool rotate)
|
||||
{
|
||||
g_return_val_if_fail(page != NULL && page_height != NULL && page_width != NULL, 0.0);
|
||||
g_return_val_if_fail(document != NULL && page_height != NULL && page_width != NULL, 0.0);
|
||||
|
||||
zathura_document_t* document = zathura_page_get_document(page);
|
||||
if (document == NULL) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double height = zathura_page_get_height(page);
|
||||
double width = zathura_page_get_width(page);
|
||||
double scale = zathura_document_get_scale(document);
|
||||
double real_scale;
|
||||
|
||||
|
5
utils.h
5
utils.h
@ -96,7 +96,8 @@ zathura_rectangle_t recalc_rectangle(zathura_page_t* page, zathura_rectangle_t r
|
||||
* @return real scale after rounding
|
||||
*/
|
||||
double
|
||||
page_calc_height_width(zathura_page_t* page, unsigned int* page_height, unsigned int* page_width, bool rotate);
|
||||
page_calc_height_width(zathura_document_t* document, double height, double width,
|
||||
unsigned int* page_height, unsigned int* page_width, bool rotate);
|
||||
|
||||
/**
|
||||
* Compute the size of the entire document to be displayed (in pixels), taking
|
||||
@ -138,7 +139,7 @@ void document_draw_search_results(zathura_t* zathura, bool value);
|
||||
*
|
||||
* @param zathura The zathura instance
|
||||
* @param markup Enable markup
|
||||
* @return Version string
|
||||
* @return Version string
|
||||
*/
|
||||
char* zathura_get_version_string(zathura_t* zathura, bool markup);
|
||||
|
||||
|
@ -745,7 +745,10 @@ document_open(zathura_t* zathura, const char* path, const char* password,
|
||||
/* set widget size */
|
||||
unsigned int page_height = 0;
|
||||
unsigned int page_width = 0;
|
||||
page_calc_height_width(page, &page_height, &page_width, true);
|
||||
|
||||
double height = zathura_page_get_height(page);
|
||||
double width = zathura_page_get_width(page);
|
||||
page_calc_height_width(zathura->document, height, width, &page_height, &page_width, true);
|
||||
|
||||
gtk_widget_set_size_request(page_widget, page_width, page_height);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user