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
757f3d82
Commit
757f3d82
authored
Oct 28, 2014
by
Lingzhu Xiang
Browse files
Avoid large amount of scaling for pages at low zoom level
parent
b0c068f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
page-widget.c
View file @
757f3d82
...
...
@@ -580,7 +580,7 @@ zathura_page_widget_redraw_canvas(ZathuraPage* pageview)
}
/* high enough but not causing noticable delay in scaling */
#define THUMBNAIL_MAX_SIZE (
8
*1024*1024)
#define THUMBNAIL_MAX_SIZE (
4
*1024*1024)
/* smaller than max to be replaced by actual renders */
#define THUMBNAIL_INITIAL_SIZE (THUMBNAIL_MAX_SIZE/4)
/* small enough to make bilinear downscaling fast */
...
...
@@ -594,14 +594,16 @@ surface_small_enough(cairo_surface_t* surface, cairo_surface_t* old)
const
unsigned
int
width
=
cairo_image_surface_get_width
(
surface
);
const
unsigned
int
height
=
cairo_image_surface_get_height
(
surface
);
if
(
width
*
height
>
THUMBNAIL_MAX_SIZE
)
{
const
size_t
new_size
=
width
*
height
;
if
(
new_size
>
THUMBNAIL_MAX_SIZE
)
{
return
false
;
}
if
(
old
!=
NULL
)
{
const
unsigned
int
width_old
=
cairo_image_surface_get_width
(
old
);
const
unsigned
int
height_old
=
cairo_image_surface_get_height
(
old
);
if
(
width
*
height
<
width_old
*
height_old
)
{
const
size_t
old_size
=
width_old
*
height_old
;
if
(
new_size
<
old_size
&&
new_size
>=
old_size
*
THUMBNAIL_MAX_SCALE
*
THUMBNAIL_MAX_SCALE
)
{
return
false
;
}
}
...
...
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