mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-21 22:11:22 +03:00
desktop: clamp dpi in browser_set_dpi() to sensible values
The cocoa frontend missed a cast resulting in a huge negative dpi and some GB allocated for thumbnails...
This commit is contained in:
parent
d9a593c984
commit
ad4cdc62b8
@ -23,12 +23,19 @@
|
||||
*/
|
||||
|
||||
#include "utils/errors.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/utils.h"
|
||||
#include "netsurf/browser.h"
|
||||
#include "css/utils.h"
|
||||
|
||||
/* exported interface documented in netsurf/browser.h */
|
||||
nserror browser_set_dpi(int dpi)
|
||||
{
|
||||
if (dpi < 72 || dpi > 250) {
|
||||
int bad = dpi;
|
||||
dpi = min(max(dpi, 72), 250);
|
||||
NSLOG(netsurf, INFO, "Clamping invalid DPI %d to %d", bad, dpi);
|
||||
}
|
||||
nscss_screen_dpi = INTTOFIX(dpi);
|
||||
|
||||
return NSERROR_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user