perf(pixmap): unify the registry on get() and bound the caches by bytes - #326
Open
gmmcosta15 wants to merge 1 commit into
Open
perf(pixmap): unify the registry on get() and bound the caches by bytes#326gmmcosta15 wants to merge 1 commit into
gmmcosta15 wants to merge 1 commit into
Conversation
This was referenced Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Last PR of the BlocksPixmap stack. Collapses the registry to a single entry point and
replaces the entry-count caps with byte budgets.
scaled()folded intoget(): one call takes anIconor an existingQPixmap, and anyQSize/QSizeF/QRect/QRectFas the target._as_size()normalises the target in one place; 4 call sites move from truncate to round (1px max)._pixmaps12 MiB,_scaled8 MiB,_tints8 MiB) instead of entry-capped.tinted()takes a composition mode, soblocks_buttonstops allocating a pixmap per paint.source()added for the three call sites that need the intrinsic size.Icon.LOGO_BLOCKSreplaces a raw filesystem path that resolved to nothing on device.Antialiasing+SmoothPixmapTransformfromblocks_button._paint_pixmap.Motivation
An entry cap cannot bound a mixed-size cache. A 64px icon rescale is 16 KiB and a 400x300 thumbnail is 480 KiB, so a 64-entry cap ranges 2-60 MiB purely on how the user browses. Qt bounds
QPixmapCacheby bytes for the same reason. On a 2 GB box with 209 MiB free that variance is the whole budget.The two render hints are no-ops on a 1:1 integer-offset blit, which is the only thing
_paint_pixmapdoes now that the scale happens in the cache.Tests
New coverage: byte-bounded eviction on both caches, LRU order (a FIFO would drop the startup icons first), aspect-mode and colour key separation, and every
QSize/QSizeF/QRect/QRectFtarget normalising to one cache entry.