Bug 215015

Summary: [CG] Avoid creating a sub-image when drawing a small scaled sub-rect from a native image
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Said Abou-Hallawa
Reported 2020-07-31 02:18:55 PDT
The reason for creating the sub-image in GraphicsContext::drawNativeImage() is to have a better image interpolation for the scaled sub-rect. For small destRect, the interpolation on the original image is almost the same as the interpolation on the sub-image. So we should avoid creating the sub-image if destRect.area() is less than some minimum value. This will benefit the case of drawing many small rectangles from a large sprite image.
Attachments
Patch (2.48 KB, patch)
2020-07-31 02:28 PDT, Said Abou-Hallawa
no flags
Patch (10.48 KB, patch)
2020-08-03 01:10 PDT, Said Abou-Hallawa
no flags
Patch (10.77 KB, patch)
2020-08-03 12:06 PDT, Said Abou-Hallawa
no flags
Patch (2.69 KB, patch)
2020-08-06 12:15 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2020-07-31 02:19:47 PDT
Said Abou-Hallawa
Comment 2 2020-07-31 02:28:38 PDT
Simon Fraser (smfr)
Comment 3 2020-07-31 08:58:35 PDT
Does the subimage cache come into play here? Does turning it off change behavior?
Said Abou-Hallawa
Comment 4 2020-08-03 01:10:05 PDT
Said Abou-Hallawa
Comment 5 2020-08-03 12:06:35 PDT
Said Abou-Hallawa
Comment 6 2020-08-03 12:19:25 PDT
(In reply to Simon Fraser (smfr) from comment #3) > Does the subimage cache come into play here? Does turning it off change > behavior? No not really. Subimage cache requires creating the sub images also. So the cost of caching these images is added when the sub-image is rendered for the first time. For example, a page creates a picker element when it is first needed. When the picker element is popped up, its layer is rendered and the children elements are rendered for the first time. At this time the rendering might be slow if many sub-images are created. When the user selects an element from the picker or dismisses it, the picker element is hidden. If the user invokes an action which pops the picker up again, no rendering will be needed. All we need is showing the picker's layer. So caching and non caching the sub-images will not affect the rendering speed after the first time the sub-images are rendered.
Said Abou-Hallawa
Comment 7 2020-08-06 12:15:50 PDT
EWS
Comment 8 2020-08-06 14:02:18 PDT
Committed r265346: <https://trac.webkit.org/changeset/265346> All reviewed patches have been landed. Closing bug and clearing flags on attachment 406099 [details].
Note You need to log in before you can comment on or make changes to this bug.