From 269e7f6c1413fd3d4724d60bc5f82324a2dbf2b6 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Fri, 10 Apr 2026 11:30:52 -0400 Subject: libview: Account for device scale in page cache size calculation On HiDPI displays, rendered pages use more memory than the cache budget expects because the size calculation does not account for the device scale factor. This causes the cache to use up to 4x more memory than configured on 2x HiDPI displays. --- libview/ev-pixbuf-cache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libview') diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c index 163267f6..d0b102f8 100644 --- a/libview/ev-pixbuf-cache.c +++ b/libview/ev-pixbuf-cache.c @@ -430,11 +430,14 @@ ev_pixbuf_cache_get_page_size (EvPixbufCache *pixbuf_cache, gint rotation) { gint width, height; + gint device_scale; + device_scale = get_device_scale (pixbuf_cache); _get_page_size_for_scale_and_rotation (pixbuf_cache->document, page_index, scale, rotation, &width, &height); - return height * cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width); + return (height * device_scale) * + cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width * device_scale); } static gint -- cgit v1.2.1