Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2013-11-22 06:09:12 +01:00
parent c2b35a02fe
commit 156b2e82e2

View File

@ -6,8 +6,9 @@
double double
page_calc_height_width(zathura_document_t* document, double height, double width, page_calc_height_width(zathura_document_t* document, double height,
unsigned int* page_height, unsigned int* page_width, bool rotate) double width, unsigned int* page_height,
unsigned int* page_width, bool rotate)
{ {
g_return_val_if_fail(document != NULL && page_height != NULL && page_width != NULL, 0.0); g_return_val_if_fail(document != NULL && page_height != NULL && page_width != NULL, 0.0);
@ -26,17 +27,16 @@ page_calc_height_width(zathura_document_t* document, double height, double width
} }
void void
page_calc_position(zathura_document_t* document, double x, double y, page_calc_position(zathura_document_t* document, double x, double y, double* xn,
double *xn, double *yn) { double* yn)
{
g_return_if_fail(document != NULL && xn != NULL && yn != NULL); g_return_if_fail(document != NULL && xn != NULL && yn != NULL);
unsigned int rot = zathura_document_get_rotation(document); const unsigned int rot = zathura_document_get_rotation(document);
if (rot == 90) { if (rot == 90) {
*xn = 1 - y; *xn = 1 - y;
*yn = x; *yn = x;
}else if (rot == 180) { } else if (rot == 180) {
*xn = 1 - x; *xn = 1 - x;
*yn = 1 - y; *yn = 1 - y;
} else if (rot == 270) { } else if (rot == 270) {
@ -48,11 +48,10 @@ page_calc_position(zathura_document_t* document, double x, double y,
} }
} }
unsigned int unsigned int
position_to_page_number(zathura_document_t* document, position_to_page_number(zathura_document_t* document, double pos_x,
double pos_x, double pos_y){ double pos_y)
{
g_return_val_if_fail(document != NULL, 0); g_return_val_if_fail(document != NULL, 0);
unsigned int doc_width, doc_height; unsigned int doc_width, doc_height;
@ -76,7 +75,9 @@ position_to_page_number(zathura_document_t* document,
void void
page_number_to_position(zathura_document_t* document, unsigned int page_number, page_number_to_position(zathura_document_t* document, unsigned int page_number,
double xalign, double yalign, double *pos_x, double *pos_y) { double xalign, double yalign, double* pos_x,
double* pos_y)
{
g_return_if_fail(document != NULL); g_return_if_fail(document != NULL);
unsigned int c0 = zathura_document_get_first_page_column(document); unsigned int c0 = zathura_document_get_first_page_column(document);
@ -115,7 +116,8 @@ page_number_to_position(zathura_document_t* document, unsigned int page_number,
bool bool
page_is_visible(zathura_document_t *document, unsigned int page_number) { page_is_visible(zathura_document_t *document, unsigned int page_number)
{
g_return_val_if_fail(document != NULL, false); g_return_val_if_fail(document != NULL, false);
/* position at the center of the viewport */ /* position at the center of the viewport */