Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
abc7dead
Commit
abc7dead
authored
Dec 26, 2010
by
Moritz Lipp
Browse files
Update djvu/pdf render functions
parent
7627c56d
Changes
2
Hide whitespace changes
Inline
Side-by-side
ft/djvu/djvu.c
View file @
abc7dead
...
...
@@ -196,8 +196,8 @@ djvu_page_render(zathura_page_t* page)
}
/* calculate sizes */
unsigned
int
page_width
=
page
->
width
;
unsigned
int
page_height
=
page
->
height
;
unsigned
int
page_width
=
Zathura
.
document
->
scale
*
page
->
width
;
unsigned
int
page_height
=
Zathura
.
document
->
scale
*
page
->
height
;
/* init ddjvu render data */
ddjvu_rect_t
rrect
=
{
0
,
0
,
page_width
,
page_height
};
...
...
@@ -209,9 +209,9 @@ djvu_page_render(zathura_page_t* page)
switch
(
Zathura
.
document
->
rotate
)
{
case
90
:
tmp
=
page_width
;
dim_temp
=
page_width
;
page_width
=
page_height
;
page_height
=
page
_tmp
;
page_height
=
dim
_t
e
mp
;
rotation
=
DDJVU_ROTATE_90
;
break
;
...
...
@@ -219,9 +219,9 @@ djvu_page_render(zathura_page_t* page)
rotation
=
DDJVU_ROTATE_180
;
break
;
case
270
:
tmp
=
page_width
;
dim_temp
=
page_width
;
page_width
=
page_height
;
page_height
=
page
_tmp
;
page_height
=
dim
_t
e
mp
;
rotation
=
DDJVU_ROTATE_270
;
break
;
...
...
ft/pdf/pdf.c
View file @
abc7dead
/* See LICENSE file for license and copyright information */
#include <stdlib.h>
#include <cairo.h>
#include <poppler/glib/poppler.h>
#include "pdf.h"
#include "../../zathura.h"
bool
pdf_document_open
(
zathura_document_t
*
document
)
...
...
@@ -238,5 +241,48 @@ pdf_page_form_fields_get(zathura_page_t* page)
cairo_surface_t
*
pdf_page_render
(
zathura_page_t
*
page
)
{
return
NULL
;
if
(
Zathura
.
document
||
!
page
||
!
page
->
data
||
!
page
->
document
)
{
return
NULL
;
}
/* create cairo data */
cairo_surface_t
*
surface
=
cairo_image_surface_create
(
CAIRO_FORMAT_RGB24
,
page
->
width
,
page
->
height
);
if
(
!
surface
)
{
return
NULL
;
}
cairo_t
*
cairo
=
cairo_create
(
surface
);
if
(
!
cairo
)
{
cairo_surface_destroy
(
surface
);
return
NULL
;
}
switch
(
Zathura
.
document
->
rotate
)
{
case
90
:
cairo_translate
(
cairo
,
page
->
width
,
0
);
break
;
case
180
:
cairo_translate
(
cairo
,
page
->
width
,
page
->
height
);
break
;
case
270
:
cairo_translate
(
cairo
,
0
,
page
->
height
);
break
;
default:
cairo_translate
(
cairo
,
0
,
0
);
break
;
}
cairo_scale
(
cairo
,
Zathura
.
document
->
scale
,
Zathura
.
document
->
scale
);
cairo_rotate
(
cairo
,
Zathura
.
document
->
rotate
*
G_PI
/
180
.
0
);
/* render */
poppler_page_render
(
page
->
data
,
cairo
);
cairo_paint
(
cairo
);
cairo_destroy
(
cairo
);
return
surface
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment